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
This commit is contained in:
Michael Vetter
2019-11-05 20:39:33 +01:00
parent 5490d148b9
commit fc6f2755c1
6 changed files with 50 additions and 59 deletions

View File

@@ -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;
}
@@ -7799,13 +7814,6 @@ cmd_otr_answer(ProfWin *window, const char *const command, gchar **args)
#endif
}
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)
{