aboutsummaryrefslogtreecommitdiffstats
path: root/src/command
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2022-04-28 18:32:26 +0200
committerGitHub <noreply@github.com>2022-04-28 18:32:26 +0200
commit066df7f741848a2c594a5cbb05cef5af9075d5a1 (patch)
treed2bdb4260285e874ac338f8271794a07b49712b3 /src/command
parent69663b83c8dd5b494e0dc6554507ab53ef0c18b9 (diff)
parent8044c82614ad63b60cc0805b0335150eaccb50aa (diff)
downloadprofani-tty-066df7f741848a2c594a5cbb05cef5af9075d5a1.tar.gz
Merge pull request #1697 from cockroach/feature/offline-muc-notifications
Add support for offline MUC notifications
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_ac.c11
-rw-r--r--src/command/cmd_defs.c3
-rw-r--r--src/command/cmd_funcs.c10
3 files changed, 24 insertions, 0 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index 6c8ddf50..83721f02 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -146,6 +146,7 @@ static Autocomplete notify_chat_ac;
static Autocomplete notify_room_ac;
static Autocomplete notify_typing_ac;
static Autocomplete notify_mention_ac;
+static Autocomplete notify_offline_ac;
static Autocomplete notify_trigger_ac;
static Autocomplete prefs_ac;
static Autocomplete sub_ac;
@@ -344,6 +345,7 @@ cmd_ac_init(void)
autocomplete_add(notify_room_ac, "on");
autocomplete_add(notify_room_ac, "off");
autocomplete_add(notify_room_ac, "mention");
+ autocomplete_add(notify_room_ac, "offline");
autocomplete_add(notify_room_ac, "current");
autocomplete_add(notify_room_ac, "text");
autocomplete_add(notify_room_ac, "trigger");
@@ -361,6 +363,10 @@ cmd_ac_init(void)
autocomplete_add(notify_mention_ac, "word_whole");
autocomplete_add(notify_mention_ac, "word_part");
+ notify_offline_ac = autocomplete_new();
+ autocomplete_add(notify_offline_ac, "on");
+ autocomplete_add(notify_offline_ac, "off");
+
notify_trigger_ac = autocomplete_new();
autocomplete_add(notify_trigger_ac, "add");
autocomplete_add(notify_trigger_ac, "remove");
@@ -2341,6 +2347,11 @@ _notify_autocomplete(ProfWin* window, const char* const input, gboolean previous
return result;
}
+ result = autocomplete_param_with_ac(input, "/notify room offline", notify_offline_ac, TRUE, previous);
+ if (result) {
+ return result;
+ }
+
result = autocomplete_param_with_ac(input, "/notify room trigger", notify_trigger_ac, TRUE, previous);
if (result) {
return result;
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index 281d21c6..e18b3bff 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -1436,6 +1436,7 @@ static struct cmd_t command_defs[] = {
"/notify room mention on|off",
"/notify room mention case_sensitive|case_insensitive",
"/notify room mention word_whole|word_part",
+ "/notify room offline on|off",
"/notify room current on|off",
"/notify room text on|off",
"/notify room trigger add <text>",
@@ -1464,6 +1465,7 @@ static struct cmd_t command_defs[] = {
{ "room mention case_insensitive", "Set room mention notifications as case insensitive." },
{ "room mention word_whole", "Set room mention notifications only on whole word match, i.e. when nickname is not part of a larger word." },
{ "room mention word_part", "Set room mention notifications on partial word match, i.e. nickname may be part of a larger word." },
+ { "room offline on|off", "Notifications for chat room messages that were sent while you were offline." },
{ "room current on|off", "Whether to show all chat room messages notifications when the window is focused." },
{ "room text on|off", "Show message text in chat room message notifications." },
{ "room trigger add <text>", "Notify when specified text included in all chat room messages." },
@@ -1483,6 +1485,7 @@ static struct cmd_t command_defs[] = {
"/notify chat on",
"/notify chat text on",
"/notify room mention on",
+ "/notify room offline on",
"/notify room trigger add beer",
"/notify room trigger on",
"/notify room current off",
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index a74f37eb..ebba224e 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -5775,6 +5775,16 @@ cmd_notify(ProfWin* window, const char* const command, gchar** args)
} else {
cons_show("Usage: /notify room mention on|off");
}
+ } else if (g_strcmp0(args[1], "offline") == 0) {
+ if (g_strcmp0(args[2], "on") == 0) {
+ cons_show("Room notifications for offline messages enabled.");
+ prefs_set_boolean(PREF_NOTIFY_ROOM_OFFLINE, TRUE);
+ } else if (g_strcmp0(args[2], "off") == 0) {
+ cons_show("Room notifications for offline messages disabled.");
+ prefs_set_boolean(PREF_NOTIFY_ROOM_OFFLINE, FALSE);
+ } else {
+ cons_show("Usage: /notify room offline on|off");
+ }
} else if (g_strcmp0(args[1], "current") == 0) {
if (g_strcmp0(args[2], "on") == 0) {
cons_show("Current window chat room message notifications enabled.");