Mercurial > prosody-modules
diff mod_csi_battery_saver/mod_csi_battery_saver.lua @ 5802:f6a2602129c8
mod_csi_battery_saver: mark some presences as important
author | tmolitor <thilo@eightysoft.de> |
---|---|
date | Wed, 03 Jan 2024 07:53:55 +0100 |
parents | 889e1695e935 |
children | 433a4dd1dc2a |
line wrap: on
line diff
--- a/mod_csi_battery_saver/mod_csi_battery_saver.lua Thu Dec 28 11:02:35 2023 +0100 +++ b/mod_csi_battery_saver/mod_csi_battery_saver.lua Wed Jan 03 07:53:55 2024 +0100 @@ -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