core/discomanager.lua

changeset 419
af362df8e6fd
parent 393
885a1864cd97
child 420
aa1db0a80089
equal deleted inserted replaced
417:d60e63379284 419:af362df8e6fd
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, origin, var)
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});
45 return true;
46 end
47 end
48 addDiscoInfoHandler("*node", handler);
49 addDiscoInfoHandler("*host", handler);
50 end
51
39 return _M; 52 return _M;

mercurial