diff options
Diffstat (limited to 'plugins/mod_pubsub')
-rw-r--r-- | plugins/mod_pubsub/pubsub.lib.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua index 5cabdf00..5bebbeba 100644 --- a/plugins/mod_pubsub/pubsub.lib.lua +++ b/plugins/mod_pubsub/pubsub.lib.lua @@ -433,6 +433,26 @@ function handlers.set_unsubscribe(origin, stanza, unsubscribe, service) return true; end +function handlers.get_options(origin, stanza, options, service) + local node, jid = options.attr.node, options.attr.jid; + jid = jid_prep(jid); + if not (node and jid) then + origin.send(pubsub_error_reply(stanza, jid and "nodeid-required" or "invalid-jid")); + return true; + end + local ok, ret = service:get_subscription(node, stanza.attr.from, jid); + if not ok then + origin.send(pubsub_error_reply(stanza, "not-subscribed")); + return true; + end + if ret == true then ret = {} end + origin.send(st.reply(stanza) + :tag("pubsub", { xmlns = xmlns_pubsub }) + :tag("options", { node = node, jid = jid }) + :add_child(options_form:form(ret))); + return true; +end + function handlers.set_publish(origin, stanza, publish, service) local node = publish.attr.node; if not node then |