Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
539:cbcadb1a6166 | 540:ec03f6968fa8 |
---|---|
20 | 20 |
21 | 21 |
22 local plugin_dir = CFG_PLUGINDIR or "./plugins/"; | 22 local plugin_dir = CFG_PLUGINDIR or "./plugins/"; |
23 | 23 |
24 local logger = require "util.logger"; | 24 local logger = require "util.logger"; |
25 local log = logger.init("modulemanager") | 25 local log = logger.init("modulemanager"); |
26 local addDiscoInfoHandler = require "core.discomanager".addDiscoInfoHandler; | |
26 | 27 |
27 local loadfile, pcall = loadfile, pcall; | 28 local loadfile, pcall = loadfile, pcall; |
28 local setmetatable, setfenv, getfenv = setmetatable, setfenv, getfenv; | 29 local setmetatable, setfenv, getfenv = setmetatable, setfenv, getfenv; |
29 local pairs, ipairs = pairs, ipairs; | 30 local pairs, ipairs = pairs, ipairs; |
30 local t_insert = table.insert; | 31 local t_insert = table.insert; |
170 return; | 171 return; |
171 end | 172 end |
172 _add_iq_handler(self, origin_type, xmlns, handler); | 173 _add_iq_handler(self, origin_type, xmlns, handler); |
173 end | 174 end |
174 | 175 |
176 function api:add_feature(xmlns) | |
177 addDiscoInfoHandler(self.host, function(reply, to, from, node) | |
178 if #node == 0 then | |
179 reply:tag("feature", {var = xmlns}):up(); | |
180 return true; | |
181 end | |
182 end); | |
183 end | |
184 | |
175 | 185 |
176 do | 186 do |
177 local event_handlers = {}; | 187 local event_handlers = {}; |
178 | 188 |
179 function api:add_event_hook(name, handler) | 189 function api:add_event_hook(name, handler) |