Finished basic /notify triggers

This commit is contained in:
James Booth
2015-11-25 21:24:21 +00:00
parent b9794361f7
commit 20e63e364b
5 changed files with 134 additions and 72 deletions

View File

@@ -1067,7 +1067,8 @@ static struct cmd_t command_defs[] =
"/notify message trigger remove <text>",
"/notify message trigger list",
"/notify message trigger on|off",
"/notify room on|off|mention",
"/notify room on|off",
"/notify room mention on|off",
"/notify room current on|off",
"/notify room text on|off",
"/notify room trigger add <text>",
@@ -1089,7 +1090,8 @@ static struct cmd_t command_defs[] =
{ "message trigger remove <text>", "Remove regular chat notification for specified text." },
{ "message trigger list", "List all regular chat custom text notifications." },
{ "message trigger on|off", "Enable or disable all regular chat custom text notifications." },
{ "room on|off|mention", "Notifications for chat room messages, mention triggers notifications only when your nick is mentioned." },
{ "room on|off", "Notifications for chat room messages, mention triggers notifications only when your nick is mentioned." },
{ "room mention on|off", "Notifications for chat room messages when your nick is mentioned." },
{ "room current on|off", "Whether chat room messages in the current window trigger notifications." },
{ "room text on|off", "Show message text in chat room message notifications." },
{ "room trigger add <text>", "Notify when specified text included in regular chat message." },
@@ -1104,7 +1106,7 @@ static struct cmd_t command_defs[] =
CMD_EXAMPLES(
"/notify message on",
"/notify message text on",
"/notify room mention",
"/notify room mention on",
"/notify room current off",
"/notify room text off",
"/notify remind 10",
@@ -3206,6 +3208,11 @@ _notify_autocomplete(ProfWin *window, const char *const input)
return result;
}
result = autocomplete_param_with_func(input, "/notify room mention", prefs_autocomplete_boolean_choice);
if (result) {
return result;
}
result = autocomplete_param_with_func(input, "/notify message text", prefs_autocomplete_boolean_choice);
if (result) {
return result;

View File

@@ -4354,14 +4354,21 @@ cmd_notify(ProfWin *window, const char *const command, gchar **args)
// set room setting
} else if (strcmp(kind, "room") == 0) {
if (strcmp(args[1], "on") == 0) {
cons_show("Chat room notifications enabled.");
prefs_set_string(PREF_NOTIFY_ROOM, "on");
cons_show("Room notifications enabled.");
prefs_set_boolean(PREF_NOTIFY_ROOM, TRUE);
} else if (strcmp(args[1], "off") == 0) {
cons_show("Chat room notifications disabled.");
prefs_set_string(PREF_NOTIFY_ROOM, "off");
cons_show("Room notifications disabled.");
prefs_set_boolean(PREF_NOTIFY_ROOM, FALSE);
} else if (strcmp(args[1], "mention") == 0) {
cons_show("Chat room notifications enabled on mention.");
prefs_set_string(PREF_NOTIFY_ROOM, "mention");
if (strcmp(args[2], "on") == 0) {
cons_show("Room notifications with mention enabled.");
prefs_set_boolean(PREF_NOTIFY_ROOM_MENTION, TRUE);
} else if (strcmp(args[2], "off") == 0) {
cons_show("Room notifications with mention disabled.");
prefs_set_boolean(PREF_NOTIFY_ROOM_MENTION, FALSE);
} else {
cons_show("Usage: /notify room mention on|off");
}
} else if (strcmp(args[1], "current") == 0) {
if (g_strcmp0(args[2], "on") == 0) {
cons_show("Current window chat room message notifications enabled.");