componentmanager: Add events object to registered components if they don't already have one
authorMatthew Wild <mwild1@gmail.com>
Sun, 31 May 2009 21:36:12 +0100
changeset 1257 8c9f20d3a17f
parent 1256 98f0e9eadf3b
child 1258 01b69efffb1c
componentmanager: Add events object to registered components if they don't already have one
core/componentmanager.lua
--- 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);