plugins/mod_proxy65.lua
changeset 3558 f1201ff060b7
parent 3377 9328179c9c76
child 3559 0708d42ef0d4
equal deleted inserted replaced
3557:58ab7e61d220 3558:f1201ff060b7
   205 		reply.attr.id = stanza.attr.id;
   205 		reply.attr.id = stanza.attr.id;
   206 	end
   206 	end
   207 	return reply, from, to, sid;
   207 	return reply, from, to, sid;
   208 end
   208 end
   209 
   209 
   210 function handle_to_domain(origin, stanza)
   210 function handle_to_domain(event)
       
   211 	local origin, stanza = event.origin, event.stanza;
   211 	local to_node, to_host, to_resource = jid_split(stanza.attr.to);
   212 	local to_node, to_host, to_resource = jid_split(stanza.attr.to);
   212 	if to_node == nil then
   213 	if to_node == nil then
   213 		local type = stanza.attr.type;
   214 		local type = stanza.attr.type;
   214 		if type == "error" or type == "result" then return; end
   215 		if type == "error" or type == "result" then return; end
   215 		if stanza.name == "iq" and type == "get" then
   216 		if stanza.name == "iq" and type == "get" then
   254 			end
   255 			end
   255 		end
   256 		end
   256 	end
   257 	end
   257 	return;
   258 	return;
   258 end
   259 end
       
   260 module:hook("iq/host", handle_to_domain);
   259 
   261 
   260 if not connlisteners.register(module.host .. ':proxy65', connlistener) then
   262 if not connlisteners.register(module.host .. ':proxy65', connlistener) then
   261 	module:log("error", "mod_proxy65: Could not establish a connection listener. Check your configuration please.");
   263 	module:log("error", "mod_proxy65: Could not establish a connection listener. Check your configuration please.");
   262 	module:log("error", "Possibly two proxy65 components are configured to share the same port.");
   264 	module:log("error", "Possibly two proxy65 components are configured to share the same port.");
   263 end
   265 end
   264 
   266 
   265 connlisteners.start(module.host .. ':proxy65');
   267 connlisteners.start(module.host .. ':proxy65');
   266 component = componentmanager.register_component(host, handle_to_domain);
   268 component = componentmanager.register_component(host, function() end);