Changeset

1261:497178e0ddbe

Automated merge with http://waqas.ath.cx:8000/
author Matthew Wild <mwild1@gmail.com>
date Mon, 01 Jun 2009 01:36:42 +0100
parents 1260:04c1fae0eb03 (current diff) 1258:01b69efffb1c (diff)
children 1263:7797354dc9b5
files
diffstat 3 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/core/componentmanager.lua	Mon Jun 01 05:35:32 2009 +0500
+++ b/core/componentmanager.lua	Mon Jun 01 01:36:42 2009 +0100
@@ -89,6 +89,12 @@
 	if not hosts[host] or (hosts[host].type == 'component' and not hosts[host].connected) then
 		components[host] = component;
 		hosts[host] = session or create_component(host, component);
+		
+		-- Add events object if not already one
+		if not hosts[host].events then
+			hosts[host].events = events_new();
+		end
+		
 		-- add to disco_items
 		if not(host:find("@", 1, true) or host:find("/", 1, true)) and host:find(".", 1, true) then
 			disco_items:set(host:sub(host:find(".", 1, true)+1), host, true);
--- a/core/stanza_router.lua	Mon Jun 01 05:35:32 2009 +0500
+++ b/core/stanza_router.lua	Mon Jun 01 01:36:42 2009 +0100
@@ -127,7 +127,7 @@
 			else
 				event = "stanza/"..stanza.attr.xmlns..":"..stanza.name;
 			end
-			if h.events.fire_event(event, {origin = origin, stanza = stanza}) then return; end
+			if (h.events or prosody.events).fire_event(event, {origin = origin, stanza = stanza}) then return; end
 		end
 		modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza);
 	end
@@ -155,7 +155,7 @@
 
 	local event_data = {origin=origin, stanza=stanza};
 	if origin.full_jid then -- c2s connection
-		if hosts[origin.host].events.fire_event('pre-'..stanza.name..to_type, event_data) then return; end -- do preprocessing
+		if (hosts[origin.host].events or prosody.events).fire_event('pre-'..stanza.name..to_type, event_data) then return; end -- do preprocessing
 	end
 	local h = hosts[to_bare] or hosts[host or origin.host];
 	if h then
@@ -163,11 +163,8 @@
 			component_handle_stanza(origin, stanza);
 			return;
 		else
-			if h.events.fire_event(stanza.name..to_type, event_data) then return; end -- do processing
+			if (h.events or prosody.events).fire_event(stanza.name..to_type, event_data) then return; end -- do processing
 		end
-	else -- non-local recipient
-		core_route_stanza(origin, stanza);
-		return;
 	end
 
 	if host and fire_event(host.."/"..stanza.name, event_data) then
--- a/net/xmppclient_listener.lua	Mon Jun 01 05:35:32 2009 +0500
+++ b/net/xmppclient_listener.lua	Mon Jun 01 01:36:42 2009 +0100
@@ -115,6 +115,7 @@
 		
 		session.log("info", "Client connected");
 		
+		-- Client is using legacy SSL (otherwise mod_tls sets this flag)
 		if conn.ssl() then
 			session.secure = true;
 		end