Mercurial > prosody-hg
comparison 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 |
| parents | fa48e69c4786 |
| children | 498293bce4bf |
comparison
equal
deleted
inserted
replaced
| 1256:98f0e9eadf3b | 1257:8c9f20d3a17f |
|---|---|
| 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 |
