From 89c5bc0546477474a192fc7e1845fb818894f1ae Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 26 Mar 2018 01:35:36 +0200 Subject: [PATCH] mod_deny_omemo: Fix matching of devicelist queries Devicelist queries don't include an element. --- mod_deny_omemo/src/mod_deny_omemo.erl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mod_deny_omemo/src/mod_deny_omemo.erl b/mod_deny_omemo/src/mod_deny_omemo.erl index b163e75..bd7dc68 100644 --- a/mod_deny_omemo/src/mod_deny_omemo.erl +++ b/mod_deny_omemo/src/mod_deny_omemo.erl @@ -164,16 +164,18 @@ maybe_reject(El, {#iq{type = Type, lang = Lang} = IQ, end. -spec find_omemo_nodes(ps_publish() | ps_items()) -> [binary()]. -find_omemo_nodes(#ps_items{node = Node, items = [Item]}) -> - find_omemo_nodes(Node, Item); -find_omemo_nodes(#ps_publish{node = Node, items = [Item]}) -> - find_omemo_nodes(Node, Item); +find_omemo_nodes(#ps_items{node = Node, items = Items}) -> + find_omemo_nodes(Node, Items); +find_omemo_nodes(#ps_publish{node = Node, items = Items}) -> + find_omemo_nodes(Node, Items); find_omemo_nodes(_) -> []. --spec find_omemo_nodes(binary(), ps_item()) -> [binary()]. -find_omemo_nodes(<> = Node, Item) -> +-spec find_omemo_nodes(binary(), ps_items()) -> [binary()]. +find_omemo_nodes(<> = Node, [Item]) -> [Node | find_bundle_nodes(Item)]; +find_omemo_nodes(<> = Node, []) -> + [Node]; find_omemo_nodes(_Node, _Item) -> [].