Diff

mod_smacks/mod_smacks.lua @ 3104:626d2c781c66

mod_smacks: send maximum resumption timeout to client
author Jonas Wielicki <jonas@wielicki.name>
date Thu, 07 Jun 2018 13:27:32 +0200
parent 2937:e672d1050529
child 3107:f703cc6e72df
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua	Wed Jun 06 19:20:10 2018 +0200
+++ b/mod_smacks/mod_smacks.lua	Thu Jun 07 13:27:32 2018 +0200
@@ -62,7 +62,7 @@
 			end;
 		};
 	end
-	
+
 	-- use per user limited cache for prosody >= 0.10
 	local stores = {};
 	return {
@@ -172,7 +172,7 @@
 			end);
 		end
 	end
-	
+
 	-- Trigger "smacks-ack-delayed"-event if we added new (ackable) stanzas to the outgoing queue
 	-- and there isn't already a timer for this event running.
 	-- If we wouldn't do this, stanzas added to the queue after the first "smacks-ack-delayed"-event
@@ -181,7 +181,7 @@
 		session.log("debug", "Calling delayed_ack_function directly (still waiting for ack)");
 		delayed_ack_function(session);
 	end
-	
+
 	session.last_queue_count = #queue;
 end
 
@@ -278,7 +278,7 @@
 		session_registry.set(session.username, resume_token, session);
 		session.resumption_token = resume_token;
 	end
-	(session.sends2s or session.send)(st.stanza("enabled", { xmlns = xmlns_sm, id = resume_token, resume = resume }));
+	(session.sends2s or session.send)(st.stanza("enabled", { xmlns = xmlns_sm, id = resume_token, resume = resume, max = resume_timeout }));
 	return true;
 end
 module:hook_stanza(xmlns_sm2, "enable", function (session, stanza) return handle_enable(session, stanza, xmlns_sm2); end, 100);