Diff

core/componentmanager.lua @ 1257:8c9f20d3a17f

componentmanager: Add events object to registered components if they don't already have one
author Matthew Wild <mwild1@gmail.com>
date Sun, 31 May 2009 21:36:12 +0100
parent 1188:fa48e69c4786
child 1264:498293bce4bf
line wrap: on
line diff
--- a/core/componentmanager.lua	Sun May 31 21:35:21 2009 +0100
+++ b/core/componentmanager.lua	Sun May 31 21:36:12 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);