Mercurial > prosody-hg
comparison plugins/mod_pubsub/pubsub.lib.lua @ 8826:d614003a82c1
mod_pubsub: Add support for parsing subscription options form (no options supported yet)
This was actually to silence luacheck warnings options andoptions_tag
variables.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 23 May 2018 18:15:36 +0200 |
| parents | 7270258fec77 |
| children | 12a9731aef0b |
comparison
equal
deleted
inserted
replaced
| 8825:7270258fec77 | 8826:d614003a82c1 |
|---|---|
| 66 { label = "Messages of type headline", value = "headline", default = true }, | 66 { label = "Messages of type headline", value = "headline", default = true }, |
| 67 }; | 67 }; |
| 68 }; | 68 }; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 local options_form = dataform { | |
| 72 { | |
| 73 type = "hidden"; | |
| 74 name = "FORM_TYPE"; | |
| 75 value = "http://jabber.org/protocol/pubsub#subscribe_options"; | |
| 76 } | |
| 77 -- No options yet. File a feature request ;) | |
| 78 }; | |
| 79 | |
| 71 local service_method_feature_map = { | 80 local service_method_feature_map = { |
| 72 add_subscription = { "subscribe" }; | 81 add_subscription = { "subscribe" }; |
| 73 create = { "create-nodes", "instant-nodes", "item-ids", "create-and-configure" }; | 82 create = { "create-nodes", "instant-nodes", "item-ids", "create-and-configure" }; |
| 74 delete = { "delete-nodes" }; | 83 delete = { "delete-nodes" }; |
| 75 get_items = { "retrieve-items" }; | 84 get_items = { "retrieve-items" }; |
| 251 local node, jid = subscribe.attr.node, subscribe.attr.jid; | 260 local node, jid = subscribe.attr.node, subscribe.attr.jid; |
| 252 if not (node and jid) then | 261 if not (node and jid) then |
| 253 origin.send(pubsub_error_reply(stanza, jid and "nodeid-required" or "invalid-jid")); | 262 origin.send(pubsub_error_reply(stanza, jid and "nodeid-required" or "invalid-jid")); |
| 254 return true; | 263 return true; |
| 255 end | 264 end |
| 256 --[[ | |
| 257 local options_tag, options = stanza.tags[1]:get_child("options"), nil; | 265 local options_tag, options = stanza.tags[1]:get_child("options"), nil; |
| 258 if options_tag then | 266 if options_tag then |
| 259 options = options_form:data(options_tag.tags[1]); | 267 options = options_form:data(options_tag.tags[1]); |
| 260 end | 268 end |
| 261 --]] | |
| 262 local options_tag, options; -- FIXME | |
| 263 local ok, ret = service:add_subscription(node, stanza.attr.from, jid, options); | 269 local ok, ret = service:add_subscription(node, stanza.attr.from, jid, options); |
| 264 local reply; | 270 local reply; |
| 265 if ok then | 271 if ok then |
| 266 reply = st.reply(stanza) | 272 reply = st.reply(stanza) |
| 267 :tag("pubsub", { xmlns = xmlns_pubsub }) | 273 :tag("pubsub", { xmlns = xmlns_pubsub }) |
