Mercurial > libervia-backend
changeset 4183:6784d07b99c8
plugin XEP-053, component AP gateway: use the new `trigger.add_with_check` method
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 09 Dec 2023 19:20:13 +0100 (12 months ago) |
parents | 4dc00e848961 |
children | 50c919dfe61b |
files | libervia/backend/plugins/plugin_comp_ap_gateway/__init__.py libervia/backend/plugins/plugin_comp_file_sharing.py libervia/backend/plugins/plugin_xep_0045.py libervia/backend/plugins/plugin_xep_0353.py libervia/backend/plugins/plugin_xep_0359.py |
diffstat | 5 files changed, 33 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_comp_ap_gateway/__init__.py Sat Dec 09 19:19:26 2023 +0100 +++ b/libervia/backend/plugins/plugin_comp_ap_gateway/__init__.py Sat Dec 09 19:20:13 2023 +0100 @@ -166,9 +166,22 @@ self.pubsub_service = APPubsubService(self) self.ad_hoc = APAdHocService(self) self.ap_events = APEvents(self) - host.trigger.add("message_received", self._message_received_trigger, priority=-1000) - host.trigger.add("XEP-0424_retract_received", self._on_message_retract) - host.trigger.add("XEP-0372_ref_received", self._on_reference_received) + host.trigger.add_with_check( + "message_received", + self, + self._message_received_trigger, + priority=-1000 + ) + host.trigger.add_with_check( + "XEP-0424_retract_received", + self, + self._on_message_retract + ) + host.trigger.add_with_check( + "XEP-0372_ref_received", + self, + self._on_reference_received + ) host.bridge.add_method( "ap_send",
--- a/libervia/backend/plugins/plugin_comp_file_sharing.py Sat Dec 09 19:19:26 2023 +0100 +++ b/libervia/backend/plugins/plugin_comp_file_sharing.py Sat Dec 09 19:20:13 2023 +0100 @@ -356,18 +356,20 @@ self._t = self.host.plugins["XEP-0264"] self._hu = self.host.plugins["XEP-0363"] self._hu.register_handler(self._on_http_upload) - self.host.trigger.add("FILE_getDestDir", self._get_dest_dir_trigger) - self.host.trigger.add( - "XEP-0234_fileSendingRequest", self._file_sending_request_trigger, priority=1000 + self.host.trigger.add_with_check("FILE_getDestDir", self, self._get_dest_dir_trigger) + self.host.trigger.add_with_check( + "XEP-0234_fileSendingRequest", self, self._file_sending_request_trigger, priority=1000 ) - self.host.trigger.add("XEP-0234_buildFileElement", self._add_file_metadata_elts) - self.host.trigger.add("XEP-0234_parseFileElement", self._get_file_metadata_elts) - self.host.trigger.add("XEP-0329_compGetFilesFromNode", self._add_file_metadata) - self.host.trigger.add( + self.host.trigger.add_with_check("XEP-0234_buildFileElement", self, self._add_file_metadata_elts) + self.host.trigger.add_with_check("XEP-0234_parseFileElement", self, self._get_file_metadata_elts) + self.host.trigger.add_with_check("XEP-0329_compGetFilesFromNode", self, self._add_file_metadata) + self.host.trigger.add_with_check( "XEP-0329_compGetFilesFromNode_build_directory", + self, self._add_directory_metadata_elts) - self.host.trigger.add( + self.host.trigger.add_with_check( "XEP-0329_parseResult_directory", + self, self._get_directory_metadata_elts) self.files_path = self.host.get_local_path(None, C.FILES_DIR) self.http_port = int(self.host.memory.config_get(
--- a/libervia/backend/plugins/plugin_xep_0045.py Sat Dec 09 19:19:26 2023 +0100 +++ b/libervia/backend/plugins/plugin_xep_0045.py Sat Dec 09 19:20:13 2023 +0100 @@ -46,6 +46,7 @@ C.PI_NAME: "XEP-0045 Plugin", C.PI_IMPORT_NAME: "XEP-0045", C.PI_TYPE: "XEP", + C.PI_MODES: C.PLUG_MODE_BOTH, C.PI_PROTOCOLS: ["XEP-0045"], C.PI_DEPENDENCIES: ["XEP-0359"], C.PI_RECOMMENDATIONS: [C.TEXT_CMDS, "XEP-0313"],
--- a/libervia/backend/plugins/plugin_xep_0353.py Sat Dec 09 19:19:26 2023 +0100 +++ b/libervia/backend/plugins/plugin_xep_0353.py Sat Dec 09 19:20:13 2023 +0100 @@ -39,7 +39,7 @@ C.PI_NAME: "Jingle Message Initiation", C.PI_IMPORT_NAME: "XEP-0353", C.PI_TYPE: "XEP", - C.PI_MODES: [C.PLUG_MODE_CLIENT], + C.PI_MODES: C.PLUG_MODE_BOTH, C.PI_PROTOCOLS: ["XEP-0353"], C.PI_DEPENDENCIES: ["XEP-0166", "XEP-0334"], C.PI_MAIN: "XEP_0353", @@ -66,15 +66,17 @@ host.register_namespace("jingle-message", NS_JINGLE_MESSAGE) self._j = host.plugins["XEP-0166"] self._h = host.plugins["XEP-0334"] - host.trigger.add( + host.trigger.add_with_check( "XEP-0166_initiate_elt_built", + self, self._on_initiate_trigger, # this plugin set the resource, we want it to happen first to other trigger # can get the full peer JID priority=host.trigger.MAX_PRIORITY, ) - host.trigger.add( + host.trigger.add_with_check( "XEP-0166_terminate", + self, self._terminate_trigger, priority=host.trigger.MAX_PRIORITY, )
--- a/libervia/backend/plugins/plugin_xep_0359.py Sat Dec 09 19:19:26 2023 +0100 +++ b/libervia/backend/plugins/plugin_xep_0359.py Sat Dec 09 19:20:13 2023 +0100 @@ -36,6 +36,7 @@ C.PI_NAME: "Unique and Stable Stanza IDs", C.PI_IMPORT_NAME: "XEP-0359", C.PI_TYPE: "XEP", + C.PI_MODES: C.PLUG_MODE_BOTH, C.PI_PROTOCOLS: ["XEP-0359"], C.PI_MAIN: "XEP_0359", C.PI_HANDLER: "yes",