Mercurial > libervia-backend
diff sat/plugins/plugin_xep_0376.py @ 4037:524856bd7b19
massive refactoring to switch from camelCase to snake_case:
historically, Libervia (SàT before) was using camelCase as allowed by PEP8 when using a
pre-PEP8 code, to use the same coding style as in Twisted.
However, snake_case is more readable and it's better to follow PEP8 best practices, so it
has been decided to move on full snake_case. Because Libervia has a huge codebase, this
ended with a ugly mix of camelCase and snake_case.
To fix that, this patch does a big refactoring by renaming every function and method
(including bridge) that are not coming from Twisted or Wokkel, to use fully snake_case.
This is a massive change, and may result in some bugs.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 08 Apr 2023 13:54:42 +0200 |
parents | b7cef1b24f83 |
children |
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0376.py Fri Apr 07 15:18:39 2023 +0200 +++ b/sat/plugins/plugin_xep_0376.py Sat Apr 08 13:54:42 2023 +0200 @@ -49,16 +49,16 @@ def __init__(self, host): log.info(_("Pubsub Account Management initialization")) self.host = host - host.registerNamespace("pam", NS_PAM) + host.register_namespace("pam", NS_PAM) self._p = self.host.plugins["XEP-0060"] host.trigger.add("XEP-0060_subscribe", self.subscribe) host.trigger.add("XEP-0060_unsubscribe", self.unsubscribe) host.trigger.add("XEP-0060_subscriptions", self.subscriptions) - def getHandler(self, client): + def get_handler(self, client): return XEP_0376_Handler() - async def profileConnected(self, client): + async def profile_connected(self, client): if not self.host.hasFeature(client, NS_PAM): log.warning( "Your server doesn't support Pubsub Account Management, this is used to " @@ -66,7 +66,7 @@ "install it." ) - async def _subRequest( + async def _sub_request( self, client: SatXMPPEntity, service: jid.JID, @@ -109,7 +109,7 @@ if not self.host.hasFeature(client, NS_PAM) or client.is_component: return True, None - await self._subRequest(client, service, nodeIdentifier, sub_jid, options, True) + await self._sub_request(client, service, nodeIdentifier, sub_jid, options, True) # TODO: actual result is sent with <message> stanza, we have to get and use them # to known the actual result. XEP-0376 returns an empty <iq> result, thus we don't @@ -130,7 +130,7 @@ ) -> bool: if not self.host.hasFeature(client, NS_PAM) or client.is_component: return True - await self._subRequest(client, service, nodeIdentifier, sub_jid, None, False) + await self._sub_request(client, service, nodeIdentifier, sub_jid, None, False) return False async def subscriptions(