aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2011-08-14 13:36:54 -0400
committerMatthew Wild <mwild1@gmail.com>2011-08-14 13:36:54 -0400
commit58a066414d0174a0e69aa37d405f384d76810dc6 (patch)
treecebb5fc0e67d588fb33b77c636421203644cbb34
parentbc2d1fe944f50bf73730aaff0e682a50c8223236 (diff)
downloadprosody-58a066414d0174a0e69aa37d405f384d76810dc6.tar.gz
prosody-58a066414d0174a0e69aa37d405f384d76810dc6.zip
mod_pubsub: Handle options tag in subscription request (currently doesn't work as options_form is not defined)
-rw-r--r--plugins/mod_pubsub.lua11
1 files changed, 9 insertions, 2 deletions
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