void cons_show_software_version(const char * const jid, const char * const presence, const char * const name, const char * const version, const char * const os) { if ((name != NULL) || (version != NULL) || (os != NULL)) { cons_show(""); win_print_time(console, '-'); win_presence_colour_on(console, presence); wprintw(console->win, "%s", jid); win_presence_colour_off(console, presence); wprintw(console->win, ":\n"); } if (name != NULL) { cons_show("Name : %s", name); } if (version != NULL) { cons_show("Version : %s", version); } if (os != NULL) { cons_show("OS : %s", os); } ui_console_dirty(); cons_alert(); }
void sv_ev_subscription(const char *barejid, jabber_subscr_t type) { switch (type) { case PRESENCE_SUBSCRIBE: /* TODO: auto-subscribe if needed */ cons_show("Received authorization request from %s", barejid); log_info("Received authorization request from %s", barejid); ui_print_system_msg_from_recipient(barejid, "Authorization request, type '/sub allow' to accept or '/sub deny' to reject"); if (prefs_get_boolean(PREF_NOTIFY_SUB)) { notify_subscription(barejid); } break; case PRESENCE_SUBSCRIBED: cons_show("Subscription received from %s", barejid); log_info("Subscription received from %s", barejid); ui_print_system_msg_from_recipient(barejid, "Subscribed"); break; case PRESENCE_UNSUBSCRIBED: cons_show("%s deleted subscription", barejid); log_info("%s deleted subscription", barejid); ui_print_system_msg_from_recipient(barejid, "Unsubscribed"); break; default: /* unknown type */ break; } }
void ui_handle_room_config_submit_result(const char *const roomjid) { if (roomjid) { ProfWin *form_window = NULL; ProfWin *muc_window = (ProfWin*)wins_get_muc(roomjid); GString *form_recipient = g_string_new(roomjid); g_string_append(form_recipient, " config"); form_window = (ProfWin*) wins_get_muc_conf(form_recipient->str); g_string_free(form_recipient, TRUE); if (form_window) { int num = wins_get_num(form_window); wins_close_by_num(num); } if (muc_window) { ui_focus_win((ProfWin*)muc_window); win_println(muc_window, THEME_ROOMINFO, '!', "Room configuration successful"); } else { ProfWin *console = wins_get_console(); ui_focus_win(console); cons_show("Room configuration successful: %s", roomjid); } } else { cons_show("Room configuration successful"); } }
void cons_show_account_list(gchar **accounts) { int size = g_strv_length(accounts); if (size > 0) { cons_show("Accounts:"); int i = 0; for (i = 0; i < size; i++) { if ((jabber_get_connection_status() == JABBER_CONNECTED) && (g_strcmp0(jabber_get_account_name(), accounts[i]) == 0)) { resource_presence_t presence = accounts_get_last_presence(accounts[i]); win_print_time(console, '-'); win_presence_colour_on(console, string_from_resource_presence(presence)); wprintw(console->win, "%s\n", accounts[i]); win_presence_colour_off(console, string_from_resource_presence(presence)); } else { cons_show(accounts[i]); } } cons_show(""); } else { cons_show("No accounts created yet."); cons_show(""); } ui_console_dirty(); cons_alert(); }
void cons_show_bookmarks(const GList *list) { Bookmark *item; cons_show(""); cons_show("Bookmarks:"); /* TODO: show status (connected or not) and window number */ while (list != NULL) { item = list->data; win_print_time(console, '-'); wprintw(console->win, " %s", item->jid); if (item->nick != NULL) { wprintw(console->win, "/%s", item->nick); } if (item->autojoin) { wprintw(console->win, " (autojoin)"); } wprintw(console->win, "\n"); list = g_list_next(list); } ui_console_dirty(); cons_alert(); }
void cons_check_version(gboolean not_available_msg) { char *latest_release = release_get_latest(); if (latest_release != NULL) { gboolean relase_valid = g_regex_match_simple("^\\d+\\.\\d+\\.\\d+$", latest_release, 0, 0); if (relase_valid) { if (release_is_new(latest_release)) { win_print_time(console, '-'); wprintw(console->win, "A new version of Profanity is available: %s", latest_release); win_print_time(console, '-'); wprintw(console->win, "Check <http://www.profanity.im> for details.\n"); free(latest_release); win_print_time(console, '-'); wprintw(console->win, "\n"); } else { if (not_available_msg) { cons_show("No new version available."); cons_show(""); } } ui_console_dirty(); cons_alert(); } } }
void cons_beep_setting(void) { if (prefs_get_boolean(PREF_BEEP)) cons_show("Terminal beep (/beep) : ON"); else cons_show("Terminal beep (/beep) : OFF"); }
void cons_flash_setting(void) { if (prefs_get_boolean(PREF_FLASH)) cons_show("Terminal flash (/flash) : ON"); else cons_show("Terminal flash (/flash) : OFF"); }
void cons_splash_setting(void) { if (prefs_get_boolean(PREF_SPLASH)) cons_show("Splash screen (/splash) : ON"); else cons_show("Splash screen (/splash) : OFF"); }
void cons_vercheck_setting(void) { if (prefs_get_boolean(PREF_VERCHECK)) cons_show("Version checking (/vercheck) : ON"); else cons_show("Version checking (/vercheck) : OFF"); }
void cons_statuses_setting(void) { if (prefs_get_boolean(PREF_STATUSES)) cons_show("Status (/statuses) : ON"); else cons_show("Status (/statuses) : OFF"); }
void cons_history_setting(void) { if (prefs_get_boolean(PREF_HISTORY)) cons_show("Chat history (/history) : ON"); else cons_show("Chat history (/history) : OFF"); }
void cons_intype_setting(void) { if (prefs_get_boolean(PREF_INTYPE)) cons_show("Show typing (/intype) : ON"); else cons_show("Show typing (/intype) : OFF"); }
void cons_outtype_setting(void) { if (prefs_get_boolean(PREF_OUTTYPE)) cons_show("Send composing (/outtype) : ON"); else cons_show("Send composing (/outtype) : OFF"); }
void cons_states_setting(void) { if (prefs_get_boolean(PREF_STATES)) cons_show("Send chat states (/states) : ON"); else cons_show("Send chat states (/states) : OFF"); }
void cons_mouse_setting(void) { if (prefs_get_boolean(PREF_MOUSE)) cons_show("Mouse handling (/mouse) : ON"); else cons_show("Mouse handling (/mouse) : OFF"); }
void cons_grlog_setting(void) { if (prefs_get_boolean(PREF_GRLOG)) cons_show("Groupchat logging (/grlog) : ON"); else cons_show("Groupchat logging (/grlog) : OFF"); }
void cons_chlog_setting(void) { if (prefs_get_boolean(PREF_CHLOG)) cons_show("Chat logging (/chlog) : ON"); else cons_show("Chat logging (/chlog) : OFF"); }
void ui_roster_add(const char * const barejid, const char * const name) { if (name != NULL) { cons_show("Roster item added: %s (%s)", barejid, name); } else { cons_show("Roster item added: %s", barejid); } }
void handle_ping_result(const char * const from, int millis) { if (from == NULL) { cons_show("Ping response from server: %dms.", millis); } else { cons_show("Ping response from %s: %dms.", from, millis); } }
void cons_titlebar_setting(void) { if (prefs_get_boolean(PREF_TITLEBARVERSION)) { cons_show("Titlebar display (/titlebar) : version"); } else { cons_show("Titlebar display (/titlebar) : NONE"); } }
void cons_show_presence_prefs(void) { cons_show("Presence preferences:"); cons_show(""); cons_autoaway_setting(); ui_console_dirty(); cons_alert(); }
void cons_show_desktop_prefs(void) { cons_show("Desktop notification preferences:"); cons_show(""); cons_notify_setting(); ui_console_dirty(); cons_alert(); }
void cons_theme_setting(void) { gchar *theme = prefs_get_string(PREF_THEME); if (theme == NULL) { cons_show("Theme (/theme) : default"); } else { cons_show("Theme (/theme) : %s", theme); } }
void cons_show_roster(GSList *list) { cons_show(""); cons_show("Roster:"); _show_roster_contacts(list, TRUE); ui_console_dirty(); cons_alert(); }
void cons_show_connection_prefs(void) { cons_show("Connection preferences:"); cons_show(""); cons_reconnect_setting(); cons_autoping_setting(); ui_console_dirty(); cons_alert(); }
void ui_tidy_wins(void) { gboolean tidied = wins_tidy(); if (tidied) { cons_show("Windows tidied."); } else { cons_show("No tidy needed."); } }
void cons_show_log_prefs(void) { cons_show("Logging preferences:"); cons_show(""); cons_log_setting(); cons_chlog_setting(); cons_grlog_setting(); ui_console_dirty(); cons_alert(); }
void cons_reconnect_setting(void) { gint reconnect_interval = prefs_get_reconnect(); if (reconnect_interval == 0) { cons_show("Reconnect interval (/reconnect) : OFF"); } else if (reconnect_interval == 1) { cons_show("Reconnect interval (/reconnect) : 1 second"); } else { cons_show("Reconnect interval (/reconnect) : %d seconds", reconnect_interval); } }
void cons_autoping_setting(void) { gint autoping_interval = prefs_get_autoping(); if (autoping_interval == 0) { cons_show("Autoping interval (/autoping) : OFF"); } else if (autoping_interval == 1) { cons_show("Autoping interval (/autoping) : 1 second"); } else { cons_show("Autoping interval (/autoping) : %d seconds", autoping_interval); } }