changeset 1731:b912cb8e0b3c

mod_smacks_offline: Only deal with authenticated (c2s) sessions
author Kim Alvefur <zash@zash.se>
date Mon, 11 May 2015 14:32:37 +0200
parents e02af2b32f30
children 2f9ee9ed6267
files mod_smacks_offline/mod_smacks_offline.lua
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_smacks_offline/mod_smacks_offline.lua	Mon May 11 14:29:58 2015 +0200
+++ b/mod_smacks_offline/mod_smacks_offline.lua	Mon May 11 14:32:37 2015 +0200
@@ -21,9 +21,11 @@
 
 local host_sessions = prosody.hosts[module.host].sessions;
 mod_smacks.handle_unacked_stanzas = function (session)
-	local sessions = host_sessions[session.username].sessions;
-	if next(sessions) == session.resource and next(sessions, session.resource) == nil then
-		store_unacked_stanzas(session)
+	if session.username then
+		local sessions = host_sessions[session.username].sessions;
+		if next(sessions) == session.resource and next(sessions, session.resource) == nil then
+			store_unacked_stanzas(session)
+		end
 	end
 	return handle_unacked_stanzas(session);
 end