From 8b1653f7076c61f317446b7c80093ab0a0381e35 Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 16 Aug 2012 00:50:32 +0100 Subject: Added typing notifications and related preferences --- src/command.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/command.c') 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.", @@ -696,6 +710,24 @@ _cmd_set_notify(const char * const inp, struct cmd_help_t help) return TRUE; } +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) { -- cgit 1.4.1-2-gfad0