char * twc_bar_item_away(void *data, struct t_gui_bar_item *item, struct t_gui_window *window, struct t_gui_buffer *buffer, struct t_hashtable *extra_info) { struct t_twc_profile *profile = twc_profile_search_buffer(buffer); if (!profile || !(profile->tox)) return NULL; char *status; switch (tox_self_get_status(profile->tox)) { case TOX_USER_STATUS_NONE: status = NULL; break; case TOX_USER_STATUS_BUSY: status = strdup("busy"); break; case TOX_USER_STATUS_AWAY: status = strdup("away"); break; } return status; }
static void mplex_timer_handler (Tox *m) { TOX_USER_STATUS current_status, new_status; const char *new_note; if (mplex == MPLEX_NONE) return; int detached = mplex_is_detached (); pthread_mutex_lock (&Winthread.lock); current_status = tox_self_get_status (m); pthread_mutex_unlock (&Winthread.lock); if (auto_away_active && current_status == TOX_USER_STATUS_AWAY && !detached) { auto_away_active = false; new_status = prev_status; new_note = prev_note; } else if (current_status == TOX_USER_STATUS_NONE && detached) { auto_away_active = true; prev_status = current_status; new_status = TOX_USER_STATUS_AWAY; pthread_mutex_lock (&Winthread.lock); size_t slen = tox_self_get_status_message_size(m); tox_self_get_status_message (m, (uint8_t*) prev_note); prev_note[slen] = '\0'; pthread_mutex_unlock (&Winthread.lock); new_note = user_settings->mplex_away_note; } else return; char argv[3][MAX_STR_SIZE]; strcpy (argv[0], "/status"); strcpy (argv[1], (new_status == TOX_USER_STATUS_AWAY ? "away" : new_status == TOX_USER_STATUS_BUSY ? "busy" : "online")); argv[2][0] = '\"'; strcpy (argv[2] + 1, new_note); strcat (argv[2], "\""); pthread_mutex_lock (&Winthread.lock); cmd_status (prompt->chatwin->history, prompt, m, 2, argv); pthread_mutex_unlock (&Winthread.lock); }
void prompt_init_statusbar(ToxWindow *self, Tox *m) { int x2, y2; getmaxyx(self->window, y2, x2); (void) y2; /* Init statusbar info */ StatusBar *statusbar = self->stb; statusbar->status = TOX_USER_STATUS_NONE; statusbar->connection = TOX_CONNECTION_NONE; char nick[TOX_MAX_NAME_LENGTH]; char statusmsg[TOX_MAX_STATUS_MESSAGE_LENGTH]; size_t n_len = tox_self_get_name_size(m); tox_self_get_name(m, (uint8_t *) nick); size_t s_len = tox_self_get_status_message_size(m); tox_self_get_status_message(m, (uint8_t *) statusmsg); TOX_USER_STATUS status = tox_self_get_status(m); nick[n_len] = '\0'; statusmsg[s_len] = '\0'; if (s_len == 0 || !strncmp(statusmsg, "Toxing on Toxic", strlen("Toxing on Toxic"))) { snprintf(statusmsg, sizeof(statusmsg), "Toxing on Toxic"); s_len = strlen(statusmsg); statusmsg[s_len] = '\0'; } prompt_update_statusmessage(prompt, m, statusmsg); prompt_update_status(prompt, status); prompt_update_nick(prompt, nick); /* Init statusbar subwindow */ statusbar->topline = subwin(self->window, 2, x2, 0, 0); }
/** * @brief Returns our user status */ Status Core::getStatus() const { return (Status)tox_self_get_status(tox); }
Tox_User_Status api_get_status(void) { return tox_self_get_status(user_tox); }
/** * @brief Returns our user status */ Status Core::getStatus() const { return static_cast<Status>(tox_self_get_status(tox)); }