# HG changeset patch # User Waqas Hussain # Date 1228403242 -18000 # Node ID ec03f6968fa8d66314b0db4c1239060774b2c370 # Parent cbcadb1a6166f4f79efdba1a110b7f5ba2b26e20 Added function add_feature to modules API (for adding disco features) diff -r cbcadb1a6166 -r ec03f6968fa8 core/modulemanager.lua --- 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 = {};