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.
This commit is contained in:
parent
946baa972d
commit
328553ea3f
|
@ -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) ->
|
||||
|
|
Loading…
Reference in New Issue