comparison mod_csi_battery_saver/mod_csi_battery_saver.lua @ 5892:433a4dd1dc2a

mod_csi_battery_saver: MDS headline pushes are important
author tmolitor <thilo@eightysoft.de>
date Mon, 29 Apr 2024 01:27:51 +0200
parents f6a2602129c8
children 5db53d619e66
comparison
equal deleted inserted replaced
5891:512f912fdfa5 5892:433a4dd1dc2a
102 --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)); 102 --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));
103 if carbon then stanza = carbon; end 103 if carbon then stanza = carbon; end
104 104
105 local st_type = stanza.attr.type; 105 local st_type = stanza.attr.type;
106 106
107 -- headline message are always not important 107 -- headline message are always not important, with some exceptions
108 if st_type == "headline" then return false; end 108 if st_type == "headline" then
109 -- allow headline pushes of mds updates
110 if stanza:find("{http://jabber.org/protocol/pubsub#event}event/items@node") == "urn:xmpp:mds:displayed:0" then return true; end;
111 return false
112 end
109 113
110 -- chat markers (XEP-0333) are important, too, because some clients use them to update their notifications 114 -- chat markers (XEP-0333) are important, too, because some clients use them to update their notifications
111 if stanza:child_with_ns("urn:xmpp:chat-markers:0") then return true; end; 115 if stanza:child_with_ns("urn:xmpp:chat-markers:0") then return true; end;
112 116
113 -- XEP-0353: Jingle Message Initiation incoming call messages 117 -- XEP-0353: Jingle Message Initiation incoming call messages