about summary refs log tree commit diff stats
path: root/src/command/cmd_funcs.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-11-05 20:39:33 +0100
committerMichael Vetter <jubalh@iodoru.org>2019-11-05 20:39:33 +0100
commitfc6f2755c1cb65436df1a1e2a12e6f2de99183a9 (patch)
tree55ba4a99d3f7fa99b7119abe959466fbcbf64478 /src/command/cmd_funcs.c
parent5490d148b957d3d614c914a09d77c43d2a6aa6d9 (diff)
downloadprofani-tty-fc6f2755c1cb65436df1a1e2a12e6f2de99183a9.tar.gz
Move /encwarn command into /titlebar
Instead of `/encwarn on|off` we now have `/titlebar show|hide encwarn`.

Regards https://github.com/profanity-im/profanity/issues/1116
Diffstat (limited to 'src/command/cmd_funcs.c')
-rw-r--r--src/command/cmd_funcs.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 5794d85b..5eec7016 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -5947,21 +5947,36 @@ cmd_titlebar(ProfWin *window, const char *const command, gchar **args)
 }
 
 gboolean
-cmd_titlebar_tls_show(ProfWin *window, const char *const command, gchar **args)
+cmd_titlebar_show_hide(ProfWin *window, const char *const command, gchar **args)
 {
-    if (args[1] == NULL || g_strcmp0(args[1], "tls") != 0) {
-        cons_bad_cmd_usage(command);
-    } else {
+    if (args[1] != NULL) {
         if (g_strcmp0(args[0], "show") == 0) {
-            cons_show("TLS titlebar indicator enabled.");
-            prefs_set_boolean(PREF_TLS_SHOW, TRUE);
+
+            if (g_strcmp0(args[1], "tls") == 0) {
+                cons_show("TLS titlebar indicator enabled.");
+                prefs_set_boolean(PREF_TLS_SHOW, TRUE);
+            } else if (g_strcmp0(args[1], "encwarn") == 0) {
+                cons_show("Encryption warning titlebar indicator enabled.");
+                prefs_set_boolean(PREF_ENC_WARN, TRUE);
+            } else {
+                cons_bad_cmd_usage(command);
+            }
         } else if (g_strcmp0(args[0], "hide") == 0) {
-            cons_show("TLS titlebar indicator disabled.");
-            prefs_set_boolean(PREF_TLS_SHOW, FALSE);
+
+            if (g_strcmp0(args[1], "tls") == 0) {
+                cons_show("TLS titlebar indicator disabled.");
+                prefs_set_boolean(PREF_TLS_SHOW, FALSE);
+            } else if (g_strcmp0(args[1], "encwarn") == 0) {
+                cons_show("Encryption warning titlebar indicator disabled.");
+                prefs_set_boolean(PREF_ENC_WARN, FALSE);
+            } else {
+                cons_bad_cmd_usage(command);
+            }
         } else {
             cons_bad_cmd_usage(command);
         }
     }
+
     return TRUE;
 }
 
@@ -7800,13 +7815,6 @@ cmd_otr_answer(ProfWin *window, const char *const command, gchar **args)
 }
 
 gboolean
-cmd_encwarn(ProfWin *window, const char *const command, gchar **args)
-{
-    _cmd_set_boolean_preference(args[0], command, "Encryption warning message", PREF_ENC_WARN);
-    return TRUE;
-}
-
-gboolean
 cmd_command_list(ProfWin *window, const char *const command, gchar **args)
 {
     jabber_conn_status_t conn_status = connection_get_status();