Changeset

419:af362df8e6fd

Added helper method to discomanager
author Waqas Hussain <waqas20@gmail.com>
date Wed, 26 Nov 2008 07:44:38 +0500
parents 417:d60e63379284
children 420:aa1db0a80089
files core/discomanager.lua
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/core/discomanager.lua	Wed Nov 26 01:55:07 2008 +0500
+++ b/core/discomanager.lua	Wed Nov 26 07:44:38 2008 +0500
@@ -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, origin, var)
+	-- 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});
+			return true;
+		end
+	end
+	addDiscoInfoHandler("*node", handler);
+	addDiscoInfoHandler("*host", handler);
+end
+
 return _M;