aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2008-12-04 20:07:22 +0500
committerWaqas Hussain <waqas20@gmail.com>2008-12-04 20:07:22 +0500
commitfcf33a735bd454e7d755c36be93e011ff5754283 (patch)
tree45b1c45e8d0fb3884dea7c8c81ee2e9a85f4956e
parentd6e4398a6a8c2b8bc4ca44141d7f3decee7a6bf4 (diff)
downloadprosody-fcf33a735bd454e7d755c36be93e011ff5754283.tar.gz
prosody-fcf33a735bd454e7d755c36be93e011ff5754283.zip
Added function add_feature to modules API (for adding disco features)
-rw-r--r--core/modulemanager.lua12
1 files changed, 11 insertions, 1 deletions
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 = {};