Changeset

1798:3ae8c81a348b

mod_roster_allinall: Cleanup, remove unused variables [luacheck]
author Kim Alvefur <zash@zash.se>
date Fri, 28 Aug 2015 00:16:39 +0200
parents 1797:a946aa422503
children 1799:d2dd1db9ece6
files mod_roster_allinall/mod_roster_allinall.lua
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mod_roster_allinall/mod_roster_allinall.lua	Thu Aug 27 16:14:54 2015 +0200
+++ b/mod_roster_allinall/mod_roster_allinall.lua	Fri Aug 28 00:16:39 2015 +0200
@@ -1,8 +1,7 @@
 local rostermanager = require"core.rostermanager";
 local jid_join = require"util.jid".join;
-local jid_split = require"util.jid".split;
 local host = module.host;
-local sessions = hosts[host].sessions;
+local sessions = prosody.hosts[host].sessions;
 
 -- Make a *one-way* subscription. User will see when contact is online,
 -- contact will not see when user is online.
@@ -18,6 +17,7 @@
 	-- Update user's roster to say subscription request approved...
 	rostermanager.process_inbound_subscription_approval(user, host, contact_jid);
 
+	-- Push updates to both rosters
 	rostermanager.roster_push(user, host, contact_jid);
 	rostermanager.roster_push(contact, host, user_jid);
 end
@@ -25,13 +25,11 @@
 
 module:hook("resource-bind", function(event)
 	local session = event.session;
-	local roster = session.roster;
 	local user = session.username;
 	local user_jid = jid_join(user, host);
-	local contact_jid;
-	for contact, contact_session in pairs(sessions) do
+	for contact in pairs(sessions) do
 		if contact ~= user then
-			contact_jid = jid_join(contact, host);
+			local contact_jid = jid_join(contact, host);
 			if not rostermanager.is_contact_subscribed(user, host, contact_jid) then
 				subscribe(contact, user);
 			end