X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=core%2Fstanza_router.lua;h=d6dd53062d655ae59768b097a0c9b71d7c6d1a5e;hb=18f2f57edc0b7caf9be451a43c00a9d1147dfd63;hp=7ebfb2bb167bce1ad1d71c741158a90938992f89;hpb=f22e235217e21484315f8e735722f0a3cbc6fb4d;p=prosody.git 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