aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-04-15 02:10:05 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-04-15 02:10:05 +0500
commit287a14959e846e9140cabc8a4c3402d505ea80e4 (patch)
tree497d12d4c0e36865c56e333835906c00da5a73fb /core
parent55adc40b43053a63bc33bb26396e8c5eb0680eb8 (diff)
downloadprosody-287a14959e846e9140cabc8a4c3402d505ea80e4.tar.gz
prosody-287a14959e846e9140cabc8a4c3402d505ea80e4.zip
core/eventmanager2 - new event manager
Diffstat (limited to 'core')
-rw-r--r--core/eventmanager2.lua6
-rw-r--r--core/stanza_router.lua3
2 files changed, 9 insertions, 0 deletions
diff --git a/core/eventmanager2.lua b/core/eventmanager2.lua
new file mode 100644
index 00000000..4783d0a9
--- /dev/null
+++ b/core/eventmanager2.lua
@@ -0,0 +1,6 @@
+
+local events = require "util.events".new();
+
+module "eventmanager"
+
+return events;
diff --git a/core/stanza_router.lua b/core/stanza_router.lua
index 08224c8d..7d3b50b5 100644
--- a/core/stanza_router.lua
+++ b/core/stanza_router.lua
@@ -40,6 +40,7 @@ local ipairs = ipairs;
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 @@ function core_process_stanza(origin, stanza)
-- 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?