# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1638372413 -3600
# Node ID 628374809421b2a5f0660e0f47bf27b4d77b232d
# Parent  9f7a6f7d13de05dce6f365a1147595c50f21d219
mod_smacks: Remove redundant fields

Given that the registry is scoped per user and the module is scoped per
host, there seems no point to checking or storing both username and host
here.

diff -r 9f7a6f7d13de -r 628374809421 plugins/mod_smacks.lua
--- a/plugins/mod_smacks.lua	Wed Dec 01 16:20:40 2021 +0100
+++ b/plugins/mod_smacks.lua	Wed Dec 01 16:26:53 2021 +0100
@@ -82,8 +82,6 @@
 	-- save only actual h value and username/host (for security)
 	old_session_registry.set(session.username, resumption_token, {
 		h = session.handled_stanza_count,
-		username = session.username,
-		host = session.host
 	});
 	return true; -- allow session to be removed from full cache to make room for new one
 end);
@@ -507,8 +505,6 @@
 					-- save only actual h value and username/host (for security)
 					old_session_registry.set(session.username, session.resumption_token, {
 						h = session.handled_stanza_count,
-						username = session.username,
-						host = session.host
 					});
 					session.resumption_token = nil;
 					sessionmanager.destroy_session(session);
@@ -558,9 +554,7 @@
 	if not original_session then
 		session.log("debug", "Tried to resume non-existent session with id %s", id);
 		local old_session = old_session_registry.get(session.username, id);
-		if old_session and session.username == old_session.username
-		and session.host == old_session.host
-		and old_session.h then
+		if old_session then
 			session.send(st.stanza("failed", { xmlns = xmlns_sm, h = format_h(old_session.h) })
 				:tag("item-not-found", { xmlns = xmlns_errors })
 			);