]> granicus.if.org Git - ejabberd/commitdiff
Match namespace when checking for chat states
authorHolger Weiss <holger@zedat.fu-berlin.de>
Sun, 24 Apr 2016 15:16:28 +0000 (17:16 +0200)
committerHolger Weiss <holger@zedat.fu-berlin.de>
Sun, 24 Apr 2016 15:16:28 +0000 (17:16 +0200)
When checking for standalone chat states, match the namespace rather
than the names of the elements defined in the current XEP-0085 revision.

src/jlib.erl

index 407f43f178672021bb51e2c2504bd287d003d157..7bea7bb11b5fb449beabc929d2c9a044044721f3 100644 (file)
@@ -531,10 +531,8 @@ rsm_encode_count(Count, Arr) ->
 -spec is_standalone_chat_state(xmlel()) -> boolean().
 
 is_standalone_chat_state(#xmlel{name = <<"message">>, children = Els}) ->
-    ChatStates = [<<"active">>, <<"inactive">>, <<"gone">>, <<"composing">>,
-                 <<"paused">>],
-    Stripped = [El || #xmlel{name = Name} = El <- Els,
-                     not lists:member(Name, ChatStates),
+    Stripped = [El || #xmlel{name = Name, attrs = Attrs} = El <- Els,
+                     fxml:get_attr_s(<<"xmlns">>, Attrs) /= ?NS_CHATSTATES,
                      Name /= <<"thread">>],
     Stripped == [];
 is_standalone_chat_state(_El) -> false.