]> granicus.if.org Git - ejabberd/commitdiff
don't ask capabilities to MUC room participants
authorChristophe Romain <christophe.romain@process-one.net>
Fri, 11 Jan 2008 13:57:29 +0000 (13:57 +0000)
committerChristophe Romain <christophe.romain@process-one.net>
Fri, 11 Jan 2008 13:57:29 +0000 (13:57 +0000)
SVN Revision: 1147

ChangeLog
src/mod_caps.erl

index 4d893eea356e22608d00ccf98caff4c1c66c3fdb..6fddcda9aefe1b095fc092a99c6cd9a05ccdae20 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-11  Christophe Romain <christophe.romain@process-one.net>
+
+       * src/mod_caps.erl: don't ask capabilities to MUC room participants
+       (EJAB-478)
+
 2008-01-10  Christophe Romain <christophe.romain@process-one.net>
 
        * src/mod_pubsub/nodetree_default: Force PEP parent node to be []
index 1bec888178019351d0e4073c70b99cbfbe71af45..1f89fbb84bb5bea1f63b913ac2eef13aee7f4f41 100644 (file)
 %% <presence/> stanza) and returns an opaque value representing the
 %% Entity Capabilities contained therein, or the atom nothing if no
 %% capabilities are advertised.
-read_caps([{xmlelement, "c", Attrs, _Els} | Tail]) ->
+read_caps(Els) ->
+    read_caps(Els, nothing).
+read_caps([{xmlelement, "c", Attrs, _Els} | Tail], Result) ->
     case xml:get_attr_s("xmlns", Attrs) of
        ?NS_CAPS ->
            Node = xml:get_attr_s("node", Attrs),
            Version = xml:get_attr_s("ver", Attrs),
            Exts = string:tokens(xml:get_attr_s("ext", Attrs), " "),
-           #caps{node = Node, version = Version, exts = Exts};
+           read_caps(Tail, #caps{node = Node, version = Version, exts = Exts});
        _ ->
-           read_caps(Tail)
+           read_caps(Tail, Result)
     end;
-read_caps([_ | Tail]) ->
-    read_caps(Tail);
-read_caps([]) ->
-    nothing.
+read_caps([{xmlelement, "x", Attrs, _Els} | Tail], Result) ->
+    case xml:get_attr_s("xmlns", Attrs) of
+       ?NS_MUC_USER ->
+           nothing;
+       _ ->
+           read_caps(Tail, Result)
+    end;
+read_caps([_ | Tail], Result) ->
+    read_caps(Tail, Result);
+read_caps([], Result) ->
+    Result.
 
 %% note_caps should be called to make the module request disco
 %% information.  Host is the host that asks, From is the full JID that