Mercurial > prosody-hg
comparison plugins/mod_pubsub/mod_pubsub.lua @ 8334:036e46d12b78
mod_pubsub: Move dispatch function into pubsub.lib
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 18 Oct 2017 07:46:44 +0200 |
| parents | 29ef191c7bf9 |
| children | dc4ea43ac463 |
comparison
equal
deleted
inserted
replaced
| 8333:2abbb01cd756 | 8334:036e46d12b78 |
|---|---|
| 22 module:depends("disco"); | 22 module:depends("disco"); |
| 23 module:add_identity("pubsub", "service", pubsub_disco_name); | 23 module:add_identity("pubsub", "service", pubsub_disco_name); |
| 24 module:add_feature("http://jabber.org/protocol/pubsub"); | 24 module:add_feature("http://jabber.org/protocol/pubsub"); |
| 25 | 25 |
| 26 function handle_pubsub_iq(event) | 26 function handle_pubsub_iq(event) |
| 27 local origin, stanza = event.origin, event.stanza; | 27 return lib_pubsub.handle_pubsub_iq(event, service); |
| 28 local pubsub_tag = stanza.tags[1]; | |
| 29 local action = pubsub_tag.tags[1]; | |
| 30 if not action then | |
| 31 origin.send(st.error_reply(stanza, "cancel", "bad-request")); | |
| 32 return true; | |
| 33 end | |
| 34 local handler = handlers[stanza.attr.type.."_"..action.name]; | |
| 35 if handler then | |
| 36 handler(origin, stanza, action, service); | |
| 37 return true; | |
| 38 end | |
| 39 end | 28 end |
| 40 | 29 |
| 41 local function simple_itemstore(config, node) | 30 local function simple_itemstore(config, node) |
| 42 local archive = module:open_store("pubsub_"..node, "archive"); | 31 local archive = module:open_store("pubsub_"..node, "archive"); |
| 43 return lib_pubsub.archive_itemstore(archive, config, nil, node); | 32 return lib_pubsub.archive_itemstore(archive, config, nil, node); |
