diff sat/plugins/plugin_comp_ap_gateway/__init__.py @ 3807:2032826cfbcf

component AP gateway typing + remove unused `activity` arg from `newAPDeleteItem` rel 367
author Goffi <goffi@goffi.org>
date Fri, 17 Jun 2022 15:50:34 +0200
parents 36b167ddbfca
children 0b1c30ff2cbb
line wrap: on
line diff
--- a/sat/plugins/plugin_comp_ap_gateway/__init__.py	Fri Jun 17 15:50:15 2022 +0200
+++ b/sat/plugins/plugin_comp_ap_gateway/__init__.py	Fri Jun 17 15:50:34 2022 +0200
@@ -42,7 +42,7 @@
 from twisted.web import http
 from twisted.words.protocols.jabber import error, jid
 from twisted.words.xish import domish
-from wokkel import rsm
+from wokkel import rsm, pubsub
 
 from sat.core import exceptions
 from sat.core.constants import Const as C
@@ -232,7 +232,11 @@
         client.sendHistory = True
         await self.init(client)
 
-    async def _itemsReceived(self, client, itemsEvent):
+    async def _itemsReceived(
+        self,
+        client: SatXMPPEntity,
+        itemsEvent: pubsub.ItemsEvent
+    ) -> None:
         """Callback called when pubsub items are received
 
         if the items are adressed to a JID corresponding to an AP actor, they are
@@ -930,6 +934,10 @@
     async def getAPActorIdFromAccount(self, account: str) -> str:
         """Retrieve account ID from it's handle using WebFinger
 
+        Don't use this method to get local actor id from a local account derivated for
+        JID: in this case, the actor ID is retrieve with
+        ``self.buildAPURL(TYPE_ACTOR, ap_account)``
+
         @param account: AP handle (user@domain.tld)
         @return: Actor ID (which is an URL)
         """
@@ -1898,7 +1906,6 @@
         client: SatXMPPEntity,
         destinee: Optional[jid.JID],
         node: str,
-        activity: dict,
         item: dict,
     ) -> None:
         """Analyse, cache and send notification for received AP item
@@ -1931,7 +1938,7 @@
             # it's a direct message
             if history.source_jid != client.jid:
                 log.warning(
-                    f"retractation received from an entity ''{client.jid}) which is "
+                    f"retraction received from an entity ''{client.jid}) which is "
                     f"not the original sender of the message ({history.source_jid}), "
                     "hack attemps?"
                 )