about summary refs log tree commit diff stats
path: root/src/command.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-08-16 00:50:32 +0100
committerJames Booth <boothj5@gmail.com>2012-08-16 00:50:32 +0100
commit8b1653f7076c61f317446b7c80093ab0a0381e35 (patch)
treee7af6b8b64a94a50c5527d3a985fc3bf7b2a4edc /src/command.c
parenta7c7768778f005aec8b11512743924d5270b3e07 (diff)
downloadprofani-tty-8b1653f7076c61f317446b7c80093ab0a0381e35.tar.gz
Added typing notifications and related preferences
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/command.c b/src/command.c
index f8bd2a32..8397bbd9 100644
--- a/src/command.c
+++ b/src/command.c
@@ -66,6 +66,7 @@ static gboolean _cmd_tiny(const char * const inp, struct cmd_help_t help);
 static gboolean _cmd_close(const char * const inp, struct cmd_help_t help);
 static gboolean _cmd_set_beep(const char * const inp, struct cmd_help_t help);
 static gboolean _cmd_set_notify(const char * const inp, struct cmd_help_t help);
+static gboolean _cmd_set_typing(const char * const inp, struct cmd_help_t help);
 static gboolean _cmd_set_flash(const char * const inp, struct cmd_help_t help);
 static gboolean _cmd_set_showsplash(const char * const inp, struct cmd_help_t help);
 static gboolean _cmd_set_chlog(const char * const inp, struct cmd_help_t help);
@@ -207,6 +208,19 @@ static struct cmd_t setting_commands[] =
           "Config file value :   notify=true|false",
           NULL } } },
 
+    { "/typing",
+        _cmd_set_typing,
+        { "/typing on|off", "Enable/disable typing notifications.",
+        { "/typing on|off",
+          "--------------",
+          "Switch the typing notifications on or off for incoming messages",
+          "If desktop notifications are also enabled you will receive them",
+          "for typing notifications also.",
+          "",
+          "Config file section : [ui]",
+          "Config file value :   typing=true|false",
+          NULL } } },
+
     { "/flash", 
         _cmd_set_flash,
         { "/flash on|off", "Enable/disable screen flash notifications.",
@@ -697,6 +711,24 @@ _cmd_set_notify(const char * const inp, struct cmd_help_t help)
 }
 
 static gboolean
+_cmd_set_typing(const char * const inp, struct cmd_help_t help)
+{
+    if (strcmp(inp, "/typing on") == 0) {
+        cons_show("Incoming typing notifications enabled.");
+        prefs_set_typing(TRUE);
+    } else if (strcmp(inp, "/typing off") == 0) {
+        cons_show("Incoming typing notifications disabled.");
+        prefs_set_typing(FALSE);
+    } else {
+        char usage[strlen(help.usage + 8)];
+        sprintf(usage, "Usage: %s", help.usage);
+        cons_show(usage);
+    }        
+
+    return TRUE;
+}
+
+static gboolean
 _cmd_set_flash(const char * const inp, struct cmd_help_t help)
 {
     if (strcmp(inp, "/flash on") == 0) {