87 |
87 |
88 function register_component(host, component, session) |
88 function register_component(host, component, session) |
89 if not hosts[host] or (hosts[host].type == 'component' and not hosts[host].connected) then |
89 if not hosts[host] or (hosts[host].type == 'component' and not hosts[host].connected) then |
90 components[host] = component; |
90 components[host] = component; |
91 hosts[host] = session or create_component(host, component); |
91 hosts[host] = session or create_component(host, component); |
|
92 |
|
93 -- Add events object if not already one |
|
94 if not hosts[host].events then |
|
95 hosts[host].events = events_new(); |
|
96 end |
|
97 |
92 -- add to disco_items |
98 -- add to disco_items |
93 if not(host:find("@", 1, true) or host:find("/", 1, true)) and host:find(".", 1, true) then |
99 if not(host:find("@", 1, true) or host:find("/", 1, true)) and host:find(".", 1, true) then |
94 disco_items:set(host:sub(host:find(".", 1, true)+1), host, true); |
100 disco_items:set(host:sub(host:find(".", 1, true)+1), host, true); |
95 end |
101 end |
96 -- FIXME only load for a.b.c if b.c has dialback, and/or check in config |
102 -- FIXME only load for a.b.c if b.c has dialback, and/or check in config |