Mercurial > libervia-backend
diff libervia/backend/plugins/plugin_xep_0352.py @ 4270:0d7bb4df2343
Reformatted code base using black.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 19 Jun 2024 18:44:57 +0200 |
parents | 4b842c1fb686 |
children |
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_xep_0352.py Tue Jun 18 12:06:45 2024 +0200 +++ b/libervia/backend/plugins/plugin_xep_0352.py Wed Jun 19 18:44:57 2024 +0200 @@ -32,8 +32,10 @@ C.PI_DEPENDENCIES: [], C.PI_MAIN: "XEP_0352", C.PI_HANDLER: "no", - C.PI_DESCRIPTION: D_("Notify server when frontend is not actively used, to limit " - "traffic and save bandwidth and battery life"), + C.PI_DESCRIPTION: D_( + "Notify server when frontend is not actively used, to limit " + "traffic and save bandwidth and battery life" + ), } NS_CSI = "urn:xmpp:csi:0" @@ -54,30 +56,35 @@ except AttributeError: # _xep_0352_active can not be set if is_active is called before # profile_connected has been called - log.debug("is_active called when XEP-0352 plugin has not yet set the " - "attributes") + log.debug( + "is_active called when XEP-0352 plugin has not yet set the " "attributes" + ) return True def profile_connected(self, client): - if (NS_CSI, 'csi') in client.xmlstream.features: + if (NS_CSI, "csi") in client.xmlstream.features: log.info(_("Client State Indication is available on this server")) client._xep_0352_enabled = True client._xep_0352_active = True else: - log.warning(_("Client State Indication is not available on this server, some" - " bandwidth optimisations can't be used.")) + log.warning( + _( + "Client State Indication is not available on this server, some" + " bandwidth optimisations can't be used." + ) + ) client._xep_0352_enabled = False def set_inactive(self, client): if self.is_active(client): - inactive_elt = domish.Element((NS_CSI, 'inactive')) + inactive_elt = domish.Element((NS_CSI, "inactive")) client.send(inactive_elt) client._xep_0352_active = False log.info("inactive state set") def set_active(self, client): if not self.is_active(client): - active_elt = domish.Element((NS_CSI, 'active')) + active_elt = domish.Element((NS_CSI, "active")) client.send(active_elt) client._xep_0352_active = True log.info("active state set")