about summary refs log tree commit diff stats
path: root/src/command/command.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-04-22 23:48:23 +0100
committerJames Booth <boothj5@gmail.com>2013-04-22 23:48:23 +0100
commitf099bf9a7c25006c9cea89599b83a16461815ff4 (patch)
tree90a176fb90939f2b0f37dc813a9ad4bbdd667bcb /src/command/command.c
parent9373f41fa4a7ba97429f8daa78067601a17051bc (diff)
downloadprofani-tty-f099bf9a7c25006c9cea89599b83a16461815ff4.tar.gz
Added desktop notifications for chat room invites
Use "/notify invite on|off"
Diffstat (limited to 'src/command/command.c')
-rw-r--r--src/command/command.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/command/command.c b/src/command/command.c
index adb831f4..6cbfdac9 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -499,11 +499,14 @@ static struct cmd_t setting_commands[] =
           "        : use 0 to disable.",
           "typing  : Notifications when contacts are typing.",
           "        : on|off",
+          "invite  : Notifications for chat room invites.",
+          "        : 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 invite on  (enable chat room invite notifications)",
           NULL } } },
 
     { "/flash",
@@ -783,6 +786,7 @@ cmd_init(void)
     autocomplete_add(notify_ac, strdup("message"));
     autocomplete_add(notify_ac, strdup("typing"));
     autocomplete_add(notify_ac, strdup("remind"));
+    autocomplete_add(notify_ac, strdup("invite"));
     autocomplete_add(notify_ac, strdup("status"));
 
     sub_ac = autocomplete_new();
@@ -2487,7 +2491,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, "remind") != 0) && (strcmp(kind, "invite") != 0)) {
         cons_show("Usage: %s", help.usage);
 
     // set message setting
@@ -2514,6 +2518,18 @@ _cmd_set_notify(gchar **args, struct cmd_help_t help)
             cons_show("Usage: /notify typing on|off");
         }
 
+    // set invite setting
+    } else if (strcmp(kind, "invite") == 0) {
+        if (strcmp(value, "on") == 0) {
+            cons_show("Chat room invite notifications enabled.");
+            prefs_set_boolean(PREF_NOTIFY_INVITE, TRUE);
+        } else if (strcmp(value, "off") == 0) {
+            cons_show("Chat room invite notifications disabled.");
+            prefs_set_boolean(PREF_NOTIFY_INVITE, FALSE);
+        } else {
+            cons_show("Usage: /notify invite on|off");
+        }
+
     // set remind setting
     } else if (strcmp(kind, "remind") == 0) {
         gint period = atoi(value);