Mercurial > prosody-modules
comparison mod_csi_battery_saver/mod_csi_battery_saver.lua @ 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 <thilo@eightysoft.de> |
---|---|
date | Thu, 17 Aug 2017 21:32:52 +0200 |
parents | 69248dcd7cff |
children | b62cec32680e |
comparison
equal
deleted
inserted
replaced
2741:69248dcd7cff | 2742:2e30bb3a10d5 |
---|---|
157 session.pump = pump; | 157 session.pump = pump; |
158 session._pump_orig_send = session.send; | 158 session._pump_orig_send = session.send; |
159 function session.send(stanza) | 159 function session.send(stanza) |
160 session.log("debug", "mod_csi_battery_saver(%s): Got stanza: <%s>", id, tostring(stanza.name or stanza)); | 160 session.log("debug", "mod_csi_battery_saver(%s): Got stanza: <%s>", id, tostring(stanza.name or stanza)); |
161 local important = is_important(stanza, session); | 161 local important = is_important(stanza, session); |
162 -- clone stanzas before adding delay stamp and putting them into the queue | |
163 if st.is_stanza(stanza) then stanza = st.clone(stanza); end | |
162 -- add delay stamp to unimportant (buffered) stanzas that can/need be stamped | 164 -- add delay stamp to unimportant (buffered) stanzas that can/need be stamped |
163 if not important and is_stamp_needed(stanza, session) then stanza = add_stamp(stanza, session); end | 165 if not important and is_stamp_needed(stanza, session) then stanza = add_stamp(stanza, session); end |
166 -- add stanza to outgoing queue and flush the buffer if needed | |
164 pump:push(stanza); | 167 pump:push(stanza); |
165 if important then | 168 if important then |
166 session.log("debug", "mod_csi_battery_saver(%s): Encountered important stanza, flushing buffer: <%s>", id, tostring(stanza.name or stanza)); | 169 session.log("debug", "mod_csi_battery_saver(%s): Encountered important stanza, flushing buffer: <%s>", id, tostring(stanza.name or stanza)); |
167 pump:flush(); | 170 pump:flush(); |
168 end | 171 end |