diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index f722c38c..15b218be 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -1075,6 +1075,7 @@ cmd_ac_init(void) privacy_ac = autocomplete_new(); autocomplete_add(privacy_ac, "logging"); + autocomplete_add(privacy_ac, "os"); privacy_log_ac = autocomplete_new(); autocomplete_add(privacy_log_ac, "on"); @@ -2031,7 +2032,7 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ // autocomplete boolean settings gchar* boolean_choices[] = { "/beep", "/states", "/outtype", "/flash", "/splash", "/history", "/vercheck", "/privileges", "/wrap", - "/carbons", "/os", "/slashguard", "/mam", "/silence" }; + "/carbons", "/slashguard", "/mam", "/silence" }; for (int i = 0; i < ARRAY_SIZE(boolean_choices); i++) { result = autocomplete_param_with_func(input, boolean_choices[i], prefs_autocomplete_boolean_choice, previous, NULL); @@ -4239,6 +4240,11 @@ _privacy_autocomplete(ProfWin* window, const char* const input, gboolean previou return found; } + found = autocomplete_param_with_func(input, "/privacy os", prefs_autocomplete_boolean_choice, previous, NULL); + if (found) { + return found; + } + return found; } diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index b2919d3e..f7e42275 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -2448,19 +2448,6 @@ static const struct cmd_t command_defs[] = { "/avatar get thor@valhalla.edda", "/avatar open freyja@vanaheimr.edda") }, - { CMD_PREAMBLE("/os", - parse_args, 1, 1, &cons_os_setting) - CMD_MAINFUNC(cmd_os) - CMD_TAGS( - CMD_TAG_DISCOVERY) - CMD_SYN( - "/os |") - CMD_DESC( - "Choose whether to include the OS name if a user asks for software information (XEP-0092).") - CMD_ARGS( - { "on|off", "" }) - }, - { CMD_PREAMBLE("/correction", parse_args, 1, 2, &cons_correction_setting) CMD_MAINFUNC(cmd_correction) @@ -2723,17 +2710,24 @@ static const struct cmd_t command_defs[] = { { CMD_PREAMBLE("/privacy", parse_args, 2, 3, &cons_privacy_setting) + CMD_SUBFUNCS( + { "os", cmd_os }) CMD_MAINFUNC(cmd_privacy) CMD_TAGS( - CMD_TAG_CHAT) + CMD_TAG_CHAT, + CMD_TAG_DISCOVERY) CMD_SYN( - "/privacy logging on|redact|off") + "/privacy logging on|redact|off", + "/privacy os on|off") CMD_DESC( "Configure privacy settings.") CMD_ARGS( - { "logging on|redact|off", "Switch chat logging. This will also disable logging in the internally used SQL database. Your messages will not be saved anywhere locally. This might have unintended consequences, such as not being able to decrypt OMEMO encrypted messages received later via MAM, and should be used with caution." }) + { "logging on|redact|off", "Switch chat logging. This will also disable logging in the internally used SQL database. Your messages will not be saved anywhere locally. This might have unintended consequences, such as not being able to decrypt OMEMO encrypted messages received later via MAM, and should be used with caution." }, + { "os on|off", "Choose whether to include the OS name if a user asks for software information (XEP-0092)." } + ) CMD_EXAMPLES( - "/privacy logging off") + "/privacy logging off", + "/privacy os off") }, // NEXT-COMMAND (search helper) }; diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index fcff7eba..d11d5d06 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -9352,7 +9352,7 @@ cmd_avatar(ProfWin* window, const char* const command, gchar** args) gboolean cmd_os(ProfWin* window, const char* const command, gchar** args) { - _cmd_set_boolean_preference(args[0], "Revealing OS name", PREF_REVEAL_OS); + _cmd_set_boolean_preference(args[1], "Revealing OS name", PREF_REVEAL_OS); return TRUE; } diff --git a/src/ui/console.c b/src/ui/console.c index 24aaff14..dd7ef84f 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -2171,16 +2171,6 @@ cons_color_setting(void) } } -void -cons_os_setting(void) -{ - if (prefs_get_boolean(PREF_REVEAL_OS)) { - cons_show("Reveal OS name when asked for software version (XEP-0092) (/os) : ON"); - } else { - cons_show("Reveal OS name when asked for software version (XEP-0092) (/os) : OFF"); - } -} - void cons_correction_setting(void) { @@ -2956,4 +2946,10 @@ cons_privacy_setting(void) } else { cons_show("Chat history (/history) : OFF"); } + + if (prefs_get_boolean(PREF_REVEAL_OS)) { + cons_show("Reveal OS name when asked for software version (XEP-0092) (/privacy os) : ON"); + } else { + cons_show("Reveal OS name when asked for software version (XEP-0092) (/privacy os) : OFF"); + } } diff --git a/src/ui/ui.h b/src/ui/ui.h index 93190f6b..9255af3c 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -334,7 +334,6 @@ void cons_inpblock_setting(void); void cons_statusbar_setting(void); void cons_winpos_setting(void); void cons_color_setting(void); -void cons_os_setting(void); void cons_correction_setting(void); void cons_executable_setting(void); void cons_slashguard_setting(void); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 7817eaa3..f45f6b07 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -1125,10 +1125,6 @@ cons_tray_setting(void) { } void -cons_os_setting(void) -{ -} -void cons_correction_setting(void) { }