mod_proxy65: Use "iq/host" event for hooking stanzas instead of the component stanza handler.
authorWaqas Hussain <waqas20@gmail.com>
Thu, 04 Nov 2010 19:18:32 +0500
changeset 3558 f1201ff060b7
parent 3557 58ab7e61d220
child 3559 0708d42ef0d4
mod_proxy65: Use "iq/host" event for hooking stanzas instead of the component stanza handler.
plugins/mod_proxy65.lua
--- a/plugins/mod_proxy65.lua	Thu Nov 04 18:44:57 2010 +0500
+++ b/plugins/mod_proxy65.lua	Thu Nov 04 19:18:32 2010 +0500
@@ -207,7 +207,8 @@
 	return reply, from, to, sid;
 end
 
-function handle_to_domain(origin, stanza)
+function handle_to_domain(event)
+	local origin, stanza = event.origin, event.stanza;
 	local to_node, to_host, to_resource = jid_split(stanza.attr.to);
 	if to_node == nil then
 		local type = stanza.attr.type;
@@ -256,6 +257,7 @@
 	end
 	return;
 end
+module:hook("iq/host", handle_to_domain);
 
 if not connlisteners.register(module.host .. ':proxy65', connlistener) then
 	module:log("error", "mod_proxy65: Could not establish a connection listener. Check your configuration please.");
@@ -263,4 +265,4 @@
 end
 
 connlisteners.start(module.host .. ':proxy65');
-component = componentmanager.register_component(host, handle_to_domain);
+component = componentmanager.register_component(host, function() end);