Software / code / prosody
Comparison
core/componentmanager.lua @ 673:c9bc58e84e96
componentmanager: Added support for component deregistering
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Wed, 07 Jan 2009 20:02:49 +0500 |
| parent | 638:1915c64c9436 |
| child | 703:f9909efed20c |
comparison
equal
deleted
inserted
replaced
| 671:c7519f0c9a2c | 673:c9bc58e84e96 |
|---|---|
| 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; |