Changeset

2498:3d08a6cf57ea

mod_privacy: Fixed global access.
author Waqas Hussain <waqas20@gmail.com>
date Tue, 26 Jan 2010 01:47:21 +0500
parents 2496:f18b882af1d1
children 2499:145d62abdbfc
files plugins/mod_privacy.lua
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_privacy.lua	Tue Jan 26 01:32:39 2010 +0500
+++ b/plugins/mod_privacy.lua	Tue Jan 26 01:47:21 2010 +0500
@@ -10,12 +10,12 @@
 local prosody = prosody;
 local st = require "util.stanza";
 local datamanager = require "util.datamanager";
-local bare_sessions = bare_sessions;
+local bare_sessions, full_sessions = bare_sessions, full_sessions;
 local util_Jid = require "util.jid";
 local jid_bare = util_Jid.bare;
 local jid_split = util_Jid.split;
 local load_roster = require "core.rostermanager".load_roster;
-local to_number = _G.tonumber;
+local to_number = tonumber;
 
 function findNamedList (privacy_lists, name)
 	local ret = nil
@@ -60,7 +60,7 @@
 	return ret;
 end
 
-function sendUnavailable(to, from)
+function sendUnavailable(origin, to, from)
 --[[ example unavailable presence stanza
 <presence from="node@host/resource" type="unavailable" to="node@host" >
 	<status>Logged out</status>
@@ -99,14 +99,14 @@
 
 		if item["presence-out"] == true then
 			if item.type == "jid" then
-				sendUnavailable(item.value, origin.full_jid);
+				sendUnavailable(origin, item.value, origin.full_jid);
 			elseif item.type == "group" then
 			elseif item.type == "subscription" then
 			elseif item.type == nil then
 			end
 		elseif item["presence-in"] == true then
 			if item.type == "jid" then
-				sendUnavailable(origin.full_jid, item.value);
+				sendUnavailable(origin, origin.full_jid, item.value);
 			elseif item.type == "group" then
 			elseif item.type == "subscription" then
 			elseif item.type == nil then
@@ -282,7 +282,7 @@
 	privacy_lists.lists[idx] = list;
 	origin.send(st.reply(stanza));
 	if bare_sessions[bare_jid] ~= nil then
-		iq = st.iq ( { type = "set", id="push1" } );
+		local iq = st.iq ( { type = "set", id="push1" } );
 		iq:tag ("query", { xmlns = "jabber:iq:privacy" } );
 		iq:tag ("list", { name = list.name } ):up();
 		iq:up();
@@ -311,7 +311,7 @@
 	else
 		local idx = findNamedList(privacy_lists, name);
 		if idx ~= nil then
-			list = privacy_lists.lists[idx];
+			local list = privacy_lists.lists[idx];
 			reply = reply:tag("list", {name=list.name});
 			for _,item in ipairs(list.items) do
 				reply:tag("item", {type=item.type, value=item.value, action=item.action, order=item.order});