20 |
20 |
21 |
21 |
22 |
22 |
23 local log = require "util.logger".init("componentmanager"); |
23 local log = require "util.logger".init("componentmanager"); |
24 local module_load = require "core.modulemanager".load; |
24 local module_load = require "core.modulemanager".load; |
|
25 local module_unload = require "core.modulemanager".unload; |
25 local jid_split = require "util.jid".split; |
26 local jid_split = require "util.jid".split; |
26 local hosts = hosts; |
27 local hosts = hosts; |
27 |
28 |
28 local components = {}; |
29 local components = {}; |
29 |
30 |
55 else |
56 else |
56 log("error", "Attempt to set component for existing host: "..host); |
57 log("error", "Attempt to set component for existing host: "..host); |
57 end |
58 end |
58 end |
59 end |
59 |
60 |
|
61 function deregister_component(host, component) |
|
62 if components[host] then |
|
63 module_unload(host, "dialback"); |
|
64 components[host] = nil; |
|
65 hosts[host] = nil; |
|
66 log("debug", "component removed: "..host); |
|
67 return true; |
|
68 else |
|
69 log("error", "Attempt to remove component for non-existing host: "..host); |
|
70 end |
|
71 end |
|
72 |
60 return _M; |
73 return _M; |