From ca5c6a5745c560a1d799cbcded00e586e2337e4b Mon Sep 17 00:00:00 2001 From: James Booth Date: Tue, 25 Jun 2013 23:38:06 +0100 Subject: [PATCH] Show current setting with settings commands closes #139 --- src/command/command.c | 119 +++++++++++++------------ src/ui/console.c | 203 ++++++++++++++++++++++++++++++++---------- src/ui/ui.h | 22 +++++ 3 files changed, 243 insertions(+), 101 deletions(-) diff --git a/src/command/command.c b/src/command/command.c index c1d0ad64..292df7fb 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -61,6 +61,7 @@ typedef struct cmd_t { gchar** (*parser)(const char * const inp, int min, int max); int min_args; int max_args; + void (*setting_func)(void); CommandHelp help; } Command; @@ -150,7 +151,7 @@ static GHashTable *commands = NULL; static struct cmd_t command_defs[] = { { "/help", - _cmd_help, parse_args, 0, 1, + _cmd_help, parse_args, 0, 1, NULL, { "/help [area|command]", "Get help on using Profanity", { "/help [area|command]", "-------------------------", @@ -166,7 +167,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/about", - _cmd_about, parse_args, 0, 0, + _cmd_about, parse_args, 0, 0, NULL, { "/about", "About Profanity", { "/about", "------", @@ -174,7 +175,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/connect", - _cmd_connect, parse_args, 1, 2, + _cmd_connect, parse_args, 1, 2, NULL, { "/connect account [server]", "Login to a chat service.", { "/connect account [server]", "-------------------------", @@ -187,7 +188,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/disconnect", - _cmd_disconnect, parse_args, 0, 0, + _cmd_disconnect, parse_args, 0, 0, NULL, { "/disconnect", "Logout of current session.", { "/disconnect", "-----------", @@ -195,7 +196,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/msg", - _cmd_msg, parse_args_with_freetext, 1, 2, + _cmd_msg, parse_args_with_freetext, 1, 2, NULL, { "/msg jid|nick [message]", "Start chat with user.", { "/msg jid|nick [message]", "-----------------------", @@ -210,7 +211,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/roster", - _cmd_roster, parse_args_with_freetext, 0, 3, + _cmd_roster, parse_args_with_freetext, 0, 3, NULL, { "/roster [add|remove|nick] [jid] [handle]", "Manage your roster.", { "/roster [add|remove|nick] [jid] [handle]", "----------------------------------------", @@ -230,7 +231,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/group", - _cmd_group, parse_args_with_freetext, 0, 3, + _cmd_group, parse_args_with_freetext, 0, 3, NULL, { "/group show|add|remove [group] [contact]", "Manage roster groups.", { "/group show|add|remove [group] [contact]", "-------------------------------------", @@ -248,7 +249,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/info", - _cmd_info, parse_args, 0, 1, + _cmd_info, parse_args, 0, 1, NULL, { "/info [jid|nick]", "Show basic information about a contact, or room member.", { "/info [jid|nick]", "----------------", @@ -260,7 +261,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/caps", - _cmd_caps, parse_args, 0, 1, + _cmd_caps, parse_args, 0, 1, NULL, { "/caps [fulljid|nick]", "Find out a contacts client software capabilities.", { "/caps [fulljid|nick]", "--------------------", @@ -275,7 +276,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/software", - _cmd_software, parse_args, 0, 1, + _cmd_software, parse_args, 0, 1, NULL, { "/software [fulljid|nick]", "Find out software version information about a contacts resource.", { "/software [fulljid|nick]", "------------------------", @@ -291,7 +292,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/status", - _cmd_status, parse_args, 0, 1, + _cmd_status, parse_args, 0, 1, NULL, { "/status [jid|nick]", "Find out your contacts presence information.", { "/status [jid|nick]", "------------------", @@ -303,7 +304,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/join", - _cmd_join, parse_args_with_freetext, 1, 2, + _cmd_join, parse_args_with_freetext, 1, 2, NULL, { "/join room[@server] [nick]", "Join a chat room.", { "/join room[@server] [nick]", "--------------------------", @@ -319,7 +320,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/leave", - _cmd_leave, parse_args, 0, 0, + _cmd_leave, parse_args, 0, 0, NULL, { "/leave", "Leave a chat room.", { "/leave", "------", @@ -327,7 +328,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/invite", - _cmd_invite, parse_args_with_freetext, 1, 2, + _cmd_invite, parse_args_with_freetext, 1, 2, NULL, { "/invite jid [message]", "Invite contact to chat room.", { "/invite jid [message]", "--------------------------", @@ -337,7 +338,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/invites", - _cmd_invites, parse_args_with_freetext, 0, 0, + _cmd_invites, parse_args_with_freetext, 0, 0, NULL, { "/invites", "Show outstanding chat room invites.", { "/invites", "--------", @@ -347,7 +348,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/decline", - _cmd_decline, parse_args_with_freetext, 1, 1, + _cmd_decline, parse_args_with_freetext, 1, 1, NULL, { "/decline room", "Decline a chat room invite.", { "/decline room", "-------------", @@ -355,7 +356,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/rooms", - _cmd_rooms, parse_args, 0, 1, + _cmd_rooms, parse_args, 0, 1, NULL, { "/rooms [conference-service]", "List chat rooms.", { "/rooms [conference-service]", "---------------------------", @@ -368,7 +369,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/disco", - _cmd_disco, parse_args, 1, 2, + _cmd_disco, parse_args, 1, 2, NULL, { "/disco command entity", "Service discovery.", { "/disco command entity", "---------------------", @@ -386,7 +387,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/nick", - _cmd_nick, parse_args_with_freetext, 1, 1, + _cmd_nick, parse_args_with_freetext, 1, 1, NULL, { "/nick nickname", "Change nickname in chat room.", { "/nick nickname", "--------------", @@ -398,7 +399,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/wins", - _cmd_wins, parse_args, 0, 1, + _cmd_wins, parse_args, 0, 1, NULL, { "/wins [tidy|prune]", "List or tidy active windows.", { "/wins [tidy|prune]", "------------------", @@ -408,7 +409,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/sub", - _cmd_sub, parse_args, 1, 2, + _cmd_sub, parse_args, 1, 2, NULL, { "/sub command [jid]", "Manage subscriptions.", { "/sub command [jid]", "------------------", @@ -431,7 +432,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/tiny", - _cmd_tiny, parse_args, 1, 1, + _cmd_tiny, parse_args, 1, 1, NULL, { "/tiny url", "Send url as tinyurl in current chat.", { "/tiny url", "---------", @@ -441,7 +442,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/duck", - _cmd_duck, parse_args_with_freetext, 1, 1, + _cmd_duck, parse_args_with_freetext, 1, 1, NULL, { "/duck query", "Perform search using DuckDuckGo chatbot.", { "/duck query", "-----------", @@ -452,7 +453,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/who", - _cmd_who, parse_args, 0, 2, + _cmd_who, parse_args, 0, 2, NULL, { "/who [status] [group]", "Show contacts/room participants with chosen status.", { "/who [status] [group]", "---------------------", @@ -468,7 +469,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/close", - _cmd_close, parse_args, 0, 1, + _cmd_close, parse_args, 0, 1, NULL, { "/close [win|read|all]", "Close windows.", { "/close [win|read|all]", "---------------------", @@ -481,7 +482,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/clear", - _cmd_clear, parse_args, 0, 0, + _cmd_clear, parse_args, 0, 0, NULL, { "/clear", "Clear current window.", { "/clear", "------", @@ -489,7 +490,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/quit", - _cmd_quit, parse_args, 0, 0, + _cmd_quit, parse_args, 0, 0, NULL, { "/quit", "Quit Profanity.", { "/quit", "-----", @@ -497,7 +498,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/beep", - _cmd_beep, parse_args, 1, 1, + _cmd_beep, parse_args, 1, 1, cons_beep_setting, { "/beep on|off", "Terminal beep on new messages.", { "/beep on|off", "------------", @@ -507,7 +508,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/notify", - _cmd_notify, parse_args, 2, 2, + _cmd_notify, parse_args, 2, 2, cons_notify_setting, { "/notify type value", "Control various desktop noficiations.", { "/notify type value", "------------------", @@ -533,7 +534,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/flash", - _cmd_flash, parse_args, 1, 1, + _cmd_flash, parse_args, 1, 1, cons_flash_setting, { "/flash on|off", "Terminal flash on new messages.", { "/flash on|off", "-------------", @@ -543,7 +544,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/intype", - _cmd_intype, parse_args, 1, 1, + _cmd_intype, parse_args, 1, 1, cons_intype_setting, { "/intype on|off", "Show when contact is typing.", { "/intype on|off", "--------------", @@ -551,7 +552,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/splash", - _cmd_splash, parse_args, 1, 1, + _cmd_splash, parse_args, 1, 1, cons_splash_setting, { "/splash on|off", "Splash logo on startup and /about command.", { "/splash on|off", "--------------", @@ -559,7 +560,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/vercheck", - _cmd_vercheck, parse_args, 0, 1, + _cmd_vercheck, parse_args, 0, 1, NULL, { "/vercheck [on|off]", "Check for a new release.", { "/vercheck [on|off]", "------------------", @@ -568,7 +569,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/titlebar", - _cmd_titlebar, parse_args, 2, 2, + _cmd_titlebar, parse_args, 2, 2, cons_titlebar_setting, { "/titlebar property on|off", "Show various properties in the window title bar.", { "/titlebar property on|off", "-------------------------", @@ -577,7 +578,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/mouse", - _cmd_mouse, parse_args, 1, 1, + _cmd_mouse, parse_args, 1, 1, cons_mouse_setting, { "/mouse on|off", "Use profanity mouse handling.", { "/mouse on|off", "-------------", @@ -590,7 +591,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/chlog", - _cmd_chlog, parse_args, 1, 1, + _cmd_chlog, parse_args, 1, 1, cons_chlog_setting, { "/chlog on|off", "Chat logging to file", { "/chlog on|off", "-------------", @@ -601,7 +602,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/grlog", - _cmd_grlog, parse_args, 1, 1, + _cmd_grlog, parse_args, 1, 1, cons_grlog_setting, { "/grlog on|off", "Chat logging of chat rooms to file", { "/grlog on|off", "-------------", @@ -610,7 +611,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/states", - _cmd_states, parse_args, 1, 1, + _cmd_states, parse_args, 1, 1, cons_states_setting, { "/states on|off", "Send chat states during a chat session.", { "/states on|off", "--------------", @@ -619,7 +620,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/outtype", - _cmd_outtype, parse_args, 1, 1, + _cmd_outtype, parse_args, 1, 1, cons_outtype_setting, { "/outtype on|off", "Send typing notification to recipient.", { "/outtype on|off", "---------------", @@ -628,7 +629,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/gone", - _cmd_gone, parse_args, 1, 1, + _cmd_gone, parse_args, 1, 1, cons_gone_setting, { "/gone minutes", "Send 'gone' state to recipient after a period.", { "/gone minutes", "-------------", @@ -639,7 +640,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/history", - _cmd_history, parse_args, 1, 1, + _cmd_history, parse_args, 1, 1, cons_history_setting, { "/history on|off", "Chat history in message windows.", { "/history on|off", "---------------", @@ -648,7 +649,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/log", - _cmd_log, parse_args, 2, 2, + _cmd_log, parse_args, 2, 2, cons_log_setting, { "/log maxsize value", "Manage system logging settings.", { "/log maxsize value", "------------------", @@ -657,7 +658,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/reconnect", - _cmd_reconnect, parse_args, 1, 1, + _cmd_reconnect, parse_args, 1, 1, cons_reconnect_setting, { "/reconnect seconds", "Set reconnect interval.", { "/reconnect seconds", "------------------", @@ -666,7 +667,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/autoping", - _cmd_autoping, parse_args, 1, 1, + _cmd_autoping, parse_args, 1, 1, cons_autoping_setting, { "/autoping seconds", "Server ping interval.", { "/autoping seconds", "-----------------", @@ -675,7 +676,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/autoaway", - _cmd_autoaway, parse_args_with_freetext, 2, 2, + _cmd_autoaway, parse_args_with_freetext, 2, 2, cons_autoaway_setting, { "/autoaway setting value", "Set auto idle/away properties.", { "/autoaway setting value", "-----------------------", @@ -696,7 +697,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/priority", - _cmd_priority, parse_args, 1, 1, + _cmd_priority, parse_args, 1, 1, cons_priority_setting, { "/priority value", "Set priority for the current account.", { "/priority value", "---------------", @@ -706,7 +707,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/account", - _cmd_account, parse_args, 0, 4, + _cmd_account, parse_args, 0, 4, NULL, { "/account [command] [account] [property] [value]", "Manage accounts.", { "/account [command] [account] [property] [value]", "-----------------------------------------------", @@ -739,7 +740,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/prefs", - _cmd_prefs, parse_args, 0, 1, + _cmd_prefs, parse_args, 0, 1, NULL, { "/prefs [area]", "Show configuration.", { "/prefs [area]", "-------------", @@ -755,7 +756,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/theme", - _cmd_theme, parse_args, 1, 2, + _cmd_theme, parse_args, 1, 2, cons_theme_setting, { "/theme command [theme-name]", "Change colour theme.", { "/theme command [theme-name]", "---------------------------", @@ -771,7 +772,7 @@ static struct cmd_t command_defs[] = { "/statuses", - _cmd_statuses, parse_args, 1, 1, + _cmd_statuses, parse_args, 1, 1, cons_statuses_setting, { "/statuses on|off", "Set notifications for status messages.", { "/statuses on|off", "----------------", @@ -781,7 +782,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/away", - _cmd_away, parse_args_with_freetext, 0, 1, + _cmd_away, parse_args_with_freetext, 0, 1, NULL, { "/away [msg]", "Set status to away.", { "/away [msg]", "-----------", @@ -792,7 +793,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/chat", - _cmd_chat, parse_args_with_freetext, 0, 1, + _cmd_chat, parse_args_with_freetext, 0, 1, NULL, { "/chat [msg]", "Set status to chat (available for chat).", { "/chat [msg]", "-----------", @@ -803,7 +804,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/dnd", - _cmd_dnd, parse_args_with_freetext, 0, 1, + _cmd_dnd, parse_args_with_freetext, 0, 1, NULL, { "/dnd [msg]", "Set status to dnd (do not disturb).", { "/dnd [msg]", "----------", @@ -814,7 +815,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/online", - _cmd_online, parse_args_with_freetext, 0, 1, + _cmd_online, parse_args_with_freetext, 0, 1, NULL, { "/online [msg]", "Set status to online.", { "/online [msg]", "-------------", @@ -825,7 +826,7 @@ static struct cmd_t command_defs[] = NULL } } }, { "/xa", - _cmd_xa, parse_args_with_freetext, 0, 1, + _cmd_xa, parse_args_with_freetext, 0, 1, NULL, { "/xa [msg]", "Set status to xa (extended away).", { "/xa [msg]", "---------", @@ -1084,7 +1085,12 @@ cmd_execute(const char * const command, const char * const inp) if (cmd != NULL) { gchar **args = cmd->parser(inp, cmd->min_args, cmd->max_args); - if (args == NULL) { + if ((args == NULL) && (cmd->setting_func != NULL)) { + cons_show(""); + cmd->setting_func(); + return TRUE; + } else if (args == NULL) { + cons_show(""); cons_show("Usage: %s", cmd->help.usage); if (ui_current_win_type() == WIN_CHAT) { char usage[strlen(cmd->help.usage) + 8]; @@ -1801,6 +1807,7 @@ _cmd_prefs(gchar **args, struct cmd_help_t help) { if (args[0] == NULL) { cons_prefs(); + cons_show("Use the /account command for preferences for individual accounts."); } else if (strcmp(args[0], "ui") == 0) { cons_show(""); cons_show_ui_prefs(); diff --git a/src/ui/console.c b/src/ui/console.c index 84ef2488..67f3fa28 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -903,68 +903,101 @@ cons_show_account(ProfAccount *account) } void -cons_show_ui_prefs(void) +cons_theme_setting(void) { - cons_show("UI preferences:"); - cons_show(""); - gchar *theme = prefs_get_string(PREF_THEME); if (theme == NULL) { cons_show("Theme (/theme) : default"); } else { cons_show("Theme (/theme) : %s", theme); } +} +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"); +} - if (prefs_get_boolean(PREF_INTYPE)) - cons_show("Show typing (/intype) : ON"); - else - cons_show("Show typing (/intype) : 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"); +} - if (prefs_get_boolean(PREF_HISTORY)) - cons_show("Chat history (/history) : ON"); - else - cons_show("Chat history (/history) : 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_mouse_setting(void) +{ if (prefs_get_boolean(PREF_MOUSE)) cons_show("Mouse handling (/mouse) : ON"); else cons_show("Mouse handling (/mouse) : 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_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_ui_prefs(void) +{ + cons_show("UI preferences:"); + cons_show(""); + cons_theme_setting(); + cons_beep_setting(); + cons_flash_setting(); + cons_splash_setting(); + cons_vercheck_setting(); + cons_mouse_setting(); + cons_statuses_setting(); + cons_titlebar_setting(); ui_console_dirty(); cons_alert(); } void -cons_show_desktop_prefs(void) +cons_notify_setting(void) { - cons_show("Desktop notification preferences:"); - cons_show(""); - if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) cons_show("Messages (/notify message) : ON"); else @@ -987,33 +1020,55 @@ cons_show_desktop_prefs(void) gint remind_period = prefs_get_notify_remind(); if (remind_period == 0) { - cons_show("Reminder period (/notify remind) : OFF"); + cons_show("Reminder period (/notify remind) : OFF"); } else if (remind_period == 1) { - cons_show("Reminder period (/notify remind) : 1 second"); + cons_show("Reminder period (/notify remind) : 1 second"); } else { - cons_show("Reminder period (/notify remind) : %d seconds", remind_period); + cons_show("Reminder period (/notify remind) : %d seconds", remind_period); } +} + +void +cons_show_desktop_prefs(void) +{ + cons_show("Desktop notification preferences:"); + cons_show(""); + cons_notify_setting(); ui_console_dirty(); cons_alert(); } void -cons_show_chat_prefs(void) +cons_states_setting(void) { - cons_show("Chat preferences:"); - cons_show(""); - if (prefs_get_boolean(PREF_STATES)) cons_show("Send chat states (/states) : ON"); else cons_show("Send chat states (/states) : 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_intype_setting(void) +{ + if (prefs_get_boolean(PREF_INTYPE)) + cons_show("Show typing (/intype) : ON"); + else + cons_show("Show typing (/intype) : OFF"); +} + +void +cons_gone_setting(void) +{ gint gone_time = prefs_get_gone(); if (gone_time == 0) { cons_show("Leave conversation (/gone) : OFF"); @@ -1022,39 +1077,72 @@ cons_show_chat_prefs(void) } else { cons_show("Leave conversation (/gone) : %d minutes", gone_time); } +} + +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_show_chat_prefs(void) +{ + cons_show("Chat preferences:"); + cons_show(""); + cons_states_setting(); + cons_outtype_setting(); + cons_intype_setting(); + cons_gone_setting(); + cons_history_setting(); ui_console_dirty(); cons_alert(); } +void +cons_log_setting(void) +{ + cons_show("Max log size (/log maxsize) : %d bytes", prefs_get_max_log_size()); +} + +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 +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_show_log_prefs(void) { cons_show("Logging preferences:"); cons_show(""); - - cons_show("Max log size (/log maxsize) : %d bytes", prefs_get_max_log_size()); - - if (prefs_get_boolean(PREF_CHLOG)) - cons_show("Chat logging (/chlog) : ON"); - else - cons_show("Chat logging (/chlog) : OFF"); - - if (prefs_get_boolean(PREF_GRLOG)) - cons_show("Groupchat logging (/grlog) : ON"); - else - cons_show("Groupchat logging (/grlog) : OFF"); + cons_log_setting(); + cons_chlog_setting(); + cons_grlog_setting(); ui_console_dirty(); cons_alert(); } void -cons_show_presence_prefs(void) +cons_autoaway_setting(void) { - cons_show("Presence preferences:"); - cons_show(""); - if (strcmp(prefs_get_string(PREF_AUTOAWAY_MODE), "off") == 0) { cons_show("Autoaway (/autoaway mode) : OFF"); } else { @@ -1075,17 +1163,22 @@ cons_show_presence_prefs(void) } else { cons_show("Autoaway check (/autoaway check) : OFF"); } +} + +void +cons_show_presence_prefs(void) +{ + cons_show("Presence preferences:"); + cons_show(""); + cons_autoaway_setting(); ui_console_dirty(); cons_alert(); } void -cons_show_connection_prefs(void) +cons_reconnect_setting(void) { - cons_show("Connection preferences:"); - cons_show(""); - gint reconnect_interval = prefs_get_reconnect(); if (reconnect_interval == 0) { cons_show("Reconnect interval (/reconnect) : OFF"); @@ -1094,7 +1187,11 @@ cons_show_connection_prefs(void) } 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"); @@ -1103,6 +1200,22 @@ cons_show_connection_prefs(void) } else { cons_show("Autoping interval (/autoping) : %d seconds", autoping_interval); } +} + +void +cons_priority_setting(void) +{ + gint priority = prefs_get_priority(); + cons_show("Priority (/priority) : %d", priority); +} + +void +cons_show_connection_prefs(void) +{ + cons_show("Connection preferences:"); + cons_show(""); + cons_reconnect_setting(); + cons_autoping_setting(); ui_console_dirty(); cons_alert(); diff --git a/src/ui/ui.h b/src/ui/ui.h index 061f445b..d8ac22fa 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -195,6 +195,28 @@ void cons_show_room_invites(GSList *invites); void cons_show_received_subs(void); void cons_show_sent_subs(void); void cons_alert(void); +void cons_theme_setting(void); +void cons_beep_setting(void); +void cons_flash_setting(void); +void cons_splash_setting(void); +void cons_vercheck_setting(void); +void cons_mouse_setting(void); +void cons_statuses_setting(void); +void cons_titlebar_setting(void); +void cons_notify_setting(void); +void cons_show_desktop_prefs(void); +void cons_states_setting(void); +void cons_outtype_setting(void); +void cons_intype_setting(void); +void cons_gone_setting(void); +void cons_history_setting(void); +void cons_log_setting(void); +void cons_chlog_setting(void); +void cons_grlog_setting(void); +void cons_autoaway_setting(void); +void cons_reconnect_setting(void); +void cons_autoping_setting(void); +void cons_priority_setting(void); // status bar actions void status_bar_refresh(void);