Comparison

core/discomanager.lua @ 422:61c8877d703c

Merge from waqas
author Matthew Wild <mwild1@gmail.com>
date Wed, 26 Nov 2008 03:29:06 +0000
parent 420:aa1db0a80089
child 517:afd9f6590fd0
comparison
equal deleted inserted replaced
418:004c278154dc 422:61c8877d703c
3 local hosts = hosts; 3 local hosts = hosts;
4 local jid_split = require "util.jid".split; 4 local jid_split = require "util.jid".split;
5 local jid_bare = require "util.jid".bare; 5 local jid_bare = require "util.jid".bare;
6 local usermanager_user_exists = require "core.usermanager".user_exists; 6 local usermanager_user_exists = require "core.usermanager".user_exists;
7 local rostermanager_is_contact_subscribed = require "core.rostermanager".is_contact_subscribed; 7 local rostermanager_is_contact_subscribed = require "core.rostermanager".is_contact_subscribed;
8 local print = print;
8 9
9 do 10 do
10 helper:addDiscoInfoHandler("*host", function(reply, to, from, node) 11 helper:addDiscoInfoHandler("*host", function(reply, to, from, node)
11 if hosts[to] then 12 if hosts[to] then
12 reply:tag("identity", {category="server", type="im", name="lxmppd"}):up(); 13 reply:tag("identity", {category="server", type="im", name="lxmppd"}):up();
34 35
35 function addDiscoInfoHandler(jid, func) 36 function addDiscoInfoHandler(jid, func)
36 return helper:addDiscoInfoHandler(jid, func); 37 return helper:addDiscoInfoHandler(jid, func);
37 end 38 end
38 39
40 function set(plugin, var, origin)
41 -- TODO handle origin and host based on plugin.
42 local handler = function(reply, to, from, node) -- service discovery
43 if #node == 0 then
44 reply:tag("feature", {var = var}):up();
45 return true;
46 end
47 end
48 addDiscoInfoHandler("*node", handler);
49 addDiscoInfoHandler("*host", handler);
50 end
51
39 return _M; 52 return _M;