Final fix for marking user offline when all resources are gone :)

Thu, 23 Oct 2008 18:05:06 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 23 Oct 2008 18:05:06 +0100
changeset 126
63863534b1f1
parent 125
6b6b8f4ab7e3
child 127
93f3c6b94c75
child 136
39dc16f3bf55

Final fix for marking user offline when all resources are gone :)

core/sessionmanager.lua file | annotate | diff | comparison | revisions
--- a/core/sessionmanager.lua	Thu Oct 23 17:34:10 2008 +0100
+++ b/core/sessionmanager.lua	Thu Oct 23 18:05:06 2008 +0100
@@ -1,6 +1,6 @@
 
 local tonumber, tostring = tonumber, tostring;
-local ipairs, pairs, print= ipairs, pairs, print;
+local ipairs, pairs, print, next= ipairs, pairs, print, next;
 local collectgarbage = collectgarbage;
 local m_random = import("math", "random");
 local format = import("string", "format");
@@ -39,7 +39,9 @@
 		if session.resource then
 			hosts[session.host].sessions[session.username].sessions[session.resource] = nil;
 		end
-		if not next(hosts[session.host].sessions[session.username], nil) then
+		
+		if not next(hosts[session.host].sessions[session.username].sessions) then
+			log("debug", "All resources of %s are now offline", session.username);
 			hosts[session.host].sessions[session.username] = nil;
 		end
 	end

mercurial