From f9a8d01543ed2a8ed49ffcf4e9c3f24565a26bdd Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 30 Sep 2009 11:05:01 +0100 Subject: componentmanager: Preserve existing events table (if any) when registering a component --- core/componentmanager.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/componentmanager.lua') diff --git a/core/componentmanager.lua b/core/componentmanager.lua index 208f42e4..34f97c25 100644 --- a/core/componentmanager.lua +++ b/core/componentmanager.lua @@ -83,9 +83,9 @@ function handle_stanza(origin, stanza) end end -function create_component(host, component) +function create_component(host, component, events) -- TODO check for host well-formedness - return { type = "component", host = host, connected = true, s2sout = {}, events = events_new() }; + return { type = "component", host = host, connected = true, s2sout = {}, events = events or events_new() }; end function register_component(host, component, session) @@ -93,7 +93,7 @@ function register_component(host, component, session) local old_events = hosts[host] and hosts[host].events; components[host] = component; - hosts[host] = session or create_component(host, component); + hosts[host] = session or create_component(host, component, old_events); -- Add events object if not already one if not hosts[host].events then -- cgit v1.2.3