Diff

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
parent 8328:29ef191c7bf9
child 8337:dc4ea43ac463
line wrap: on
line diff
--- a/plugins/mod_pubsub/mod_pubsub.lua	Tue Oct 17 05:47:06 2017 +0200
+++ b/plugins/mod_pubsub/mod_pubsub.lua	Wed Oct 18 07:46:44 2017 +0200
@@ -24,18 +24,7 @@
 module:add_feature("http://jabber.org/protocol/pubsub");
 
 function handle_pubsub_iq(event)
-	local origin, stanza = event.origin, event.stanza;
-	local pubsub_tag = stanza.tags[1];
-	local action = pubsub_tag.tags[1];
-	if not action then
-		origin.send(st.error_reply(stanza, "cancel", "bad-request"));
-		return true;
-	end
-	local handler = handlers[stanza.attr.type.."_"..action.name];
-	if handler then
-		handler(origin, stanza, action, service);
-		return true;
-	end
+	return lib_pubsub.handle_pubsub_iq(event, service);
 end
 
 local function simple_itemstore(config, node)