diff options
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/command.c | 22 | ||||
-rw-r--r-- | src/command/commands.c | 20 |
2 files changed, 36 insertions, 6 deletions
diff --git a/src/command/command.c b/src/command/command.c index ee5635a6..9fb8a820 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -486,6 +486,8 @@ static struct cmd_t command_defs[] = " : use 0 to disable.", "typing : Notifications when contacts are typing.", " : on|off", + "typing current : Whether typing notifications are triggerd for the current window.", + " : on|off", "invite : Notifications for chat room invites.", " : on|off", "sub : Notifications for subscription requests.", @@ -884,6 +886,7 @@ static Autocomplete help_ac; static Autocomplete notify_ac; static Autocomplete notify_room_ac; static Autocomplete notify_message_ac; +static Autocomplete notify_typing_ac; static Autocomplete prefs_ac; static Autocomplete sub_ac; static Autocomplete log_ac; @@ -991,6 +994,11 @@ cmd_init(void) autocomplete_add(notify_room_ac, "mention"); autocomplete_add(notify_room_ac, "current"); + notify_typing_ac = autocomplete_new(); + autocomplete_add(notify_typing_ac, "on"); + autocomplete_add(notify_typing_ac, "off"); + autocomplete_add(notify_typing_ac, "current"); + sub_ac = autocomplete_new(); autocomplete_add(sub_ac, "request"); autocomplete_add(sub_ac, "allow"); @@ -1167,6 +1175,7 @@ cmd_uninit(void) autocomplete_free(notify_ac); autocomplete_free(notify_message_ac); autocomplete_free(notify_room_ac); + autocomplete_free(notify_typing_ac); autocomplete_free(sub_ac); autocomplete_free(titlebar_ac); autocomplete_free(log_ac); @@ -1281,6 +1290,7 @@ cmd_reset_autocomplete() autocomplete_reset(notify_ac); autocomplete_reset(notify_message_ac); autocomplete_reset(notify_room_ac); + autocomplete_reset(notify_typing_ac); autocomplete_reset(sub_ac); if (ui_current_win_type() == WIN_MUC) { @@ -1806,6 +1816,11 @@ _notify_autocomplete(char *input, int *size) return result; } + result = autocomplete_param_with_func(input, size, "/notify typing current", prefs_autocomplete_boolean_choice); + if (result != NULL) { + return result; + } + result = autocomplete_param_with_ac(input, size, "/notify room", notify_room_ac); if (result != NULL) { return result; @@ -1816,7 +1831,12 @@ _notify_autocomplete(char *input, int *size) return result; } - gchar *boolean_choices[] = { "/notify typing", "/notify invite", "/notify sub" }; + result = autocomplete_param_with_ac(input, size, "/notify typing", notify_typing_ac); + if (result != NULL) { + return result; + } + + gchar *boolean_choices[] = { "/notify invite", "/notify sub" }; for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) { result = autocomplete_param_with_func(input, size, boolean_choices[i], prefs_autocomplete_boolean_choice); diff --git a/src/command/commands.c b/src/command/commands.c index e81c4e66..c64b3883 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -2212,10 +2212,10 @@ cmd_notify(gchar **args, struct cmd_help_t help) prefs_set_boolean(PREF_NOTIFY_MESSAGE, FALSE); } else if (strcmp(args[1], "current") == 0) { if (g_strcmp0(args[2], "on") == 0) { - cons_show("Current window messages notifications enabled."); + cons_show("Current window message notifications enabled."); prefs_set_boolean(PREF_NOTIFY_MESSAGE_CURRENT, TRUE); } else if (g_strcmp0(args[2], "off") == 0) { - cons_show("Current window messages notifications disabled."); + cons_show("Current window message notifications disabled."); prefs_set_boolean(PREF_NOTIFY_MESSAGE_CURRENT, FALSE); } else { cons_show("Usage: /notify message current on|off"); @@ -2233,14 +2233,14 @@ cmd_notify(gchar **args, struct cmd_help_t help) cons_show("Chat room notifications disabled."); prefs_set_string(PREF_NOTIFY_ROOM, "off"); } else if (strcmp(args[1], "mention") == 0) { - cons_show("Chat room notifications enable on mention."); + cons_show("Chat room notifications enabled on mention."); prefs_set_string(PREF_NOTIFY_ROOM, "mention"); } else if (strcmp(args[1], "current") == 0) { if (g_strcmp0(args[2], "on") == 0) { - cons_show("Current window chat room messages notifications enabled."); + cons_show("Current window chat room message notifications enabled."); prefs_set_boolean(PREF_NOTIFY_ROOM_CURRENT, TRUE); } else if (g_strcmp0(args[2], "off") == 0) { - cons_show("Current window chat room messages notifications disabled."); + cons_show("Current window chat room message notifications disabled."); prefs_set_boolean(PREF_NOTIFY_ROOM_CURRENT, FALSE); } else { cons_show("Usage: /notify room current on|off"); @@ -2257,6 +2257,16 @@ cmd_notify(gchar **args, struct cmd_help_t help) } else if (strcmp(args[1], "off") == 0) { cons_show("Typing notifications disabled."); prefs_set_boolean(PREF_NOTIFY_TYPING, FALSE); + } else if (strcmp(args[1], "current") == 0) { + if (g_strcmp0(args[2], "on") == 0) { + cons_show("Current window typing notifications enabled."); + prefs_set_boolean(PREF_NOTIFY_TYPING_CURRENT, TRUE); + } else if (g_strcmp0(args[2], "off") == 0) { + cons_show("Current window typing notifications disabled."); + prefs_set_boolean(PREF_NOTIFY_TYPING_CURRENT, FALSE); + } else { + cons_show("Usage: /notify typing current on|off"); + } } else { cons_show("Usage: /notify typing on|off"); } |