core/componentmanager.lua

Wed, 10 Nov 2010 20:51:23 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Wed, 10 Nov 2010 20:51:23 +0500
changeset 3603
fdc671381411
parent 3602
a977d8be6277
permissions
-rw-r--r--

componentmanager: Removed most of the code. Stub implementations of register_component and deregister_component remain.

-- Prosody IM
-- Copyright (C) 2008-2010 Matthew Wild
-- Copyright (C) 2008-2010 Waqas Hussain
-- 
-- This project is MIT/X11 licensed. Please see the
-- COPYING file in the source package for more information.
--

local log = require "util.logger".init("componentmanager");
local prosody, hosts = prosody, prosody.hosts;

local components = {};

module "componentmanager"

function register_component(host, component)
	if hosts[host] and hosts[host].type == 'component' then
		components[host] = component;
		log("debug", "component added: "..host);
		return hosts[host];
	else
		log("error", "Attempt to set component for existing host: "..host);
	end
end

function deregister_component(host)
	if components[host] then
		components[host] = nil;
		log("debug", "component removed: "..host);
		return true;
	else
		log("error", "Attempt to remove component for non-existing host: "..host);
	end
end

return _M;

mercurial