Software /
code /
prosody-modules
Diff
mod_csi_battery_saver/mod_csi_battery_saver.lua @ 5856:75dee6127829 draft
Merge upstream
author | Trần H. Trung <xmpp:trần.h.trung@trung.fun> |
---|---|
date | Tue, 06 Feb 2024 18:32:01 +0700 |
parent | 5825:f6a2602129c8 |
child | 5916:433a4dd1dc2a |
line wrap: on
line diff
--- a/mod_csi_battery_saver/mod_csi_battery_saver.lua Tue Aug 29 23:51:17 2023 +0700 +++ b/mod_csi_battery_saver/mod_csi_battery_saver.lua Tue Feb 06 18:32:01 2024 +0700 @@ -88,7 +88,13 @@ local st_name = stanza and stanza.name or nil; if not st_name then return true; end -- nonzas are always important if st_name == "presence" then - -- TODO check for MUC status codes? + local st_type = stanza.attr.type; + -- subscription requests are important + if st_type == "subscribe" then return true; end + -- muc status codes are important, too + local muc_x = stanza:get_child("x", "http://jabber.org/protocol/muc#user") + local muc_status = muc_x and muc_x:get_child("status") or nil + if muc_status and muc_status.attr.code then return true; end return false; elseif st_name == "message" then -- unpack carbon copies @@ -122,7 +128,7 @@ -- check xep373 pgp (OX) https://xmpp.org/extensions/xep-0373.html if stanza:get_child("openpgp", "urn:xmpp:openpgp:0") then return true; end - + -- check eme if stanza:get_child("encryption", "urn:xmpp:eme:0") then return true; end