encryption: Add a error message for the olm command.

This commit is contained in:
poljar (Damir Jelić) 2018-05-06 13:37:34 +02:00
parent 9e86ccc3f7
commit 658ec67ff4

View file

@ -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]