Diff

core/sessionmanager.lua @ 149:40e443eacbbd

Partial s2s commit
author Matthew Wild <mwild1@gmail.com>
date Fri, 24 Oct 2008 07:34:13 +0100
parent 126:63863534b1f1
child 150:d09b8a1ab046
line wrap: on
line diff
--- a/core/sessionmanager.lua	Thu Oct 23 18:43:00 2008 +0100
+++ b/core/sessionmanager.lua	Fri Oct 24 07:34:13 2008 +0100
@@ -35,14 +35,15 @@
 
 function destroy_session(session)
 	session.log("info", "Destroying session");
-	if session.username then
+	if session.host and session.username then
 		if session.resource then
 			hosts[session.host].sessions[session.username].sessions[session.resource] = nil;
 		end
-		
-		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;
+		if hosts[session.host] and hosts[session.host].sessions[session.username] 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
 	end
 	session.conn = nil;