bar_items: Make the encryption warning sign configurable.

This commit is contained in:
Damir Jelić 2018-11-03 12:30:20 +01:00
parent e8fa66bbcb
commit 286b15aa86
2 changed files with 20 additions and 1 deletions

View file

@ -105,7 +105,9 @@ def matrix_bar_item_buffer_modes(data, item, window, buffer, extra_info):
if (server.client
and server.client.room_contains_unverified(room.room_id)):
modes.append("⚠️ ")
modes.append(
G.CONFIG.look.encryption_warning_sign,
)
if not server.connected:
modes.append("")

View file

@ -178,6 +178,10 @@ def logbook_category(value):
return "all"
def eval_cast(string):
return W.string_eval_expression(string, {}, {}, {})
class WeechatConfig(object):
def __init__(self, sections):
self._ptr = W.config_new(
@ -268,6 +272,8 @@ class ConfigSection(object):
return bool(W.config_boolean(self._option_ptrs[name]))
def str_getter(self):
if cast_func:
return cast_func(W.config_string(self._option_ptrs[name]))
return W.config_string(self._option_ptrs[name])
def str_evaluate_getter(self):
@ -340,6 +346,17 @@ class MatrixConfig(WeechatConfig):
"Typing: ",
("Prefix for the typing notice bar item."),
),
Option(
"encryption_warning_sign",
"string",
"",
0,
0,
"⚠️ ",
("A sign that is used to signal trust issues in encrypted "
"rooms (note: content is evaluated, see /help eval)"),
eval_cast,
),
]
network_options = [