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:
@@ -775,6 +775,7 @@ cmd_ac_init(void)
|
||||
|
||||
titlebar_show_ac = autocomplete_new();
|
||||
autocomplete_add(titlebar_show_ac, "tls");
|
||||
autocomplete_add(titlebar_show_ac, "encwarn");
|
||||
|
||||
tls_certpath_ac = autocomplete_new();
|
||||
autocomplete_add(tls_certpath_ac, "set");
|
||||
@@ -1440,8 +1441,7 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input, gboolean previ
|
||||
|
||||
// autocomplete boolean settings
|
||||
gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype", "/flash", "/splash", "/chlog", "/grlog",
|
||||
"/history", "/vercheck", "/privileges", "/wrap", "/carbons", "/encwarn",
|
||||
"/lastactivity" };
|
||||
"/history", "/vercheck", "/privileges", "/wrap", "/carbons", "/lastactivity" };
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
|
||||
result = autocomplete_param_with_func(input, boolean_choices[i], prefs_autocomplete_boolean_choice, previous);
|
||||
|
||||
@@ -1197,22 +1197,6 @@ static struct cmd_t command_defs[] =
|
||||
CMD_NOEXAMPLES
|
||||
},
|
||||
|
||||
{ "/encwarn",
|
||||
parse_args, 1, 1, &cons_encwarn_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_encwarn)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT,
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
"/encwarn on|off")
|
||||
CMD_DESC(
|
||||
"Titlebar encryption warning.")
|
||||
CMD_ARGS(
|
||||
{ "on|off", "Enable or disable the unencrypted warning message in the titlebar." })
|
||||
CMD_NOEXAMPLES
|
||||
},
|
||||
|
||||
{ "/presence",
|
||||
parse_args, 2, 2, &cons_presence_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
@@ -1324,10 +1308,10 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/titlebar",
|
||||
parse_args, 1, 2, &cons_winpos_setting,
|
||||
parse_args, 1, 2, &cons_titlebar_setting,
|
||||
CMD_SUBFUNCS(
|
||||
{ "show", cmd_titlebar_tls_show },
|
||||
{ "hide", cmd_titlebar_tls_show }
|
||||
{ "show", cmd_titlebar_show_hide },
|
||||
{ "hide", cmd_titlebar_show_hide }
|
||||
)
|
||||
CMD_MAINFUNC(cmd_titlebar)
|
||||
CMD_TAGS(
|
||||
@@ -1335,15 +1319,19 @@ static struct cmd_t command_defs[] =
|
||||
CMD_SYN(
|
||||
"/titlebar up",
|
||||
"/titlebar down",
|
||||
"/titlebar show|hide tls")
|
||||
"/titlebar show|hide [tls|encwarn]")
|
||||
CMD_DESC(
|
||||
"Titlebar settings.")
|
||||
CMD_ARGS(
|
||||
{ "up", "Move the title bar up the screen." },
|
||||
{ "down", "Move the title bar down the screen." },
|
||||
{ "show", "Show or hide the TLS indicator in the titlebar." }
|
||||
{ "show tls", "Show or hide TLS indicator in the titlebar." },
|
||||
{ "show encwarn", "Enable or disable the unencrypted warning message in the titlebar." }
|
||||
)
|
||||
CMD_NOEXAMPLES
|
||||
CMD_EXAMPLES(
|
||||
"/titlebar up",
|
||||
"/titlebar show tls",
|
||||
"/titlebar hide encwarn")
|
||||
},
|
||||
|
||||
{ "/mainwin",
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -151,11 +151,10 @@ gboolean cmd_time(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_resource(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_inpblock(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_titlebar(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_titlebar_tls_show(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_titlebar_show_hide(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_mainwin(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_statusbar(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_inputwin(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_encwarn(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_script(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_export(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_charset(ProfWin *window, const char *const command, gchar **args);
|
||||
|
||||
Reference in New Issue
Block a user