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 13:48:26 +0100
committerMichael Vetter <jubalh@iodoru.org>2019-11-05 13:48:26 +0100
commit643d12af445bc7bbda4d9f90acf63bd2b77b5098 (patch)
tree44c33875f8518f2537b14fd08f2a2a6b3ac005d0 /src/command/cmd_funcs.c
parent8d2b1b05e7f5d1ea5320dded432824e4cf86ebaf (diff)
downloadprofani-tty-643d12af445bc7bbda4d9f90acf63bd2b77b5098.tar.gz
Move `tls show` to titlebar command
Previously we had `/tls show on|off` to manipulate the UI setting for
the title bar. To decide whether to show TLS info there or not.

This should go into `/titlebar`.

Now we have `/titlebar show|hide tls` for this.

Regards https://github.com/profanity-im/profanity/issues/1116
Diffstat (limited to 'src/command/cmd_funcs.c')
-rw-r--r--src/command/cmd_funcs.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index cc26bba2..5794d85b 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -288,13 +288,6 @@ cmd_tls_revoke(ProfWin *window, const char *const command, gchar **args)
 }
 
 gboolean
-cmd_tls_show(ProfWin *window, const char *const command, gchar **args)
-{
-    _cmd_set_boolean_preference(args[1], command, "TLS titlebar indicator", PREF_TLS_SHOW);
-    return TRUE;
-}
-
-gboolean
 cmd_tls_cert(ProfWin *window, const char *const command, gchar **args)
 {
 #ifdef HAVE_LIBMESODE
@@ -5954,6 +5947,25 @@ cmd_titlebar(ProfWin *window, const char *const command, gchar **args)
 }
 
 gboolean
+cmd_titlebar_tls_show(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 (g_strcmp0(args[0], "show") == 0) {
+            cons_show("TLS titlebar indicator enabled.");
+            prefs_set_boolean(PREF_TLS_SHOW, TRUE);
+        } else if (g_strcmp0(args[0], "hide") == 0) {
+            cons_show("TLS titlebar indicator disabled.");
+            prefs_set_boolean(PREF_TLS_SHOW, FALSE);
+        } else {
+            cons_bad_cmd_usage(command);
+        }
+    }
+    return TRUE;
+}
+
+gboolean
 cmd_mainwin(ProfWin *window, const char *const command, gchar **args)
 {
     if (g_strcmp0(args[0], "up") == 0) {