Software /
code /
prosody-modules
Diff
mod_csi_battery_saver/mod_csi_battery_saver.lua @ 2946:dfac28504e86
mod_csi_battery_saver: Remove whitespace only lines
author | Michel Le Bihan <michel@lebihan.pl> |
---|---|
date | Fri, 23 Mar 2018 22:38:46 +0100 |
parent | 2757:595d9d68fd11 |
child | 3109:75930e4c2478 |
line wrap: on
line diff
--- a/mod_csi_battery_saver/mod_csi_battery_saver.lua Fri Mar 23 21:55:32 2018 +0100 +++ b/mod_csi_battery_saver/mod_csi_battery_saver.lua Fri Mar 23 22:38:46 2018 +0100 @@ -116,28 +116,28 @@ --session.log("debug", "mod_csi_battery_saver(%s): stanza_direction = %s, carbon = %s, stanza = %s", id, stanza_direction, carbon and "true" or "false", tostring(stanza)); if carbon then stanza = carbon; end st_type = stanza.attr.type; - + -- headline message are always not important if st_type == "headline" then return false; end - + -- chat markers (XEP-0333) are important, too, because some clients use them to update their notifications if find(stanza, "{urn:xmpp:chat-markers:0}") then return true; end; - + -- carbon copied outgoing messages are important (some clients update their notifications upon receiving those) --> don't return false here --if carbon and stanza_direction == "out" then return false; end - + -- We can't check for body contents in encrypted messages, so let's treat them as important -- Some clients don't even set a body or an empty body for encrypted messages - + -- check omemo https://xmpp.org/extensions/inbox/omemo.html if stanza:get_child("encrypted", "eu.siacs.conversations.axolotl") or stanza:get_child("encrypted", "urn:xmpp:omemo:0") then return true; end - + -- check xep27 pgp https://xmpp.org/extensions/xep-0027.html if stanza:get_child("x", "jabber:x:encrypted") then return true; end - + -- check xep373 pgp (OX) https://xmpp.org/extensions/xep-0373.html if stanza:get_child("openpgp", "urn:xmpp:openpgp:0") then return true; end - + local body = stanza:get_child_text("body"); if st_type == "groupchat" then if stanza:get_child_text("subject") then return true; end