From 58a066414d0174a0e69aa37d405f384d76810dc6 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sun, 14 Aug 2011 13:36:54 -0400 Subject: mod_pubsub: Handle options tag in subscription request (currently doesn't work as options_form is not defined) --- plugins/mod_pubsub.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_pubsub.lua b/plugins/mod_pubsub.lua index fd307583..d5c14605 100644 --- a/plugins/mod_pubsub.lua +++ b/plugins/mod_pubsub.lua @@ -110,7 +110,11 @@ end function handlers.set_subscribe(origin, stanza, subscribe) local node, jid = subscribe.attr.node, subscribe.attr.jid; - local ok, ret = service:add_subscription(node, stanza.attr.from, jid); + local options_tag, options = stanza.tags[1]:get_child("options"), nil; + if options_tag then + options = options_form:data(options_tag.tags[1]); + end + local ok, ret = service:add_subscription(node, stanza.attr.from, jid, options); local reply; if ok then reply = st.reply(stanza) @@ -119,7 +123,10 @@ function handlers.set_subscribe(origin, stanza, subscribe) node = node, jid = jid, subscription = "subscribed" - }); + }):up(); + if options_tag then + reply:add_child(options_tag); + end else reply = pubsub_error_reply(stanza, ret); end -- cgit v1.2.3