From 658ec67ff4df0df889bfae01db3c77e56c645dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?poljar=20=28Damir=20Jeli=C4=87=29?= Date: Sun, 6 May 2018 13:37:34 +0200 Subject: [PATCH] encryption: Add a error message for the olm command. --- matrix/encryption.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/matrix/encryption.py b/matrix/encryption.py index d8e9803..ff7d1d2 100644 --- a/matrix/encryption.py +++ b/matrix/encryption.py @@ -42,7 +42,7 @@ from matrix.globals import W, SERVERS from matrix.utf import utf8_decode -def own_buffer(f): +def own_buffer_or_error(f): @wraps(f) def wrapper(data, buffer, *args, **kwargs): @@ -53,6 +53,10 @@ def own_buffer(f): elif buffer == server.server_buffer: return f(server.name, buffer, *args, **kwargs) + W.prnt("", "{prefix}matrix: command \"olm\" must be executed on a " + "matrix buffer (server or channel)".format( + prefix=W.prefix("error"))) + return W.WEECHAT_RC_OK return wrapper @@ -118,7 +122,7 @@ def partition_key(key): return ' '.join(''.join(g) for g in groups) -@own_buffer +@own_buffer_or_error @utf8_decode def matrix_olm_command_cb(server_name, buffer, args): server = SERVERS[server_name]