Mercurial > prosody-hg
comparison plugins/mod_pubsub/pubsub.lib.lua @ 9032:029e1e18d65c
mod_pubsub: Add support for owner subscription retrieval
https://xmpp.org/extensions/xep-0060.html#owner-subscriptions-retrieve
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 13 Jul 2018 04:42:19 +0200 |
| parents | 935e5ca43792 |
| children | f1b6efd5b379 |
comparison
equal
deleted
inserted
replaced
| 9031:d1a4b1b78695 | 9032:029e1e18d65c |
|---|---|
| 248 end | 248 end |
| 249 origin.send(reply); | 249 origin.send(reply); |
| 250 return true; | 250 return true; |
| 251 end | 251 end |
| 252 | 252 |
| 253 function handlers.owner_get_subscriptions(origin, stanza, subscriptions, service) | |
| 254 local node = subscriptions.attr.node; | |
| 255 local ok, ret = service:get_subscriptions(node, stanza.attr.from); | |
| 256 if not ok then | |
| 257 origin.send(pubsub_error_reply(stanza, ret)); | |
| 258 return true; | |
| 259 end | |
| 260 local reply = st.reply(stanza) | |
| 261 :tag("pubsub", { xmlns = xmlns_pubsub_owner }) | |
| 262 :tag("subscriptions"); | |
| 263 for _, sub in ipairs(ret) do | |
| 264 reply:tag("subscription", { node = sub.node, jid = sub.jid, subscription = 'subscribed' }):up(); | |
| 265 end | |
| 266 origin.send(reply); | |
| 267 return true; | |
| 268 end | |
| 269 | |
| 253 function handlers.set_create(origin, stanza, create, service) | 270 function handlers.set_create(origin, stanza, create, service) |
| 254 local node = create.attr.node; | 271 local node = create.attr.node; |
| 255 local ok, ret, reply; | 272 local ok, ret, reply; |
| 256 local config; | 273 local config; |
| 257 local configure = stanza.tags[1]:get_child("configure"); | 274 local configure = stanza.tags[1]:get_child("configure"); |
