diff options
Diffstat (limited to 'src/ui/console.c')
-rw-r--r-- | src/ui/console.c | 314 |
1 files changed, 189 insertions, 125 deletions
diff --git a/src/ui/console.c b/src/ui/console.c index 00e891db..83a2b82e 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -47,24 +47,24 @@ static void _cons_splash_logo(void); void _show_roster_contacts(GSList *list, gboolean show_groups); -void -cons_show_time(void) +static void +_cons_show_time(void) { ProfWin *console = wins_get_console(); win_print_time(console, '-'); wins_refresh_console(); } -void -cons_show_word(const char * const word) +static void +_cons_show_word(const char * const word) { ProfWin *console = wins_get_console(); wprintw(console->win, "%s", word); wins_refresh_console(); } -void -cons_debug(const char * const msg, ...) +static void +_cons_debug(const char * const msg, ...) { ProfWin *console = wins_get_console(); if (strcmp(PACKAGE_STATUS, "development") == 0) { @@ -85,8 +85,8 @@ cons_debug(const char * const msg, ...) } } -void -cons_show(const char * const msg, ...) +static void +_cons_show(const char * const msg, ...) { ProfWin *console = wins_get_console(); va_list arg; @@ -100,8 +100,8 @@ cons_show(const char * const msg, ...) wins_refresh_console(); } -void -cons_show_error(const char * const msg, ...) +static void +_cons_show_error(const char * const msg, ...) { ProfWin *console = wins_get_console(); va_list arg; @@ -119,8 +119,8 @@ cons_show_error(const char * const msg, ...) cons_alert(); } -void -cons_show_typing(const char * const barejid) +static void +_cons_show_typing(const char * const barejid) { ProfWin *console = wins_get_console(); PContact contact = roster_get_contact(barejid); @@ -137,8 +137,8 @@ cons_show_typing(const char * const barejid) cons_alert(); } -void -cons_show_incoming_message(const char * const short_from, const int win_index) +static void +_cons_show_incoming_message(const char * const short_from, const int win_index) { ProfWin *console = wins_get_console(); @@ -155,8 +155,8 @@ cons_show_incoming_message(const char * const short_from, const int win_index) cons_alert(); } -void -cons_about(void) +static void +_cons_about(void) { ProfWin *console = wins_get_console(); int rows, cols; @@ -207,8 +207,8 @@ cons_about(void) cons_alert(); } -void -cons_check_version(gboolean not_available_msg) +static void +_cons_check_version(gboolean not_available_msg) { ProfWin *console = wins_get_console(); char *latest_release = release_get_latest(); @@ -238,8 +238,8 @@ cons_check_version(gboolean not_available_msg) } } -void -cons_show_login_success(ProfAccount *account) +static void +_cons_show_login_success(ProfAccount *account) { ProfWin *console = wins_get_console(); win_print_time(console, '-'); @@ -258,8 +258,8 @@ cons_show_login_success(ProfAccount *account) cons_alert(); } -void -cons_show_wins(void) +static void +_cons_show_wins(void) { ProfWin *console = wins_get_console(); cons_show(""); @@ -279,8 +279,8 @@ cons_show_wins(void) cons_alert(); } -void -cons_show_room_invites(GSList *invites) +static void +_cons_show_room_invites(GSList *invites) { cons_show(""); if (invites == NULL) { @@ -297,8 +297,8 @@ cons_show_room_invites(GSList *invites) cons_alert(); } -void -cons_show_info(PContact pcontact) +static void +_cons_show_info(PContact pcontact) { ProfWin *console = wins_get_console(); const char *barejid = p_contact_barejid(pcontact); @@ -430,8 +430,8 @@ cons_show_info(PContact pcontact) cons_alert(); } -void -cons_show_caps(const char * const contact, Resource *resource) +static void +_cons_show_caps(const char * const contact, Resource *resource) { ProfWin *console = wins_get_console(); WINDOW *win = console->win; @@ -505,8 +505,8 @@ cons_show_caps(const char * const contact, Resource *resource) cons_alert(); } -void -cons_show_software_version(const char * const jid, const char * const presence, +static 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) { ProfWin *console = wins_get_console(); @@ -532,8 +532,8 @@ cons_show_software_version(const char * const jid, const char * const presence, cons_alert(); } -void -cons_show_received_subs(void) +static void +_cons_show_received_subs(void) { GSList *received = presence_get_subscription_requests(); if (received == NULL) { @@ -548,12 +548,11 @@ cons_show_received_subs(void) g_slist_free_full(received, g_free); } - wins_refresh_console(); cons_alert(); } -void -cons_show_sent_subs(void) +static void +_cons_show_sent_subs(void) { if (roster_has_pending_subscriptions()) { GSList *contacts = roster_get_contacts(); @@ -570,12 +569,11 @@ cons_show_sent_subs(void) cons_show("No pending requests sent."); } - wins_refresh_console(); cons_alert(); } -void -cons_show_room_list(GSList *rooms, const char * const conference_node) +static void +_cons_show_room_list(GSList *rooms, const char * const conference_node) { ProfWin *console = wins_get_console(); if ((rooms != NULL) && (g_slist_length(rooms) > 0)) { @@ -598,8 +596,8 @@ cons_show_room_list(GSList *rooms, const char * const conference_node) cons_alert(); } -void -cons_show_bookmarks(const GList *list) +static void +_cons_show_bookmarks(const GList *list) { Bookmark *item; @@ -628,8 +626,8 @@ cons_show_bookmarks(const GList *list) cons_alert(); } -void -cons_show_disco_info(const char *jid, GSList *identities, GSList *features) +static void +_cons_show_disco_info(const char *jid, GSList *identities, GSList *features) { if (((identities != NULL) && (g_slist_length(identities) > 0)) || ((features != NULL) && (g_slist_length(features) > 0))) { @@ -671,8 +669,8 @@ cons_show_disco_info(const char *jid, GSList *identities, GSList *features) } } -void -cons_show_disco_items(GSList *items, const char * const jid) +static void +_cons_show_disco_items(GSList *items, const char * const jid) { ProfWin *console = wins_get_console(); if ((items != NULL) && (g_slist_length(items) > 0)) { @@ -696,8 +694,8 @@ cons_show_disco_items(GSList *items, const char * const jid) cons_alert(); } -void -cons_show_status(const char * const barejid) +static void +_cons_show_status(const char * const barejid) { ProfWin *console = wins_get_console(); PContact pcontact = roster_get_contact(barejid); @@ -711,8 +709,8 @@ cons_show_status(const char * const barejid) cons_alert(); } -void -cons_show_room_invite(const char * const invitor, const char * const room, +static void +_cons_show_room_invite(const char * const invitor, const char * const room, const char * const reason) { char *display_from = NULL; @@ -748,8 +746,8 @@ cons_show_room_invite(const char * const invitor, const char * const room, cons_alert(); } -void -cons_show_account_list(gchar **accounts) +static void +_cons_show_account_list(gchar **accounts) { ProfWin *console = wins_get_console(); int size = g_strv_length(accounts); @@ -778,8 +776,8 @@ cons_show_account_list(gchar **accounts) cons_alert(); } -void -cons_show_account(ProfAccount *account) +static void +_cons_show_account(ProfAccount *account) { ProfWin *console = wins_get_console(); cons_show(""); @@ -901,8 +899,8 @@ cons_show_account(ProfAccount *account) cons_alert(); } -void -cons_theme_setting(void) +static void +_cons_theme_setting(void) { gchar *theme = prefs_get_string(PREF_THEME); if (theme == NULL) { @@ -912,8 +910,8 @@ cons_theme_setting(void) } } -void -cons_beep_setting(void) +static void +_cons_beep_setting(void) { if (prefs_get_boolean(PREF_BEEP)) cons_show("Terminal beep (/beep) : ON"); @@ -921,8 +919,8 @@ cons_beep_setting(void) cons_show("Terminal beep (/beep) : OFF"); } -void -cons_flash_setting(void) +static void +_cons_flash_setting(void) { if (prefs_get_boolean(PREF_FLASH)) cons_show("Terminal flash (/flash) : ON"); @@ -930,8 +928,8 @@ cons_flash_setting(void) cons_show("Terminal flash (/flash) : OFF"); } -void -cons_splash_setting(void) +static void +_cons_splash_setting(void) { if (prefs_get_boolean(PREF_SPLASH)) cons_show("Splash screen (/splash) : ON"); @@ -939,8 +937,8 @@ cons_splash_setting(void) cons_show("Splash screen (/splash) : OFF"); } -void -cons_autoconnect_setting(void) +static void +_cons_autoconnect_setting(void) { if (prefs_get_string(PREF_CONNECT_ACCOUNT) != NULL) cons_show("Autoconnect (/autoconnect) : %s", prefs_get_string(PREF_CONNECT_ACCOUNT)); @@ -948,8 +946,8 @@ cons_autoconnect_setting(void) cons_show("Autoconnect (/autoconnect) : OFF"); } -void -cons_vercheck_setting(void) +static void +_cons_vercheck_setting(void) { if (prefs_get_boolean(PREF_VERCHECK)) cons_show("Version checking (/vercheck) : ON"); @@ -957,8 +955,8 @@ cons_vercheck_setting(void) cons_show("Version checking (/vercheck) : OFF"); } -void -cons_mouse_setting(void) +static void +_cons_mouse_setting(void) { if (prefs_get_boolean(PREF_MOUSE)) cons_show("Mouse handling (/mouse) : ON"); @@ -966,8 +964,8 @@ cons_mouse_setting(void) cons_show("Mouse handling (/mouse) : OFF"); } -void -cons_statuses_setting(void) +static void +_cons_statuses_setting(void) { if (prefs_get_boolean(PREF_STATUSES)) cons_show("Status (/statuses) : ON"); @@ -975,8 +973,8 @@ cons_statuses_setting(void) cons_show("Status (/statuses) : OFF"); } -void -cons_titlebar_setting(void) +static void +_cons_titlebar_setting(void) { if (prefs_get_boolean(PREF_TITLEBARVERSION)) { cons_show("Titlebar display (/titlebar) : version"); @@ -985,8 +983,8 @@ cons_titlebar_setting(void) } } -void -cons_show_ui_prefs(void) +static void +_cons_show_ui_prefs(void) { cons_show("UI preferences:"); cons_show(""); @@ -1003,8 +1001,8 @@ cons_show_ui_prefs(void) cons_alert(); } -void -cons_notify_setting(void) +static void +_cons_notify_setting(void) { if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) cons_show("Messages (/notify message) : ON"); @@ -1036,8 +1034,8 @@ cons_notify_setting(void) } } -void -cons_show_desktop_prefs(void) +static void +_cons_show_desktop_prefs(void) { cons_show("Desktop notification preferences:"); cons_show(""); @@ -1047,8 +1045,8 @@ cons_show_desktop_prefs(void) cons_alert(); } -void -cons_states_setting(void) +static void +_cons_states_setting(void) { if (prefs_get_boolean(PREF_STATES)) cons_show("Send chat states (/states) : ON"); @@ -1056,8 +1054,8 @@ cons_states_setting(void) cons_show("Send chat states (/states) : OFF"); } -void -cons_outtype_setting(void) +static void +_cons_outtype_setting(void) { if (prefs_get_boolean(PREF_OUTTYPE)) cons_show("Send composing (/outtype) : ON"); @@ -1065,8 +1063,8 @@ cons_outtype_setting(void) cons_show("Send composing (/outtype) : OFF"); } -void -cons_intype_setting(void) +static void +_cons_intype_setting(void) { if (prefs_get_boolean(PREF_INTYPE)) cons_show("Show typing (/intype) : ON"); @@ -1074,8 +1072,8 @@ cons_intype_setting(void) cons_show("Show typing (/intype) : OFF"); } -void -cons_gone_setting(void) +static void +_cons_gone_setting(void) { gint gone_time = prefs_get_gone(); if (gone_time == 0) { @@ -1087,8 +1085,8 @@ cons_gone_setting(void) } } -void -cons_history_setting(void) +static void +_cons_history_setting(void) { if (prefs_get_boolean(PREF_HISTORY)) cons_show("Chat history (/history) : ON"); @@ -1096,8 +1094,8 @@ cons_history_setting(void) cons_show("Chat history (/history) : OFF"); } -void -cons_show_chat_prefs(void) +static void +_cons_show_chat_prefs(void) { cons_show("Chat preferences:"); cons_show(""); @@ -1111,14 +1109,14 @@ cons_show_chat_prefs(void) cons_alert(); } -void -cons_log_setting(void) +static void +_cons_log_setting(void) { cons_show("Max log size (/log maxsize) : %d bytes", prefs_get_max_log_size()); } -void -cons_chlog_setting(void) +static void +_cons_chlog_setting(void) { if (prefs_get_boolean(PREF_CHLOG)) cons_show("Chat logging (/chlog) : ON"); @@ -1126,8 +1124,8 @@ cons_chlog_setting(void) cons_show("Chat logging (/chlog) : OFF"); } -void -cons_grlog_setting(void) +static void +_cons_grlog_setting(void) { if (prefs_get_boolean(PREF_GRLOG)) cons_show("Groupchat logging (/grlog) : ON"); @@ -1135,8 +1133,8 @@ cons_grlog_setting(void) cons_show("Groupchat logging (/grlog) : OFF"); } -void -cons_show_log_prefs(void) +static void +_cons_show_log_prefs(void) { cons_show("Logging preferences:"); cons_show(""); @@ -1148,8 +1146,8 @@ cons_show_log_prefs(void) cons_alert(); } -void -cons_autoaway_setting(void) +static void +_cons_autoaway_setting(void) { if (strcmp(prefs_get_string(PREF_AUTOAWAY_MODE), "off") == 0) { cons_show("Autoaway (/autoaway mode) : OFF"); @@ -1173,8 +1171,8 @@ cons_autoaway_setting(void) } } -void -cons_show_presence_prefs(void) +static void +_cons_show_presence_prefs(void) { cons_show("Presence preferences:"); cons_show(""); @@ -1184,8 +1182,8 @@ cons_show_presence_prefs(void) cons_alert(); } -void -cons_reconnect_setting(void) +static void +_cons_reconnect_setting(void) { gint reconnect_interval = prefs_get_reconnect(); if (reconnect_interval == 0) { @@ -1197,8 +1195,8 @@ cons_reconnect_setting(void) } } -void -cons_autoping_setting(void) +static void +_cons_autoping_setting(void) { gint autoping_interval = prefs_get_autoping(); if (autoping_interval == 0) { @@ -1210,15 +1208,15 @@ cons_autoping_setting(void) } } -void -cons_priority_setting(void) +static void +_cons_priority_setting(void) { gint priority = prefs_get_priority(); cons_show("Priority (/priority) : %d", priority); } -void -cons_show_connection_prefs(void) +static void +_cons_show_connection_prefs(void) { cons_show("Connection preferences:"); cons_show(""); @@ -1230,8 +1228,8 @@ cons_show_connection_prefs(void) cons_alert(); } -void -cons_show_themes(GSList *themes) +static void +_cons_show_themes(GSList *themes) { cons_show(""); @@ -1249,8 +1247,8 @@ cons_show_themes(GSList *themes) cons_alert(); } -void -cons_prefs(void) +static void +_cons_prefs(void) { cons_show(""); cons_show_ui_prefs(); @@ -1270,8 +1268,8 @@ cons_prefs(void) cons_alert(); } -void -cons_help(void) +static void +_cons_help(void) { cons_show(""); cons_show("Choose a help option:"); @@ -1282,7 +1280,7 @@ cons_help(void) cons_show("/help groupchat - List groupchat commands."); cons_show("/help presence - List commands to change presence."); cons_show("/help roster - List commands for manipulating your roster."); - cons_show("/help service - List service discovery commands"); + cons_show("/help service - List service discovery commands."); cons_show("/help settings - List commands for changing settings."); cons_show("/help other - Other commands."); cons_show("/help navigation - How to navigate around Profanity."); @@ -1293,8 +1291,8 @@ cons_help(void) cons_alert(); } -void -cons_navigation_help(void) +static void +_cons_navigation_help(void) { cons_show(""); cons_show("Navigation:"); @@ -1317,8 +1315,8 @@ cons_navigation_help(void) cons_alert(); } -void -cons_show_roster_group(const char * const group, GSList *list) +static void +_cons_show_roster_group(const char * const group, GSList *list) { cons_show(""); @@ -1333,8 +1331,8 @@ cons_show_roster_group(const char * const group, GSList *list) cons_alert(); } -void -cons_show_roster(GSList *list) +static void +_cons_show_roster(GSList *list) { cons_show(""); cons_show("Roster:"); @@ -1344,8 +1342,8 @@ cons_show_roster(GSList *list) cons_alert(); } -void -cons_show_contacts(GSList *list) +static void +_cons_show_contacts(GSList *list) { ProfWin *console = wins_get_console(); GSList *curr = list; @@ -1363,8 +1361,8 @@ cons_show_contacts(GSList *list) cons_alert(); } -void -cons_alert(void) +static void +_cons_alert(void) { if (ui_current_win_type() != WIN_CONSOLE) { status_bar_new(1); @@ -1502,3 +1500,69 @@ _show_roster_contacts(GSList *list, gboolean show_groups) } } + +void +console_init_module(void) +{ + cons_show_time = _cons_show_time; + cons_show_word = _cons_show_word; + cons_debug = _cons_debug; + cons_show = _cons_show; + cons_show_error = _cons_show_error; + cons_show_typing = _cons_show_typing; + cons_show_incoming_message = _cons_show_incoming_message; + cons_about = _cons_about; + cons_check_version = _cons_check_version; + cons_show_login_success = _cons_show_login_success; + cons_show_wins = _cons_show_wins; + cons_show_room_invites = _cons_show_room_invites; + cons_show_info = _cons_show_info; + cons_show_caps = _cons_show_caps; + cons_show_software_version = _cons_show_software_version; + cons_show_received_subs = _cons_show_received_subs; + cons_show_sent_subs = _cons_show_sent_subs; + cons_show_room_list = _cons_show_room_list; + cons_show_bookmarks = _cons_show_bookmarks; + cons_show_disco_info = _cons_show_disco_info; + cons_show_disco_items = _cons_show_disco_items; + cons_show_status = _cons_show_status; + cons_show_room_invite = _cons_show_room_invite; + cons_show_account_list = _cons_show_account_list; + cons_show_account = _cons_show_account; + cons_theme_setting = _cons_theme_setting; + cons_beep_setting = _cons_beep_setting; + cons_flash_setting = _cons_flash_setting; + cons_splash_setting = _cons_splash_setting; + cons_autoconnect_setting = _cons_autoconnect_setting; + cons_vercheck_setting = _cons_vercheck_setting; + cons_mouse_setting = _cons_mouse_setting; + cons_statuses_setting = _cons_statuses_setting; + cons_titlebar_setting = _cons_titlebar_setting; + cons_show_ui_prefs = _cons_show_ui_prefs; + cons_notify_setting = _cons_notify_setting; + cons_show_desktop_prefs = _cons_show_desktop_prefs; + cons_states_setting = _cons_states_setting; + cons_outtype_setting = _cons_outtype_setting; + cons_intype_setting = _cons_intype_setting; + cons_gone_setting = _cons_gone_setting; + cons_history_setting = _cons_history_setting; + cons_show_chat_prefs = _cons_show_chat_prefs; + cons_log_setting = _cons_log_setting; + cons_chlog_setting = _cons_chlog_setting; + cons_grlog_setting = _cons_grlog_setting; + cons_show_log_prefs = _cons_show_log_prefs; + cons_autoaway_setting = _cons_autoaway_setting; + cons_show_presence_prefs = _cons_show_presence_prefs; + cons_reconnect_setting = _cons_reconnect_setting; + cons_autoping_setting = _cons_autoping_setting; + cons_priority_setting = _cons_priority_setting; + cons_show_connection_prefs = _cons_show_connection_prefs; + cons_show_themes = _cons_show_themes; + cons_prefs = _cons_prefs; + cons_help = _cons_help; + cons_navigation_help = _cons_navigation_help; + cons_show_roster_group = _cons_show_roster_group; + cons_show_roster = _cons_show_roster; + cons_show_contacts = _cons_show_contacts; + cons_alert = _cons_alert; +} |