aboutsummaryrefslogtreecommitdiffstats
path: root/core/stanza_router.lua
diff options
context:
space:
mode:
Diffstat (limited to 'core/stanza_router.lua')
-rw-r--r--core/stanza_router.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/stanza_router.lua b/core/stanza_router.lua
index 7ebfb2bb..d6dd5306 100644
--- a/core/stanza_router.lua
+++ b/core/stanza_router.lua
@@ -123,7 +123,7 @@ function core_post_stanza(origin, stanza, preevents)
local node, host, resource = jid_split(to);
local to_bare = node and (node.."@"..host) or host; -- bare JID
- local to_type;
+ local to_type, to_self;
if node then
if resource then
to_type = '/full';
@@ -131,6 +131,7 @@ function core_post_stanza(origin, stanza, preevents)
to_type = '/bare';
if node == origin.username and host == origin.host then
stanza.attr.to = nil;
+ to_self = true;
end
end
else
@@ -138,6 +139,7 @@ function core_post_stanza(origin, stanza, preevents)
to_type = '/host';
else
to_type = '/bare';
+ to_self = true;
end
end
@@ -148,6 +150,7 @@ function core_post_stanza(origin, stanza, preevents)
local h = hosts[to_bare] or hosts[host or origin.host];
if h then
if h.events.fire_event(stanza.name..to_type, event_data) then return; end -- do processing
+ if to_self and h.events.fire_event(stanza.name..'/self', event_data) then return; end -- do processing
if h.type == "component" then
component_handle_stanza(origin, stanza);
@@ -179,7 +182,7 @@ function core_route_stanza(origin, stanza)
local xmlns = stanza.attr.xmlns;
--stanza.attr.xmlns = "jabber:server";
stanza.attr.xmlns = nil;
- log("debug", "sending s2s stanza: %s", tostring(stanza));
+ log("debug", "sending s2s stanza: %s", tostring(stanza.top_tag and stanza:top_tag()) or stanza);
send_s2s(origin.host, host, stanza); -- TODO handle remote routing errors
stanza.attr.xmlns = xmlns; -- reset
else