comparison sat/plugins/plugin_comp_ap_gateway/ad_hoc.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 0aa7023dcd08
children
comparison
equal deleted inserted replaced
4036:c4464d7ae97b 4037:524856bd7b19
36 self.host = apg.host 36 self.host = apg.host
37 self.apg = apg 37 self.apg = apg
38 self._c = self.host.plugins["XEP-0050"] 38 self._c = self.host.plugins["XEP-0050"]
39 39
40 def init(self, client: SatXMPPEntity) -> None: 40 def init(self, client: SatXMPPEntity) -> None:
41 self._c.addAdHocCommand( 41 self._c.add_ad_hoc_command(
42 client, 42 client,
43 self.xmpp_jid_node_2_ap_actor, 43 self.xmpp_jid_node_2_ap_actor,
44 "Convert XMPP JID/Node to AP actor", 44 "Convert XMPP JID/Node to AP actor",
45 node=NS_XMPP_JID_NODE_2_AP, 45 node=NS_XMPP_JID_NODE_2_AP,
46 allowed_magics=C.ENTITY_ALL, 46 allowed_magics=C.ENTITY_ALL,
80 payload = form.toElement() 80 payload = form.toElement()
81 return payload, status, None, None 81 return payload, status, None, None
82 else: 82 else:
83 xmpp_jid = jid.JID(command_form["jid"]) 83 xmpp_jid = jid.JID(command_form["jid"])
84 xmpp_node = command_form.get("node") 84 xmpp_node = command_form.get("node")
85 actor = await self.apg.getAPAccountFromJidAndNode(xmpp_jid, xmpp_node) 85 actor = await self.apg.get_ap_account_from_jid_and_node(xmpp_jid, xmpp_node)
86 note = (self._c.NOTE.INFO, actor) 86 note = (self._c.NOTE.INFO, actor)
87 status = self._c.STATUS.COMPLETED 87 status = self._c.STATUS.COMPLETED
88 payload = None 88 payload = None
89 return (payload, status, None, note) 89 return (payload, status, None, note)