Changeset

2624:99b60dc15174

stanza_router: Fire /self events for stanzas users send to their own bare JID.
author Waqas Hussain <waqas20@gmail.com>
date Sat, 13 Feb 2010 02:55:24 +0500
parents 2623:1d34b45dec15
children 2625:03287c06d986
files core/stanza_router.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/core/stanza_router.lua	Fri Feb 12 21:33:22 2010 +0000
+++ b/core/stanza_router.lua	Sat Feb 13 02:55:24 2010 +0500
@@ -124,7 +124,7 @@
 	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';
@@ -132,6 +132,7 @@
 			to_type = '/bare';
 			if node == origin.username and host == origin.host then
 				stanza.attr.to = nil;
+				to_self = true;
 			end
 		end
 	else
@@ -149,6 +150,7 @@
 	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);