aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub/pubsub.lib.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-10-18 07:46:44 +0200
committerKim Alvefur <zash@zash.se>2017-10-18 07:46:44 +0200
commit0e1cdb6a2aab36c3661d9d8b15364194dd9a580b (patch)
tree21c05789f1465477176834281f5f53f43861b25b /plugins/mod_pubsub/pubsub.lib.lua
parent54944ff8077fcbbbf2e2ca10810def39c93fdc59 (diff)
downloadprosody-0e1cdb6a2aab36c3661d9d8b15364194dd9a580b.tar.gz
prosody-0e1cdb6a2aab36c3661d9d8b15364194dd9a580b.zip
mod_pubsub: Move dispatch function into pubsub.lib
Diffstat (limited to 'plugins/mod_pubsub/pubsub.lib.lua')
-rw-r--r--plugins/mod_pubsub/pubsub.lib.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua
index 829c4833..5d173e4f 100644
--- a/plugins/mod_pubsub/pubsub.lib.lua
+++ b/plugins/mod_pubsub/pubsub.lib.lua
@@ -53,6 +53,20 @@ local node_config_form = dataform {
};
};
+function _M.handle_pubsub_iq(event, service)
+ local origin, stanza = event.origin, event.stanza;
+ local pubsub_tag = stanza.tags[1];
+ local action = pubsub_tag.tags[1];
+ if not action then
+ return origin.send(st.error_reply(stanza, "cancel", "bad-request"));
+ end
+ local handler = handlers[stanza.attr.type.."_"..action.name];
+ if handler then
+ handler(origin, stanza, action, service);
+ return true;
+ end
+end
+
function handlers.get_items(origin, stanza, items, service)
local node = items.attr.node;
local item = items:get_child("item");