diff --git a/matrix/bar_items.py b/matrix/bar_items.py index 226b80c..34569e5 100644 --- a/matrix/bar_items.py +++ b/matrix/bar_items.py @@ -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("❌") diff --git a/matrix/config.py b/matrix/config.py index b78a536..c612686 100644 --- a/matrix/config.py +++ b/matrix/config.py @@ -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 = [