From: Waqas Hussain Date: Thu, 4 Dec 2008 15:07:22 +0000 (+0500) Subject: Added function add_feature to modules API (for adding disco features) X-Git-Url: https://git.enpas.org/?a=commitdiff_plain;h=b32462837b5c154f113ca3df82ca36d809928cf9;p=prosody.git Added function add_feature to modules API (for adding disco features) --- diff --git a/core/modulemanager.lua b/core/modulemanager.lua index d5360037..532a0f86 100644 --- a/core/modulemanager.lua +++ b/core/modulemanager.lua @@ -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 @@ function api:add_iq_handler(origin_type, xmlns, handler) _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 = {};