Diff

core/modulemanager.lua @ 540:ec03f6968fa8

Added function add_feature to modules API (for adding disco features)
author Waqas Hussain <waqas20@gmail.com>
date Thu, 04 Dec 2008 20:07:22 +0500
parent 519:cccd610a0ef9
child 569:5216efe6088b
line wrap: on
line diff
--- a/core/modulemanager.lua	Thu Dec 04 20:01:57 2008 +0500
+++ b/core/modulemanager.lua	Thu Dec 04 20:07:22 2008 +0500
@@ -22,7 +22,8 @@
 local plugin_dir = CFG_PLUGINDIR or "./plugins/";
 
 local logger = require "util.logger";
-local log = logger.init("modulemanager")
+local log = logger.init("modulemanager");
+local addDiscoInfoHandler = require "core.discomanager".addDiscoInfoHandler;
 
 local loadfile, pcall = loadfile, pcall;
 local setmetatable, setfenv, getfenv = setmetatable, setfenv, getfenv;
@@ -172,6 +173,15 @@
 	_add_iq_handler(self, origin_type, xmlns, handler);
 end
 
+function api:add_feature(xmlns)
+	addDiscoInfoHandler(self.host, function(reply, to, from, node)
+		if #node == 0 then
+			reply:tag("feature", {var = xmlns}):up();
+			return true;
+		end
+	end);
+end
+
 
 do
 	local event_handlers = {};