commands: Don't show deleted devices in the olm command.

This commit is contained in:
Damir Jelić 2018-10-13 12:13:10 +02:00
parent 08ad527a1f
commit d8362c572b
2 changed files with 15 additions and 2 deletions

View file

@ -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 = {}

View file

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