mirror of
https://github.com/processone/ejabberd.git
synced 2024-06-08 21:43:07 +02:00
Fix check for standalone chat state notifications
Ignore whitespace (and other XML CDATA) when checking whether a message stanza is a standalone chat state notification.
This commit is contained in:
parent
2660dcabba
commit
beeb1c82d9
19
src/jlib.erl
19
src/jlib.erl
|
@ -530,22 +530,13 @@ rsm_encode_count(Count, Arr) ->
|
||||||
|
|
||||||
-spec is_standalone_chat_state(xmlel()) -> boolean().
|
-spec is_standalone_chat_state(xmlel()) -> boolean().
|
||||||
|
|
||||||
is_standalone_chat_state(#xmlel{name = <<"message">>} = El) ->
|
is_standalone_chat_state(#xmlel{name = <<"message">>, children = Els}) ->
|
||||||
ChatStates = [<<"active">>, <<"inactive">>, <<"gone">>, <<"composing">>,
|
ChatStates = [<<"active">>, <<"inactive">>, <<"gone">>, <<"composing">>,
|
||||||
<<"paused">>],
|
<<"paused">>],
|
||||||
Stripped =
|
Stripped = [El || #xmlel{name = Name} = El <- Els,
|
||||||
lists:foldl(fun(ChatState, AccEl) ->
|
not lists:member(Name, ChatStates),
|
||||||
fxml:remove_subtags(AccEl, ChatState,
|
Name /= <<"thread">>],
|
||||||
{<<"xmlns">>, ?NS_CHATSTATES})
|
Stripped == [];
|
||||||
end, El, ChatStates),
|
|
||||||
case Stripped of
|
|
||||||
#xmlel{children = [#xmlel{name = <<"thread">>}]} ->
|
|
||||||
true;
|
|
||||||
#xmlel{children = []} ->
|
|
||||||
true;
|
|
||||||
_ ->
|
|
||||||
false
|
|
||||||
end;
|
|
||||||
is_standalone_chat_state(_El) -> false.
|
is_standalone_chat_state(_El) -> false.
|
||||||
|
|
||||||
-spec add_delay_info(xmlel(), jid() | ljid() | binary(), erlang:timestamp())
|
-spec add_delay_info(xmlel(), jid() | ljid() | binary(), erlang:timestamp())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user