diff --git a/matrix/commands.py b/matrix/commands.py index 299e2d0..008a8c5 100644 --- a/matrix/commands.py +++ b/matrix/commands.py @@ -356,7 +356,7 @@ def olm_info_command(server, args): for user_id in sorted(device_store.users): device_strings = [] - for device in device_store[user_id].values(): + for device in device_store.active_user_devices(user_id): if filter_regex: if (not filter_regex.search(user_id) and not filter_regex.search(device.id)): @@ -454,7 +454,9 @@ def olm_action_command(server, args, category, error_category, prefix, action): else: users = [x for x in device_store.users if args.user_filter in x] - user_devices = {user: device_store[user].values() for user in users} + user_devices = { + user: device_store.active_user_devices(user) for user in users + } if args.device_filter and args.device_filter != "*": filtered_user_devices = {} diff --git a/matrix/completion.py b/matrix/completion.py index 67c78b9..fe943dd 100644 --- a/matrix/completion.py +++ b/matrix/completion.py @@ -188,6 +188,17 @@ def matrix_olm_device_completion_cb(data, completion_item, buffer, completion): user = fields[1] + if user not in olm.device_store.users: + return W.WEECHAT_RC_OK + + for device in olm.device_store.active_user_devices(user): + W.hook_completion_list_add( + completion, device.id, 0, W.WEECHAT_LIST_POS_SORT + ) + + return W.WEECHAT_RC_OK + + if user not in olm.device_store.users: return W.WEECHAT_RC_OK