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
This commit is contained in:
Michael Vetter
2019-11-05 13:48:26 +01:00
parent 8d2b1b05e7
commit 643d12af44
4 changed files with 72 additions and 23 deletions

View File

@@ -287,13 +287,6 @@ cmd_tls_revoke(ProfWin *window, const char *const command, gchar **args)
#endif
}
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)
{
@@ -5953,6 +5946,25 @@ cmd_titlebar(ProfWin *window, const char *const command, gchar **args)
return TRUE;
}
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)
{