# HG changeset patch # User Waqas Hussain # Date 1239743405 -18000 # Node ID da7691ebec9cd98e459d8b11faa03be8964abcd5 # Parent c81b6141d6936ffb5ef33d2265af32e6886d11db core/eventmanager2 - new event manager diff -r c81b6141d693 -r da7691ebec9c core/eventmanager2.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/eventmanager2.lua Wed Apr 15 02:10:05 2009 +0500 @@ -0,0 +1,6 @@ + +local events = require "util.events".new(); + +module "eventmanager" + +return events; diff -r c81b6141d693 -r da7691ebec9c core/stanza_router.lua --- a/core/stanza_router.lua Sun Apr 12 19:05:55 2009 +0100 +++ b/core/stanza_router.lua Wed Apr 15 02:10:05 2009 +0500 @@ -40,6 +40,7 @@ local jid_split = require "util.jid".split; local jid_prepped_split = require "util.jid".prepped_split; local print = print; +local fire_event = require "core.eventmanager2".fire_event; local function checked_error_reply(origin, stanza) if (stanza.attr.xmlns == "jabber:client" or stanza.attr.xmlns == "jabber:server") and stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error? @@ -100,6 +101,8 @@ -- FIXME do stanzas not of jabber:client get handled by components? if (origin.type == "s2sin" or origin.type == "c2s" or origin.type == "component") and (not xmlns or xmlns == "jabber:server" or xmlns == "jabber:client") then + local event_data = {origin=origin, stanza=stanza}; + fire_event(tostring(host or origin.host).."/"..stanza.name, event_data); if origin.type == "s2sin" and not origin.dummy then local host_status = origin.hosts[from_host]; if not host_status or not host_status.authed then -- remote server trying to impersonate some other server?