diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2019-03-11 22:58:53 +0100 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2019-03-11 22:58:53 +0100 |
commit | 328553ea3f68410b6c13e382132d5b53e980bd9b (patch) | |
tree | a7b7d1206d77a0981d2ee3239ec4e71208335007 /src/mod_push.erl | |
parent | Fix cond_options with new options (diff) |
mod_push: Check for payload in encrypted messages
While distinguishing actual chat messages from other message types,
don't classify all <encrypted/> messages as chat messages, but only
those that have a <payload/> element.
Diffstat (limited to 'src/mod_push.erl')
-rw-r--r-- | src/mod_push.erl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mod_push.erl b/src/mod_push.erl index a6e87137..2cf34f65 100644 --- a/src/mod_push.erl +++ b/src/mod_push.erl @@ -682,8 +682,13 @@ get_body_text(#message{body = Body} = Msg) -> end. -spec body_is_encrypted(message()) -> boolean(). -body_is_encrypted(#message{sub_els = SubEls}) -> - lists:keyfind(<<"encrypted">>, #xmlel.name, SubEls) /= false. +body_is_encrypted(#message{sub_els = MsgEls}) -> + case lists:keyfind(<<"encrypted">>, #xmlel.name, MsgEls) of + #xmlel{children = EncEls} -> + lists:keyfind(<<"payload">>, #xmlel.name, EncEls) /= false; + false -> + false + end. -spec inspect_error(iq()) -> {atom(), binary()}. inspect_error(IQ) -> |