ejabberd - Comments for "PubSub : missing tag when configuring subscription option" https://www.ejabberd.im/node/3637 en Ok, I've committed that last https://www.ejabberd.im/node/3637#comment-54611 <p>Ok, I've committed that last patch to SVN.</p> Tue, 01 Sep 2009 08:22:13 +0000 mfoss comment 54611 at https://www.ejabberd.im We are almost there. This one https://www.ejabberd.im/node/3637#comment-54609 <p>We are almost there.</p> <p>This one works for me:</p> <pre> @@ -2464,9 +2464,15 @@ {error, notfound} -&gt; {error, ?ERR_EXTENDED(?ERR_NOT_ACCEPTABLE, "invalid-subid")}; {result, #pubsub_subscription{options = Options}} -&gt; - pubsub_subscription:get_options_xform(Lang, Options) + {result, XdataEl} = pubsub_subscription:get_options_xform(Lang, Options), + [N] = mnesia:dirty_match_object({pubsub_node,'_',NodeID,'_','_','_','_'}), + {_,Node} = N#pubsub_node.nodeid, + NodeIDStr = node_to_string(Node), + SubscriberStr = jlib:jid_to_string(Subscriber), + OptionsEl = {xmlelement, "options", [{"node", NodeIDStr}, {"jid", SubscriberStr}, {"subid", SubID}], [XdataEl]}, + PubsubEl = {xmlelement, "pubsub", [{"xmlns", ?NS_PUBSUB}], [OptionsEl]}, + {result, PubsubEl} end. - set_options(Host, Node, JID, SubID, Configuration) -&gt; Action = fun(#pubsub_node{type = Type, id = NodeID}) -&gt; case lists:member("subscription-options", features(Type)) of </pre><p> Please note that pubsub_subscription:get_options_xform return a tuple {result, xmlelement}, and read_sub should also return a tuple.</p> Mon, 31 Aug 2009 13:03:39 +0000 clochix comment 54609 at https://www.ejabberd.im Can you try this patch? It https://www.ejabberd.im/node/3637#comment-54605 <p>Can you try this patch? It includes your improvements and the NodeID string. Again, I didn't test it.</p> <pre> --- a/src/mod_pubsub/mod_pubsub.erl +++ b/src/mod_pubsub/mod_pubsub.erl @@ -2464,7 +2464,13 @@ read_sub(Subscriber, NodeID, SubID, Lang) -&gt; {error, notfound} -&gt; {error, ?ERR_EXTENDED(?ERR_NOT_ACCEPTABLE, "invalid-subid")}; {result, #pubsub_subscription{options = Options}} -&gt; - pubsub_subscription:get_options_xform(Lang, Options) + XdataEl = pubsub_subscription:get_options_xform(Lang, Options), + [N] = mnesia:dirty_match_object({pubsub_node,'_',NodeID,'_','_','_','_'}), + {'_',NodeIDStr} = N#pubsub_node.nodeid, + SubscriberStr = jlib:jid_to_string(Subscriber), + OptionsEl = {xmlelement, "options", [{"node", NodeIDStr}, {"jid", SubscriberStr}, {"subid", SubID}], [XdataEl]}, + PubsubEl = {xmlelement, "pubsub", [{"xmlns", ?NS_PUBSUB}], [OptionsEl]}, + PubsubEl end. set_options(Host, Node, JID, SubID, Configuration) -&gt; </pre> Mon, 31 Aug 2009 10:52:45 +0000 mfoss comment 54605 at https://www.ejabberd.im Another try https://www.ejabberd.im/node/3637#comment-54604 <p>Thanks. Actually, it didn't work and throw an error.</p> <p>Here's another try :</p> <pre> @@ -2464,9 +2464,11 @@ {error, notfound} -&gt; {error, ?ERR_EXTENDED(?ERR_NOT_ACCEPTABLE, "invalid-subid")}; {result, #pubsub_subscription{options = Options}} -&gt; - pubsub_subscription:get_options_xform(Lang, Options) + {result, XdataEl} = pubsub_subscription:get_options_xform(Lang, Options), + OptionsEl = {xmlelement, "options", [{"jid", jlib:jid_to_string(Subscriber)}, {"subid", SubID}], [XdataEl]}, + PubsubEl = {xmlelement, "pubsub", [{"xmlns", ?NS_PUBSUB}], [OptionsEl]}, + {result, PubsubEl} end. </pre><p> The node attribute is missing, I don't know how to convert from NodeID to a node name.</p> Mon, 31 Aug 2009 00:01:48 +0000 clochix comment 54604 at https://www.ejabberd.im Here is a small patch for https://www.ejabberd.im/node/3637#comment-54602 <p>Here is a small patch for ejabberd trunk SVN that I've written following your description:</p> <pre> --- a/src/mod_pubsub/mod_pubsub.erl +++ b/src/mod_pubsub/mod_pubsub.erl @@ -2464,7 +2464,10 @@ read_sub(Subscriber, NodeID, SubID, Lang) -&gt; {error, notfound} -&gt; {error, ?ERR_EXTENDED(?ERR_NOT_ACCEPTABLE, "invalid-subid")}; {result, #pubsub_subscription{options = Options}} -&gt; - pubsub_subscription:get_options_xform(Lang, Options) + XdataEl = pubsub_subscription:get_options_xform(Lang, Options), + OptionsEl = {xmlelement, "options", [{"node", NodeID}, {"jid", Subscriber}], [XdataEl]}, + PubsubEl = {xmlelement, "pubsub", [{"xmlns", ?NS_PUBSUB}], [OptionsEl]}, + PubsubEl end. set_options(Host, Node, JID, SubID, Configuration) -&gt; </pre><p> I didn't try it and I am not mod_pubsub expert.</p> <p>If you try it, please comment if it solves the problem completely or not.</p> Sun, 30 Aug 2009 19:21:22 +0000 mfoss comment 54602 at https://www.ejabberd.im