1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-02-02 15:08:15 -05:00

Show current setting with settings commands

closes #139
This commit is contained in:
James Booth 2013-06-25 23:38:06 +01:00
parent 0554198668
commit ca5c6a5745
3 changed files with 243 additions and 101 deletions

View File

@ -61,6 +61,7 @@ typedef struct cmd_t {
gchar** (*parser)(const char * const inp, int min, int max); gchar** (*parser)(const char * const inp, int min, int max);
int min_args; int min_args;
int max_args; int max_args;
void (*setting_func)(void);
CommandHelp help; CommandHelp help;
} Command; } Command;
@ -150,7 +151,7 @@ static GHashTable *commands = NULL;
static struct cmd_t command_defs[] = static struct cmd_t command_defs[] =
{ {
{ "/help", { "/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]", "Get help on using Profanity",
{ "/help [area|command]", { "/help [area|command]",
"-------------------------", "-------------------------",
@ -166,7 +167,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/about", { "/about",
_cmd_about, parse_args, 0, 0, _cmd_about, parse_args, 0, 0, NULL,
{ "/about", "About Profanity", { "/about", "About Profanity",
{ "/about", { "/about",
"------", "------",
@ -174,7 +175,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/connect", { "/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]", "Login to a chat service.",
{ "/connect account [server]", { "/connect account [server]",
"-------------------------", "-------------------------",
@ -187,7 +188,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/disconnect", { "/disconnect",
_cmd_disconnect, parse_args, 0, 0, _cmd_disconnect, parse_args, 0, 0, NULL,
{ "/disconnect", "Logout of current session.", { "/disconnect", "Logout of current session.",
{ "/disconnect", { "/disconnect",
"-----------", "-----------",
@ -195,7 +196,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/msg", { "/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]", "Start chat with user.",
{ "/msg jid|nick [message]", { "/msg jid|nick [message]",
"-----------------------", "-----------------------",
@ -210,7 +211,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/roster", { "/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]", "Manage your roster.",
{ "/roster [add|remove|nick] [jid] [handle]", { "/roster [add|remove|nick] [jid] [handle]",
"----------------------------------------", "----------------------------------------",
@ -230,7 +231,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/group", { "/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]", "Manage roster groups.",
{ "/group show|add|remove [group] [contact]", { "/group show|add|remove [group] [contact]",
"-------------------------------------", "-------------------------------------",
@ -248,7 +249,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/info", { "/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]", "Show basic information about a contact, or room member.",
{ "/info [jid|nick]", { "/info [jid|nick]",
"----------------", "----------------",
@ -260,7 +261,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/caps", { "/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]", "Find out a contacts client software capabilities.",
{ "/caps [fulljid|nick]", { "/caps [fulljid|nick]",
"--------------------", "--------------------",
@ -275,7 +276,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/software", { "/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]", "Find out software version information about a contacts resource.",
{ "/software [fulljid|nick]", { "/software [fulljid|nick]",
"------------------------", "------------------------",
@ -291,7 +292,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/status", { "/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]", "Find out your contacts presence information.",
{ "/status [jid|nick]", { "/status [jid|nick]",
"------------------", "------------------",
@ -303,7 +304,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/join", { "/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]", "Join a chat room.",
{ "/join room[@server] [nick]", { "/join room[@server] [nick]",
"--------------------------", "--------------------------",
@ -319,7 +320,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/leave", { "/leave",
_cmd_leave, parse_args, 0, 0, _cmd_leave, parse_args, 0, 0, NULL,
{ "/leave", "Leave a chat room.", { "/leave", "Leave a chat room.",
{ "/leave", { "/leave",
"------", "------",
@ -327,7 +328,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/invite", { "/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]", "Invite contact to chat room.",
{ "/invite jid [message]", { "/invite jid [message]",
"--------------------------", "--------------------------",
@ -337,7 +338,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/invites", { "/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", "Show outstanding chat room invites.",
{ "/invites", { "/invites",
"--------", "--------",
@ -347,7 +348,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/decline", { "/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", "Decline a chat room invite.",
{ "/decline room", { "/decline room",
"-------------", "-------------",
@ -355,7 +356,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/rooms", { "/rooms",
_cmd_rooms, parse_args, 0, 1, _cmd_rooms, parse_args, 0, 1, NULL,
{ "/rooms [conference-service]", "List chat rooms.", { "/rooms [conference-service]", "List chat rooms.",
{ "/rooms [conference-service]", { "/rooms [conference-service]",
"---------------------------", "---------------------------",
@ -368,7 +369,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/disco", { "/disco",
_cmd_disco, parse_args, 1, 2, _cmd_disco, parse_args, 1, 2, NULL,
{ "/disco command entity", "Service discovery.", { "/disco command entity", "Service discovery.",
{ "/disco command entity", { "/disco command entity",
"---------------------", "---------------------",
@ -386,7 +387,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/nick", { "/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", "Change nickname in chat room.",
{ "/nick nickname", { "/nick nickname",
"--------------", "--------------",
@ -398,7 +399,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/wins", { "/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]", "List or tidy active windows.",
{ "/wins [tidy|prune]", { "/wins [tidy|prune]",
"------------------", "------------------",
@ -408,7 +409,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/sub", { "/sub",
_cmd_sub, parse_args, 1, 2, _cmd_sub, parse_args, 1, 2, NULL,
{ "/sub command [jid]", "Manage subscriptions.", { "/sub command [jid]", "Manage subscriptions.",
{ "/sub command [jid]", { "/sub command [jid]",
"------------------", "------------------",
@ -431,7 +432,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/tiny", { "/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", "Send url as tinyurl in current chat.",
{ "/tiny url", { "/tiny url",
"---------", "---------",
@ -441,7 +442,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/duck", { "/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", "Perform search using DuckDuckGo chatbot.",
{ "/duck query", { "/duck query",
"-----------", "-----------",
@ -452,7 +453,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/who", { "/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]", "Show contacts/room participants with chosen status.",
{ "/who [status] [group]", { "/who [status] [group]",
"---------------------", "---------------------",
@ -468,7 +469,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/close", { "/close",
_cmd_close, parse_args, 0, 1, _cmd_close, parse_args, 0, 1, NULL,
{ "/close [win|read|all]", "Close windows.", { "/close [win|read|all]", "Close windows.",
{ "/close [win|read|all]", { "/close [win|read|all]",
"---------------------", "---------------------",
@ -481,7 +482,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/clear", { "/clear",
_cmd_clear, parse_args, 0, 0, _cmd_clear, parse_args, 0, 0, NULL,
{ "/clear", "Clear current window.", { "/clear", "Clear current window.",
{ "/clear", { "/clear",
"------", "------",
@ -489,7 +490,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/quit", { "/quit",
_cmd_quit, parse_args, 0, 0, _cmd_quit, parse_args, 0, 0, NULL,
{ "/quit", "Quit Profanity.", { "/quit", "Quit Profanity.",
{ "/quit", { "/quit",
"-----", "-----",
@ -497,7 +498,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/beep", { "/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", "Terminal beep on new messages.",
{ "/beep on|off", { "/beep on|off",
"------------", "------------",
@ -507,7 +508,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/notify", { "/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", "Control various desktop noficiations.",
{ "/notify type value", { "/notify type value",
"------------------", "------------------",
@ -533,7 +534,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/flash", { "/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", "Terminal flash on new messages.",
{ "/flash on|off", { "/flash on|off",
"-------------", "-------------",
@ -543,7 +544,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/intype", { "/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", "Show when contact is typing.",
{ "/intype on|off", { "/intype on|off",
"--------------", "--------------",
@ -551,7 +552,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/splash", { "/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", "Splash logo on startup and /about command.",
{ "/splash on|off", { "/splash on|off",
"--------------", "--------------",
@ -559,7 +560,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/vercheck", { "/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]", "Check for a new release.",
{ "/vercheck [on|off]", { "/vercheck [on|off]",
"------------------", "------------------",
@ -568,7 +569,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/titlebar", { "/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", "Show various properties in the window title bar.",
{ "/titlebar property on|off", { "/titlebar property on|off",
"-------------------------", "-------------------------",
@ -577,7 +578,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/mouse", { "/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", "Use profanity mouse handling.",
{ "/mouse on|off", { "/mouse on|off",
"-------------", "-------------",
@ -590,7 +591,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/chlog", { "/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", "Chat logging to file",
{ "/chlog on|off", { "/chlog on|off",
"-------------", "-------------",
@ -601,7 +602,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/grlog", { "/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", "Chat logging of chat rooms to file",
{ "/grlog on|off", { "/grlog on|off",
"-------------", "-------------",
@ -610,7 +611,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/states", { "/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", "Send chat states during a chat session.",
{ "/states on|off", { "/states on|off",
"--------------", "--------------",
@ -619,7 +620,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/outtype", { "/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", "Send typing notification to recipient.",
{ "/outtype on|off", { "/outtype on|off",
"---------------", "---------------",
@ -628,7 +629,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/gone", { "/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", "Send 'gone' state to recipient after a period.",
{ "/gone minutes", { "/gone minutes",
"-------------", "-------------",
@ -639,7 +640,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/history", { "/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", "Chat history in message windows.",
{ "/history on|off", { "/history on|off",
"---------------", "---------------",
@ -648,7 +649,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/log", { "/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", "Manage system logging settings.",
{ "/log maxsize value", { "/log maxsize value",
"------------------", "------------------",
@ -657,7 +658,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/reconnect", { "/reconnect",
_cmd_reconnect, parse_args, 1, 1, _cmd_reconnect, parse_args, 1, 1, cons_reconnect_setting,
{ "/reconnect seconds", "Set reconnect interval.", { "/reconnect seconds", "Set reconnect interval.",
{ "/reconnect seconds", { "/reconnect seconds",
"------------------", "------------------",
@ -666,7 +667,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/autoping", { "/autoping",
_cmd_autoping, parse_args, 1, 1, _cmd_autoping, parse_args, 1, 1, cons_autoping_setting,
{ "/autoping seconds", "Server ping interval.", { "/autoping seconds", "Server ping interval.",
{ "/autoping seconds", { "/autoping seconds",
"-----------------", "-----------------",
@ -675,7 +676,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/autoaway", { "/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", "Set auto idle/away properties.",
{ "/autoaway setting value", { "/autoaway setting value",
"-----------------------", "-----------------------",
@ -696,7 +697,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/priority", { "/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", "Set priority for the current account.",
{ "/priority value", { "/priority value",
"---------------", "---------------",
@ -706,7 +707,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/account", { "/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]", "Manage accounts.",
{ "/account [command] [account] [property] [value]", { "/account [command] [account] [property] [value]",
"-----------------------------------------------", "-----------------------------------------------",
@ -739,7 +740,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/prefs", { "/prefs",
_cmd_prefs, parse_args, 0, 1, _cmd_prefs, parse_args, 0, 1, NULL,
{ "/prefs [area]", "Show configuration.", { "/prefs [area]", "Show configuration.",
{ "/prefs [area]", { "/prefs [area]",
"-------------", "-------------",
@ -755,7 +756,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/theme", { "/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]", "Change colour theme.",
{ "/theme command [theme-name]", { "/theme command [theme-name]",
"---------------------------", "---------------------------",
@ -771,7 +772,7 @@ static struct cmd_t command_defs[] =
{ "/statuses", { "/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", "Set notifications for status messages.",
{ "/statuses on|off", { "/statuses on|off",
"----------------", "----------------",
@ -781,7 +782,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/away", { "/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]", "Set status to away.",
{ "/away [msg]", { "/away [msg]",
"-----------", "-----------",
@ -792,7 +793,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/chat", { "/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]", "Set status to chat (available for chat).",
{ "/chat [msg]", { "/chat [msg]",
"-----------", "-----------",
@ -803,7 +804,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/dnd", { "/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]", "Set status to dnd (do not disturb).",
{ "/dnd [msg]", { "/dnd [msg]",
"----------", "----------",
@ -814,7 +815,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/online", { "/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]", "Set status to online.",
{ "/online [msg]", { "/online [msg]",
"-------------", "-------------",
@ -825,7 +826,7 @@ static struct cmd_t command_defs[] =
NULL } } }, NULL } } },
{ "/xa", { "/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]", "Set status to xa (extended away).",
{ "/xa [msg]", { "/xa [msg]",
"---------", "---------",
@ -1084,7 +1085,12 @@ cmd_execute(const char * const command, const char * const inp)
if (cmd != NULL) { if (cmd != NULL) {
gchar **args = cmd->parser(inp, cmd->min_args, cmd->max_args); 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); cons_show("Usage: %s", cmd->help.usage);
if (ui_current_win_type() == WIN_CHAT) { if (ui_current_win_type() == WIN_CHAT) {
char usage[strlen(cmd->help.usage) + 8]; char usage[strlen(cmd->help.usage) + 8];
@ -1801,6 +1807,7 @@ _cmd_prefs(gchar **args, struct cmd_help_t help)
{ {
if (args[0] == NULL) { if (args[0] == NULL) {
cons_prefs(); cons_prefs();
cons_show("Use the /account command for preferences for individual accounts.");
} else if (strcmp(args[0], "ui") == 0) { } else if (strcmp(args[0], "ui") == 0) {
cons_show(""); cons_show("");
cons_show_ui_prefs(); cons_show_ui_prefs();

View File

@ -903,68 +903,101 @@ cons_show_account(ProfAccount *account)
} }
void void
cons_show_ui_prefs(void) cons_theme_setting(void)
{ {
cons_show("UI preferences:");
cons_show("");
gchar *theme = prefs_get_string(PREF_THEME); gchar *theme = prefs_get_string(PREF_THEME);
if (theme == NULL) { if (theme == NULL) {
cons_show("Theme (/theme) : default"); cons_show("Theme (/theme) : default");
} else { } else {
cons_show("Theme (/theme) : %s", theme); cons_show("Theme (/theme) : %s", theme);
} }
}
void
cons_beep_setting(void)
{
if (prefs_get_boolean(PREF_BEEP)) if (prefs_get_boolean(PREF_BEEP))
cons_show("Terminal beep (/beep) : ON"); cons_show("Terminal beep (/beep) : ON");
else else
cons_show("Terminal beep (/beep) : OFF"); cons_show("Terminal beep (/beep) : OFF");
}
void
cons_flash_setting(void)
{
if (prefs_get_boolean(PREF_FLASH)) if (prefs_get_boolean(PREF_FLASH))
cons_show("Terminal flash (/flash) : ON"); cons_show("Terminal flash (/flash) : ON");
else else
cons_show("Terminal flash (/flash) : OFF"); cons_show("Terminal flash (/flash) : OFF");
}
if (prefs_get_boolean(PREF_INTYPE)) void
cons_show("Show typing (/intype) : ON"); cons_splash_setting(void)
else {
cons_show("Show typing (/intype) : OFF");
if (prefs_get_boolean(PREF_SPLASH)) if (prefs_get_boolean(PREF_SPLASH))
cons_show("Splash screen (/splash) : ON"); cons_show("Splash screen (/splash) : ON");
else else
cons_show("Splash screen (/splash) : OFF"); cons_show("Splash screen (/splash) : OFF");
}
if (prefs_get_boolean(PREF_HISTORY)) void
cons_show("Chat history (/history) : ON"); cons_vercheck_setting(void)
else {
cons_show("Chat history (/history) : OFF");
if (prefs_get_boolean(PREF_VERCHECK)) if (prefs_get_boolean(PREF_VERCHECK))
cons_show("Version checking (/vercheck) : ON"); cons_show("Version checking (/vercheck) : ON");
else else
cons_show("Version checking (/vercheck) : OFF"); cons_show("Version checking (/vercheck) : OFF");
}
void
cons_mouse_setting(void)
{
if (prefs_get_boolean(PREF_MOUSE)) if (prefs_get_boolean(PREF_MOUSE))
cons_show("Mouse handling (/mouse) : ON"); cons_show("Mouse handling (/mouse) : ON");
else else
cons_show("Mouse handling (/mouse) : OFF"); cons_show("Mouse handling (/mouse) : OFF");
}
void
cons_statuses_setting(void)
{
if (prefs_get_boolean(PREF_STATUSES)) if (prefs_get_boolean(PREF_STATUSES))
cons_show("Status (/statuses) : ON"); cons_show("Status (/statuses) : ON");
else else
cons_show("Status (/statuses) : OFF"); 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(); ui_console_dirty();
cons_alert(); cons_alert();
} }
void void
cons_show_desktop_prefs(void) cons_notify_setting(void)
{ {
cons_show("Desktop notification preferences:");
cons_show("");
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) if (prefs_get_boolean(PREF_NOTIFY_MESSAGE))
cons_show("Messages (/notify message) : ON"); cons_show("Messages (/notify message) : ON");
else else
@ -987,33 +1020,55 @@ cons_show_desktop_prefs(void)
gint remind_period = prefs_get_notify_remind(); gint remind_period = prefs_get_notify_remind();
if (remind_period == 0) { if (remind_period == 0) {
cons_show("Reminder period (/notify remind) : OFF"); cons_show("Reminder period (/notify remind) : OFF");
} else if (remind_period == 1) { } else if (remind_period == 1) {
cons_show("Reminder period (/notify remind) : 1 second"); cons_show("Reminder period (/notify remind) : 1 second");
} else { } 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(); ui_console_dirty();
cons_alert(); cons_alert();
} }
void void
cons_show_chat_prefs(void) cons_states_setting(void)
{ {
cons_show("Chat preferences:");
cons_show("");
if (prefs_get_boolean(PREF_STATES)) if (prefs_get_boolean(PREF_STATES))
cons_show("Send chat states (/states) : ON"); cons_show("Send chat states (/states) : ON");
else else
cons_show("Send chat states (/states) : OFF"); cons_show("Send chat states (/states) : OFF");
}
void
cons_outtype_setting(void)
{
if (prefs_get_boolean(PREF_OUTTYPE)) if (prefs_get_boolean(PREF_OUTTYPE))
cons_show("Send composing (/outtype) : ON"); cons_show("Send composing (/outtype) : ON");
else else
cons_show("Send composing (/outtype) : OFF"); 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(); gint gone_time = prefs_get_gone();
if (gone_time == 0) { if (gone_time == 0) {
cons_show("Leave conversation (/gone) : OFF"); cons_show("Leave conversation (/gone) : OFF");
@ -1022,39 +1077,72 @@ cons_show_chat_prefs(void)
} else { } else {
cons_show("Leave conversation (/gone) : %d minutes", gone_time); 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(); ui_console_dirty();
cons_alert(); 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 void
cons_show_log_prefs(void) cons_show_log_prefs(void)
{ {
cons_show("Logging preferences:"); cons_show("Logging preferences:");
cons_show(""); cons_show("");
cons_log_setting();
cons_show("Max log size (/log maxsize) : %d bytes", prefs_get_max_log_size()); cons_chlog_setting();
cons_grlog_setting();
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");
ui_console_dirty(); ui_console_dirty();
cons_alert(); cons_alert();
} }
void 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) { if (strcmp(prefs_get_string(PREF_AUTOAWAY_MODE), "off") == 0) {
cons_show("Autoaway (/autoaway mode) : OFF"); cons_show("Autoaway (/autoaway mode) : OFF");
} else { } else {
@ -1075,17 +1163,22 @@ cons_show_presence_prefs(void)
} else { } else {
cons_show("Autoaway check (/autoaway check) : OFF"); 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(); ui_console_dirty();
cons_alert(); cons_alert();
} }
void void
cons_show_connection_prefs(void) cons_reconnect_setting(void)
{ {
cons_show("Connection preferences:");
cons_show("");
gint reconnect_interval = prefs_get_reconnect(); gint reconnect_interval = prefs_get_reconnect();
if (reconnect_interval == 0) { if (reconnect_interval == 0) {
cons_show("Reconnect interval (/reconnect) : OFF"); cons_show("Reconnect interval (/reconnect) : OFF");
@ -1094,7 +1187,11 @@ cons_show_connection_prefs(void)
} else { } else {
cons_show("Reconnect interval (/reconnect) : %d seconds", reconnect_interval); cons_show("Reconnect interval (/reconnect) : %d seconds", reconnect_interval);
} }
}
void
cons_autoping_setting(void)
{
gint autoping_interval = prefs_get_autoping(); gint autoping_interval = prefs_get_autoping();
if (autoping_interval == 0) { if (autoping_interval == 0) {
cons_show("Autoping interval (/autoping) : OFF"); cons_show("Autoping interval (/autoping) : OFF");
@ -1103,6 +1200,22 @@ cons_show_connection_prefs(void)
} else { } else {
cons_show("Autoping interval (/autoping) : %d seconds", autoping_interval); 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(); ui_console_dirty();
cons_alert(); cons_alert();

View File

@ -195,6 +195,28 @@ void cons_show_room_invites(GSList *invites);
void cons_show_received_subs(void); void cons_show_received_subs(void);
void cons_show_sent_subs(void); void cons_show_sent_subs(void);
void cons_alert(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 // status bar actions
void status_bar_refresh(void); void status_bar_refresh(void);