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-13 20:17:45 +0000
committerJames Booth <boothj5@gmail.com>2014-01-13 20:17:45 +0000
commit60820007ee6b5a1bc634904d35f9f10292a04195 (patch)
treebb79b5ed16f7a1d96528971571f3e2daa1602a73 /src/command/commands.c
parent443b240ce4c649b81d2f27d82a300f2a6a4cea14 (diff)
downloadprofani-tty-60820007ee6b5a1bc634904d35f9f10292a04195.tar.gz
Added setting /otr log on|off|redact
Diffstat (limited to 'src/command/commands.c')
-rw-r--r--src/command/commands.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 25139a78..51296cd6 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -2302,6 +2302,29 @@ gboolean
 cmd_otr(gchar **args, struct cmd_help_t help)
 {
 #ifdef HAVE_LIBOTR
+    if (strcmp(args[0], "log") == 0) {
+        char *choice = args[1];
+        if (g_strcmp0(choice, "on") == 0) {
+            prefs_set_string(PREF_OTR_LOG, "on");
+            cons_show("OTR messages will be logged as plaintext.");
+            if (!prefs_get_boolean(PREF_CHLOG)) {
+                cons_show("Chat logging is currently disabled, use '/chlog on' to enable.");
+            }
+        } else if (g_strcmp0(choice, "off") == 0) {
+            prefs_set_string(PREF_OTR_LOG, "off");
+            cons_show("OTR message logging disabled.");
+        } else if (g_strcmp0(choice, "redact") == 0) {
+            prefs_set_string(PREF_OTR_LOG, "redact");
+            cons_show("OTR messages will be logged as '[redacted]'.");
+            if (!prefs_get_boolean(PREF_CHLOG)) {
+                cons_show("Chat logging is currently disabled, use '/chlog on' to enable.");
+            }
+        } else {
+            cons_show("Usage: %s", help.usage);
+        }
+        return TRUE;
+    }
+
     if (jabber_get_connection_status() != JABBER_CONNECTED) {
         cons_show("You must be connected with an account to load OTR information.");
         return TRUE;