core/stanza_router.lua

changeset 1254
c199be608546
parent 1244
3df7417225fe
child 1256
98f0e9eadf3b
--- a/core/stanza_router.lua	Sun May 31 01:17:19 2009 +0500
+++ b/core/stanza_router.lua	Sun May 31 02:20:30 2009 +0500
@@ -115,6 +115,20 @@
 		end
 		core_post_stanza(origin, stanza);
 	else
+		local h = hosts[stanza.attr.to or origin.host or origin.to_host];
+		if h then
+			local event;
+			if stanza.attr.xmlns == "jabber:client" then
+				if stanza.name == "iq" and (stanza.attr.type == "set" or stanza.attr.type == "get") then
+					event = "stanza/iq/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name;
+				else
+					event = "stanza/"..stanza.name;
+				end
+			else
+				event = "stanza/"..stanza.attr.xmlns..":"..stanza.name;
+			end
+			if h.events.fire_event(event, {origin = origin, stanza = stanza}) then return; end
+		end
 		modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza);
 	end
 end

mercurial