Pubsub : missing "headers" wrapper in SHIM headers

I'm using the latest eJabberd from svn.

I have multiple subscriptions to same node (or it's parents). So, when I receive a notification, SHIM headers are included but with wrong syntax.

Here's what I get:

<message from="pubsub.larzac.org" to="toto@larzac.org" >
  <event xmlns="http://jabber.org/protocol/pubsub#event">
    <items node="/tmp/test1" >
      <item id="test1.1" >
  (...)
      </item>
    </items>
  </event>
  <header name="Collection" >/tmp</header>
  <header name="Collection" >/tmp/test1</header>
</message>

I think the two header should be wrapped into <headers xmlns='http://jabber.org/protocol/shim'>, according to XEP-0131

Try this small patch

I wrote this small patch. If you confirm it works correctly, I'll report it to the PubSub experts for inclusion in SVN.

--- a/src/jlib.hrl
+++ b/src/jlib.hrl
@@ -82,6 +82,7 @@
 -define(NS_COMPRESS,     "http://jabber.org/protocol/compress").

 -define(NS_CAPS,          "http://jabber.org/protocol/caps").
+-define(NS_SHIM,          "http://jabber.org/protocol/shim").

 %% CAPTCHA related NSes.
 -define(NS_OOB, "jabber:x:oob").
diff --git a/src/mod_pubsub/mod_pubsub.erl b/src/mod_pubsub/mod_pubsub.erl
index 7135bdb..049771e 100644
--- a/src/mod_pubsub/mod_pubsub.erl
+++ b/src/mod_pubsub/mod_pubsub.erl
@@ -3621,8 +3621,9 @@ itemsEls(Items) ->
        {xmlelement, "item", itemAttr(ItemId), Payload}
     end, Items).

-add_headers({xmlelement, Name, Attrs, Els}, Headers) ->
-    {xmlelement, Name, Attrs, Els ++ Headers}.
+add_headers({xmlelement, Name, Attrs, Els}, HeaderEls) ->
+    HeaderEl = {xmlelement, "headers", [{"xmlns", ?NS_SHIM}], HeaderEls},
+    {xmlelement, Name, Attrs, [HeaderEl | Els]}.

 collection_shim(Node, Nodes) ->
     [{xmlelement, "header", [{"name", "Collection"}],

it works

Thank you, it works just fine for me, I think you can submit the patch.

Ok, patch applied to SVN.

Ok, patch applied to SVN.

Syndicate content