changeset 2742:2e30bb3a10d5

mod_csi_battery_saver: Fix a bug introduced by commit f43c77c69a8a Trying to clone strings, too, was a bad idea, this should fix it.
author tmolitor <>
date Thu, 17 Aug 2017 21:32:52 +0200
parents 69248dcd7cff
children 1fa9620220e3
files mod_csi_battery_saver/mod_csi_battery_saver.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_csi_battery_saver/mod_csi_battery_saver.lua	Thu Aug 17 21:21:23 2017 +0200
+++ b/mod_csi_battery_saver/mod_csi_battery_saver.lua	Thu Aug 17 21:32:52 2017 +0200
@@ -159,8 +159,11 @@
 		function session.send(stanza)
 			session.log("debug", "mod_csi_battery_saver(%s): Got stanza: <%s>", id, tostring( or stanza));
 			local important = is_important(stanza, session);
+			-- clone stanzas before adding delay stamp and putting them into the queue
+			if st.is_stanza(stanza) then stanza = st.clone(stanza); end
 			-- add delay stamp to unimportant (buffered) stanzas that can/need be stamped
 			if not important and is_stamp_needed(stanza, session) then stanza = add_stamp(stanza, session); end
+			-- add stanza to outgoing queue and flush the buffer if needed
 			if important then
 				session.log("debug", "mod_csi_battery_saver(%s): Encountered important stanza, flushing buffer: <%s>", id, tostring( or stanza));