comparison mod_csi_battery_saver/mod_csi_battery_saver.lua @ 3980:19c5bfc3a241

mod_csi_battery_saver: Add Jingle incoming call messages to important, thanks to Wiktor Kwapisiewicz <wiktor@metacode.biz>
author tmolitor <thilo@eightysoft.de>
date Sun, 19 Apr 2020 08:15:09 +0200
parents 6b0db0f2d57a
children 64b7daa6c42c
comparison
equal deleted inserted replaced
3979:6bf362008052 3980:19c5bfc3a241
95 local carbon, stanza_direction = extract_carbon(stanza); 95 local carbon, stanza_direction = extract_carbon(stanza);
96 --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)); 96 --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));
97 if carbon then stanza = carbon; end 97 if carbon then stanza = carbon; end
98 98
99 local st_type = stanza.attr.type; 99 local st_type = stanza.attr.type;
100
100 -- headline message are always not important 101 -- headline message are always not important
101 if st_type == "headline" then return false; end 102 if st_type == "headline" then return false; end
102 103
103 -- chat markers (XEP-0333) are important, too, because some clients use them to update their notifications 104 -- chat markers (XEP-0333) are important, too, because some clients use them to update their notifications
104 if stanza:child_with_ns("urn:xmpp:chat-markers:0") then return true; end; 105 if stanza:child_with_ns("urn:xmpp:chat-markers:0") then return true; end;
106
107 -- XEP-0353: Jingle Message Initiation incoming call messages
108 if stanza:child_with_ns("urn:xmpp:jingle-message:0") then return true; end
105 109
106 -- carbon copied outgoing messages are important (some clients update their notifications upon receiving those) --> don't return false here 110 -- carbon copied outgoing messages are important (some clients update their notifications upon receiving those) --> don't return false here
107 --if carbon and stanza_direction == "out" then return false; end 111 --if carbon and stanza_direction == "out" then return false; end
108 112
109 -- We can't check for body contents in encrypted messages, so let's treat them as important 113 -- We can't check for body contents in encrypted messages, so let's treat them as important