diff options
author | Paul Fariello <paul@fariello.eu> | 2019-04-01 13:53:29 +0200 |
---|---|---|
committer | Paul Fariello <paul@fariello.eu> | 2019-04-10 17:23:46 +0200 |
commit | e7be3a605bbb47e462265a379d48aad9cc565fc2 (patch) | |
tree | 4edb141ad5e22e22c97cc36725e0c6082d7abbeb | |
parent | 65b3f82c5f40e26b384d734a3d1206c09bf45ba5 (diff) | |
download | profani-tty-e7be3a605bbb47e462265a379d48aad9cc565fc2.tar.gz |
Add OMEMO in prefs command
-rw-r--r-- | src/command/cmd_ac.c | 1 | ||||
-rw-r--r-- | src/command/cmd_defs.c | 5 | ||||
-rw-r--r-- | src/command/cmd_funcs.c | 4 | ||||
-rw-r--r-- | src/ui/console.c | 24 | ||||
-rw-r--r-- | src/ui/ui.h | 1 | ||||
-rw-r--r-- | tests/unittests/ui/stub_ui.c | 1 |
6 files changed, 34 insertions, 2 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index 7b6a865b..0cc28bb3 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -244,6 +244,7 @@ cmd_ac_init(void) autocomplete_add(prefs_ac, "presence"); autocomplete_add(prefs_ac, "otr"); autocomplete_add(prefs_ac, "pgp"); + autocomplete_add(prefs_ac, "omemo"); notify_ac = autocomplete_new(); autocomplete_add(notify_ac, "chat"); diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index b1270f63..ab4112c7 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -2134,7 +2134,7 @@ static struct cmd_t command_defs[] = CMD_MAINFUNC(cmd_prefs) CMD_NOTAGS CMD_SYN( - "/prefs [ui|desktop|chat|log|conn|presence|otr|pgp]") + "/prefs [ui|desktop|chat|log|conn|presence|otr|pgp|omemo]") CMD_DESC( "Show preferences for different areas of functionality. " "Passing no arguments shows all preferences.") @@ -2146,7 +2146,8 @@ static struct cmd_t command_defs[] = { "conn", "Connection handling preferences." }, { "presence", "Chat presence preferences." }, { "otr", "Off The Record preferences." }, - { "pgp", "OpenPGP preferences." }) + { "pgp", "OpenPGP preferences." }, + { "omemo", "OMEMO preferences." }) CMD_NOEXAMPLES }, diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index c2696c31..e1f62ace 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -1679,6 +1679,10 @@ cmd_prefs(ProfWin *window, const char *const command, gchar **args) cons_show(""); cons_show_pgp_prefs(); cons_show(""); + } else if (strcmp(args[0], "omemo") == 0) { + cons_show(""); + cons_show_omemo_prefs(); + cons_show(""); } else { cons_bad_cmd_usage(command); } diff --git a/src/ui/console.c b/src/ui/console.c index e5c12158..260658c8 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -1999,6 +1999,28 @@ cons_show_pgp_prefs(void) } void +cons_show_omemo_prefs(void) +{ + cons_show("OMEMO preferences:"); + cons_show(""); + + char *log_value = prefs_get_string(PREF_OMEMO_LOG); + if (strcmp(log_value, "on") == 0) { + cons_show("OMEMO logging (/omemo log) : ON"); + } else if (strcmp(log_value, "off") == 0) { + cons_show("OMEMO logging (/omemo log) : OFF"); + } else { + cons_show("OMEMO logging (/omemo log) : Redacted"); + } + prefs_free_string(log_value); + + char ch = prefs_get_omemo_char(); + cons_show("OMEMO char (/omemo char) : %c", ch); + + cons_alert(); +} + +void cons_show_themes(GSList *themes) { cons_show(""); @@ -2072,6 +2094,8 @@ cons_prefs(void) cons_show(""); cons_show_pgp_prefs(); cons_show(""); + cons_show_omemo_prefs(); + cons_show(""); cons_alert(); } diff --git a/src/ui/ui.h b/src/ui/ui.h index e3cece81..79701a27 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -252,6 +252,7 @@ void cons_show_presence_prefs(void); 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_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 e08c3ce1..950036bc 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -338,6 +338,7 @@ void cons_show_presence_prefs(void) {} 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_account(ProfAccount *account) { |