core/discomanager.lua

changeset 422
61c8877d703c
parent 420
aa1db0a80089
child 517
afd9f6590fd0
--- a/core/discomanager.lua	Wed Nov 26 02:21:18 2008 +0000
+++ b/core/discomanager.lua	Wed Nov 26 03:29:06 2008 +0000
@@ -5,6 +5,7 @@
 local jid_bare = require "util.jid".bare;
 local usermanager_user_exists = require "core.usermanager".user_exists;
 local rostermanager_is_contact_subscribed = require "core.rostermanager".is_contact_subscribed;
+local print = print;
 
 do
 	helper:addDiscoInfoHandler("*host", function(reply, to, from, node)
@@ -36,4 +37,16 @@
 	return helper:addDiscoInfoHandler(jid, func);
 end
 
+function set(plugin, var, origin)
+	-- TODO handle origin and host based on plugin.
+	local handler = function(reply, to, from, node) -- service discovery
+		if #node == 0 then
+			reply:tag("feature", {var = var}):up();
+			return true;
+		end
+	end
+	addDiscoInfoHandler("*node", handler);
+	addDiscoInfoHandler("*host", handler);
+end
+
 return _M;

mercurial