diff libervia/backend/plugins/plugin_xep_0470.py @ 4383:7c1d77efc752

plugin XEP-0277: Make MbData a Pydantic model: - MbData is now a Pydantic based model. - Bridge method has been updated to use `service` and `node` from MbData instead of using separate fields. - Added `In-Reply-To` to MbData. - Adapted code using XEP-0277 to work with the changes. rel 462
author Goffi <goffi@goffi.org>
date Sun, 03 Aug 2025 23:35:21 +0200
parents 0d7bb4df2343
children
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_xep_0470.py	Fri Jul 04 12:33:42 2025 +0200
+++ b/libervia/backend/plugins/plugin_xep_0470.py	Sun Aug 03 23:35:21 2025 +0200
@@ -29,6 +29,7 @@
 from libervia.backend.core.log import getLogger
 from libervia.backend.core.core_types import SatXMPPEntity
 from libervia.backend.core import exceptions
+from libervia.backend.plugins.plugin_xep_0277 import MbData
 from libervia.backend.tools.common import uri, data_format, date_utils
 from libervia.backend.tools.utils import as_deferred, xmpp_date
 
@@ -43,7 +44,7 @@
     C.PI_TYPE: C.PLUG_TYPE_XEP,
     C.PI_MODES: C.PLUG_MODE_BOTH,
     C.PI_PROTOCOLS: [],
-    C.PI_DEPENDENCIES: ["XEP-0060"],
+    C.PI_DEPENDENCIES: ["XEP-0060", "XEP-0277"],
     C.PI_MAIN: "PubsubAttachments",
     C.PI_HANDLER: "yes",
     C.PI_DESCRIPTION: _("""Pubsub Attachments implementation"""),
@@ -152,14 +153,12 @@
     async def on_mb_send(
         self,
         client: SatXMPPEntity,
-        service: jid.JID,
-        node: str,
         item: domish.Element,
-        data: dict,
+        data: MbData,
     ) -> bool:
         """trigger to create attachment node on each publication"""
         await self.create_attachments_node(
-            client, service, node, item["id"], autocreate=True
+            client, data.service, data.node, item["id"], autocreate=True
         )
         return True