about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2022-05-05 23:48:43 +0200
committerMichael Vetter <jubalh@iodoru.org>2022-05-05 23:55:31 +0200
commitb16bdca726970a721301c88b588dd7263a8655e3 (patch)
tree333ed1a9464b5d52d2d48160ee723fa4dbfa3913
parentd011d6707c59b39dec9e83611592ee9c4b0b5a4d (diff)
downloadprofani-tty-b16bdca726970a721301c88b588dd7263a8655e3.tar.gz
ox: show ox preferences
-rw-r--r--src/command/cmd_ac.c1
-rw-r--r--src/command/cmd_funcs.c4
-rw-r--r--src/ui/console.c25
-rw-r--r--src/ui/ui.h1
-rw-r--r--tests/unittests/ui/stub_ui.c4
5 files changed, 35 insertions, 0 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index 508c6f21..99072d8d 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -317,6 +317,7 @@ cmd_ac_init(void)
 #endif
 #ifdef HAVE_LIBGPGME
     autocomplete_add(prefs_ac, "pgp");
+    autocomplete_add(prefs_ac, "ox");
 #endif
 #ifdef HAVE_OMEMO
     autocomplete_add(prefs_ac, "omemo");
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 9d6441b1..f5f2bc90 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -1743,6 +1743,10 @@ cmd_prefs(ProfWin* window, const char* const command, gchar** args)
         cons_show("");
         cons_show_omemo_prefs();
         cons_show("");
+    } else if (strcmp(args[0], "ox") == 0) {
+        cons_show("");
+        cons_show_ox_prefs();
+        cons_show("");
     } else {
         cons_bad_cmd_usage(command);
     }
diff --git a/src/ui/console.c b/src/ui/console.c
index 08ccba17..fbbddba8 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -2315,6 +2315,29 @@ cons_show_omemo_prefs(void)
 }
 
 void
+cons_show_ox_prefs(void)
+{
+    cons_show("OX preferences:");
+    cons_show("");
+
+    char* log_value = prefs_get_string(PREF_OX_LOG);
+    if (strcmp(log_value, "on") == 0) {
+        cons_show("OX logging (/ox log)   : ON");
+    } else if (strcmp(log_value, "off") == 0) {
+        cons_show("OX logging (/ox log)   : OFF");
+    } else {
+        cons_show("OX logging (/ox log)   : Redacted");
+    }
+    g_free(log_value);
+
+    char* ch = prefs_get_ox_char();
+    cons_show("OX char (/ox char)     : %s", ch);
+    free(ch);
+
+    cons_alert(NULL);
+}
+
+void
 cons_show_themes(GSList* themes)
 {
     cons_show("");
@@ -2390,6 +2413,8 @@ cons_prefs(void)
     cons_show("");
     cons_show_omemo_prefs();
     cons_show("");
+    cons_show_ox_prefs();
+    cons_show("");
 
     cons_alert(NULL);
 }
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 6805b362..7deb2ca2 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -252,6 +252,7 @@ void cons_show_connection_prefs(void);
 void cons_show_otr_prefs(void);
 void cons_show_pgp_prefs(void);
 void cons_show_omemo_prefs(void);
+void cons_show_ox_prefs(void);
 void cons_show_account(ProfAccount* account);
 void cons_debug(const char* const msg, ...);
 void cons_show_error(const char* const cmd, ...);
diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c
index cbe61bdf..768e654b 100644
--- a/tests/unittests/ui/stub_ui.c
+++ b/tests/unittests/ui/stub_ui.c
@@ -790,6 +790,10 @@ void
 cons_show_omemo_prefs(void)
 {
 }
+void
+cons_show_ox_prefs(void)
+{
+}
 
 void
 cons_show_account(ProfAccount* account)