Add new command /statuses for status notifications

This commit is contained in:
Backalor
2013-01-21 10:26:09 +09:00
parent ba0438607c
commit a0a1f9017f
4 changed files with 29 additions and 28 deletions

View File

@@ -385,14 +385,11 @@ static struct cmd_t setting_commands[] =
" : use 0 to disable.",
"typing : Notifications when contacts are typing.",
" : on|off",
"status : Notifcations for status messages.",
" : on|off",
"",
"Example : /notify message on (enable message notifications)",
"Example : /notify remind 10 (remind every 10 seconds)",
"Example : /notify remind 0 (switch off reminders)",
"Example : /notify typing on (enable typing notifications)",
"Example : /notify status off (disable status notifications)",
NULL } } },
{ "/flash",
@@ -540,6 +537,15 @@ static struct cmd_t setting_commands[] =
"---------------",
"Set priority for the current session.",
"value : Number between -128 and 127. Default value is 0.",
NULL } } },
{ "/statuses",
_cmd_set_statuses, parse_args, 1, 1,
{ "/statuses on|off", "Set notifications for status messages.",
{ "/statuses on|off",
"---------------",
"Set notifications for status messages, such as online/offline or join/part channels.",
"When notifications are off status messages, such as online/offline or join/part, are not displayed.",
NULL } } }
};
@@ -1782,7 +1788,7 @@ _cmd_set_notify(gchar **args, struct cmd_help_t help)
// bad kind
if ((strcmp(kind, "message") != 0) && (strcmp(kind, "typing") != 0) &&
(strcmp(kind, "remind") != 0) && (strcmp(kind, "status") != 0)) {
(strcmp(kind, "remind") != 0)) {
cons_show("Usage: %s", help.usage);
// set message setting
@@ -1821,18 +1827,6 @@ _cmd_set_notify(gchar **args, struct cmd_help_t help)
cons_show("Message reminder period set to %d seconds.", period);
}
// set status setting
} else if (strcmp(kind, "status") == 0) {
if (strcmp(value, "on") == 0) {
cons_show("Status notifications enabled.");
prefs_set_notify_status(TRUE);
} else if (strcmp(value, "off") == 0) {
cons_show("Status notifications disabled.");
prefs_set_notify_status(FALSE);
} else {
cons_show("Usage: /notify status on|off");
}
} else {
cons_show("Unknown command: %s.", kind);
}
@@ -1975,6 +1969,13 @@ _cmd_set_priority(gchar **args, struct cmd_help_t help)
return TRUE;
}
static gboolean
_cmd_set_statuses(gchar **args, struct cmd_help_t help)
{
return _cmd_set_boolean_preference(args[0], help,
"Status notifications", prefs_set_statuses);
}
static gboolean
_cmd_vercheck(gchar **args, struct cmd_help_t help)
{