1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'master' into osx-functional

This commit is contained in:
James Booth 2015-10-14 01:01:19 +01:00
commit 1bebfefa9c
11 changed files with 36 additions and 4 deletions

View File

@ -191,7 +191,8 @@ static struct cmd_t command_defs[] =
{ "/tls",
cmd_tls, parse_args, 1, 3, NULL,
CMD_TAGS(
CMD_TAG_CONNECTION)
CMD_TAG_CONNECTION,
CMD_TAG_UI)
CMD_SYN(
"/tls allow",
"/tls always",
@ -200,7 +201,8 @@ static struct cmd_t command_defs[] =
"/tls revoke <fingerprint>",
"/tls certpath",
"/tls certpath set <path>",
"/tls certpath clear")
"/tls certpath clear",
"/tls show on|off")
CMD_DESC(
"Handle TLS certificates. ")
CMD_ARGS(
@ -211,7 +213,8 @@ static struct cmd_t command_defs[] =
{ "revoke <fingerprint>", "Remove a manually trusted certificate." },
{ "certpath", "Show the trusted certificate path." },
{ "certpath set <path>", "Specify filesystem path containing trusted certificates." },
{ "certpath clear", "Clear the trusted certificate path." })
{ "certpath clear", "Clear the trusted certificate path." },
{ "show on|off", "Show or hide the TLS indicator in the titlebar." })
CMD_NOEXAMPLES
},
@ -2158,6 +2161,7 @@ cmd_init(void)
autocomplete_add(tls_ac, "trusted");
autocomplete_add(tls_ac, "revoke");
autocomplete_add(tls_ac, "certpath");
autocomplete_add(tls_ac, "show");
tls_certpath_ac = autocomplete_new();
autocomplete_add(tls_certpath_ac, "set");
@ -3628,6 +3632,11 @@ _tls_autocomplete(ProfWin *window, const char * const input)
return result;
}
result = autocomplete_param_with_func(input, "/tls show", prefs_autocomplete_boolean_choice);
if (result) {
return result;
}
result = autocomplete_param_with_ac(input, "/tls", tls_ac, TRUE);
if (result) {
return result;

View File

@ -237,6 +237,8 @@ cmd_tls(ProfWin *window, const char * const command, gchar **args)
}
}
return TRUE;
} else if (g_strcmp0(args[0], "show") == 0) {
return _cmd_set_boolean_preference(args[1], command, "TLS titlebar indicator", PREF_TLS_SHOW);
} else {
cons_bad_cmd_usage(command);
return TRUE;

View File

@ -602,6 +602,7 @@ _get_group(preference_t pref)
case PREF_RESOURCE_MESSAGE:
case PREF_ENC_WARN:
case PREF_INPBLOCK_DYNAMIC:
case PREF_TLS_SHOW:
return PREF_GROUP_UI;
case PREF_STATES:
case PREF_OUTTYPE:
@ -781,6 +782,8 @@ _get_key(preference_t pref)
return "log";
case PREF_CERT_PATH:
return "certpath";
case PREF_TLS_SHOW:
return "tls.show";
default:
return NULL;
}
@ -817,6 +820,7 @@ _get_default_boolean(preference_t pref)
case PREF_ROSTER_OFFLINE:
case PREF_ROSTER_RESOURCE:
case PREF_ROSTER_EMPTY:
case PREF_TLS_SHOW:
return TRUE;
default:
return FALSE;

View File

@ -112,6 +112,7 @@ typedef enum {
PREF_ENC_WARN,
PREF_PGP_LOG,
PREF_CERT_PATH,
PREF_TLS_SHOW,
} preference_t;
typedef struct prof_alias_t {

View File

@ -471,6 +471,7 @@ _load_preferences(void)
_set_boolean_preference("intype", PREF_INTYPE);
_set_boolean_preference("enc.warn", PREF_ENC_WARN);
_set_boolean_preference("tls.show", PREF_TLS_SHOW);
if (g_key_file_has_key(theme, "ui", "otr.char", NULL)) {
gchar *ch = g_key_file_get_string(theme, "ui", "otr.char", NULL);

View File

@ -941,6 +941,16 @@ cons_encwarn_setting(void)
}
}
void
cons_tlsshow_setting(void)
{
if (prefs_get_boolean(PREF_TLS_SHOW)) {
cons_show("TLS show (/tls) : ON");
} else {
cons_show("TLS show (/tls) : OFF");
}
}
void
cons_presence_setting(void)
{
@ -1147,6 +1157,7 @@ cons_show_ui_prefs(void)
cons_encwarn_setting();
cons_presence_setting();
cons_inpblock_setting();
cons_tlsshow_setting();
cons_alert();
}

View File

@ -282,7 +282,7 @@ _show_self_presence(void)
mvwaddch(win, 0, cols - 2, ']');
wattroff(win, bracket_attrs);
if (is_connected) {
if (is_connected && prefs_get_boolean(PREF_TLS_SHOW)) {
wattron(win, bracket_attrs);
mvwaddch(win, 0, cols - tls_start, '[');
wattroff(win, bracket_attrs);

View File

@ -304,6 +304,7 @@ void cons_beep_setting(void);
void cons_flash_setting(void);
void cons_splash_setting(void);
void cons_encwarn_setting(void);
void cons_tlsshow_setting(void);
void cons_vercheck_setting(void);
void cons_occupants_setting(void);
void cons_roster_setting(void);

View File

@ -83,3 +83,4 @@ occupants.jid=false
wins.autotidy=true
otr.char=@
pgp.char=%
tls.show=true

View File

@ -28,3 +28,4 @@ privileges=true
presence=true
intype=true
enc.warn=true
tls.show=true

View File

@ -28,3 +28,4 @@ presence=false
intype=false
enc.warn=false
wins.autotidy=false
tls.show=false