about summary refs log tree commit diff stats
path: root/src/command/commands.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-01-16 22:44:23 +0000
committerJames Booth <boothj5@gmail.com>2014-01-16 22:44:23 +0000
commit4f98bc8c25075891a1fd5a954ae83e961405a664 (patch)
tree9533784aa0fe7ae81ace0ee173235a9cd801a201 /src/command/commands.c
parent6c59bb26da67f2d48e0203e8df328205313d6c57 (diff)
downloadprofani-tty-4f98bc8c25075891a1fd5a954ae83e961405a664.tar.gz
Show OTR coloured status
Customisable within theme files e.g.:
titlebar.unencrypted=red
titlebar.encrypted=green
titlebar.trusted=red
titlebar.untrusted=green

Shows [unencrypted] for all non-OTR chat

Disable with '/otr warn off'
Diffstat (limited to 'src/command/commands.c')
-rw-r--r--src/command/commands.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 6adec3c5..a8d47eed 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -2327,6 +2327,12 @@ cmd_otr(gchar **args, struct cmd_help_t help)
             cons_show("Usage: %s", help.usage);
         }
         return TRUE;
+    } else if (strcmp(args[0], "warn") == 0) {
+        gboolean result =  _cmd_set_boolean_preference(args[1], help,
+            "OTR warning message", PREF_OTR_WARN);
+        // update the current window
+        ui_switch_win(wins_get_current_num());
+        return result;
     }
 
     if (jabber_get_connection_status() != JABBER_CONNECTED) {
@@ -2493,7 +2499,11 @@ _cmd_set_boolean_preference(gchar *arg, struct cmd_help_t help,
     GString *disabled = g_string_new(display);
     g_string_append(disabled, " disabled.");
 
-    if (strcmp(arg, "on") == 0) {
+    if (arg == NULL) {
+        char usage[strlen(help.usage) + 8];
+        sprintf(usage, "Usage: %s", help.usage);
+        cons_show(usage);
+    } else if (strcmp(arg, "on") == 0) {
         cons_show(enabled->str);
         prefs_set_boolean(pref, TRUE);
     } else if (strcmp(arg, "off") == 0) {