changeset 4051:c23cad65ae99

core: renamed `messageReceived` trigger to `message_received`
author Goffi <goffi@goffi.org>
date Mon, 29 May 2023 13:32:08 +0200
parents 199473ffe4ea
children 2ced30f6d5de
files sat/core/xmpp.py sat/memory/encryption.py sat/plugins/plugin_comp_ap_gateway/__init__.py sat/plugins/plugin_exp_command_export.py sat/plugins/plugin_exp_lang_detect.py sat/plugins/plugin_exp_parrot.py sat/plugins/plugin_misc_android.py sat/plugins/plugin_sec_aesgcm.py sat/plugins/plugin_sec_otr.py sat/plugins/plugin_sec_oxps.py sat/plugins/plugin_xep_0033.py sat/plugins/plugin_xep_0045.py sat/plugins/plugin_xep_0071.py sat/plugins/plugin_xep_0085.py sat/plugins/plugin_xep_0249.py sat/plugins/plugin_xep_0280.py sat/plugins/plugin_xep_0320.py sat/plugins/plugin_xep_0334.py sat/plugins/plugin_xep_0353.py sat/plugins/plugin_xep_0372.py sat/plugins/plugin_xep_0374.py sat/plugins/plugin_xep_0380.py sat/plugins/plugin_xep_0384.py sat/plugins/plugin_xep_0424.py sat/plugins/plugin_xep_0444.py sat/plugins/plugin_xep_0447.py
diffstat 26 files changed, 31 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/sat/core/xmpp.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/core/xmpp.py	Mon May 29 13:32:08 2023 +0200
@@ -1319,7 +1319,7 @@
     def _on_message_start_workflow(self, cont, client, message_elt, post_treat):
         """Parse message and do post treatments
 
-        It is the first callback called after messageReceived trigger
+        It is the first callback called after message_received trigger
         @param cont(bool): workflow will continue only if this is True
         @param message_elt(domish.Element): message stanza
             may have be modified by triggers
@@ -1354,7 +1354,7 @@
         post_treat = defer.Deferred()
 
         d = self.host.trigger.async_point(
-            "messageReceived", client, message_elt, post_treat
+            "message_received", client, message_elt, post_treat
         )
 
         d.addCallback(self._on_message_start_workflow, client, message_elt, post_treat)
--- a/sat/memory/encryption.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/memory/encryption.py	Mon May 29 13:32:08 2023 +0200
@@ -462,7 +462,7 @@
     def mark_as_encrypted(self, mess_data, namespace):
         """Helper method to mark a message as having been e2e encrypted.
 
-        This should be used in the post_treat workflow of messageReceived trigger of
+        This should be used in the post_treat workflow of message_received trigger of
         the plugin
         @param mess_data(dict): message data as used in post treat workflow
         @param namespace(str): namespace of the algorithm used for encrypting the message
@@ -516,7 +516,7 @@
     def mark_as_trusted(self, mess_data):
         """Helper methor to mark a message as sent from a trusted entity.
 
-        This should be used in the post_treat workflow of messageReceived trigger of
+        This should be used in the post_treat workflow of message_received trigger of
         the plugin
         @param mess_data(dict): message data as used in post treat workflow
         """
@@ -526,7 +526,7 @@
     def mark_as_untrusted(self, mess_data):
         """Helper methor to mark a message as sent from an untrusted entity.
 
-        This should be used in the post_treat workflow of messageReceived trigger of
+        This should be used in the post_treat workflow of message_received trigger of
         the plugin
         @param mess_data(dict): message data as used in post treat workflow
         """
--- a/sat/plugins/plugin_comp_ap_gateway/__init__.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_comp_ap_gateway/__init__.py	Mon May 29 13:32:08 2023 +0200
@@ -162,7 +162,7 @@
         self.pubsub_service = APPubsubService(self)
         self.ad_hoc = APAdHocService(self)
         self.ap_events = APEvents(self)
-        host.trigger.add("messageReceived", self._message_received_trigger, priority=-1000)
+        host.trigger.add("message_received", self._message_received_trigger, priority=-1000)
         host.trigger.add("XEP-0424_retractReceived", self._on_message_retract)
         host.trigger.add("XEP-0372_ref_received", self._on_reference_received)
 
--- a/sat/plugins/plugin_exp_command_export.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_exp_command_export.py	Mon May 29 13:32:08 2023 +0200
@@ -92,7 +92,7 @@
         log.info(_("Plugin command export initialization"))
         self.host = host
         self.spawned = {}  # key = entity
-        host.trigger.add("messageReceived", self.message_received_trigger, priority=10000)
+        host.trigger.add("message_received", self.message_received_trigger, priority=10000)
         host.bridge.add_method(
             "command_export",
             ".plugin",
@@ -148,7 +148,7 @@
                         - exclusive: if set, skip all other triggers
                         - loop: if set, restart the command once terminated #TODO
                         - pty: if set, launch in a pseudo terminal
-                        - continue: continue normal messageReceived handling
+                        - continue: continue normal message_received handling
         """
         client = self.host.get_client(profile_key)
         for target in targets:
--- a/sat/plugins/plugin_exp_lang_detect.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_exp_lang_detect.py	Mon May 29 13:32:08 2023 +0200
@@ -66,7 +66,7 @@
         log.info(_("Language detection plugin initialization"))
         self.host = host
         host.memory.update_params(PARAMS)
-        host.trigger.add("messageReceived", self.message_received_trigger)
+        host.trigger.add("message_received", self.message_received_trigger)
         host.trigger.add("sendMessage", self.message_send_trigger)
 
     def add_language(self, mess_data):
--- a/sat/plugins/plugin_exp_parrot.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_exp_parrot.py	Mon May 29 13:32:08 2023 +0200
@@ -55,7 +55,7 @@
     def __init__(self, host):
         log.info(_("Plugin Parrot initialization"))
         self.host = host
-        host.trigger.add("messageReceived", self.message_received_trigger, priority=100)
+        host.trigger.add("message_received", self.message_received_trigger, priority=100)
         # host.trigger.add("sendMessage", self.send_message_trigger, priority=100)
         try:
             self.host.plugins[C.TEXT_CMDS].register_text_commands(self)
--- a/sat/plugins/plugin_misc_android.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_misc_android.py	Mon May 29 13:32:08 2023 +0200
@@ -268,7 +268,7 @@
                 raise e
         # we set a low priority because we want the notification to be sent after all
         # plugins have done their job
-        host.trigger.add("messageReceived", self.message_received_trigger, priority=-1000)
+        host.trigger.add("message_received", self.message_received_trigger, priority=-1000)
 
         # profiles autoconnection
         host.bridge.add_method(
--- a/sat/plugins/plugin_sec_aesgcm.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_sec_aesgcm.py	Mon May 29 13:32:08 2023 +0200
@@ -70,7 +70,7 @@
             self.can_handle_attachment, self.attach, encrypted=True)
         host.trigger.add("XEP-0363_upload_pre_slot", self._upload_pre_slot)
         host.trigger.add("XEP-0363_upload", self._upload_trigger)
-        host.trigger.add("messageReceived", self._message_received_trigger)
+        host.trigger.add("message_received", self._message_received_trigger)
 
     async def download(self, client, uri_parsed, dest_path, options):
         fragment = bytes.fromhex(uri_parsed.fragment)
--- a/sat/plugins/plugin_sec_otr.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_sec_otr.py	Mon May 29 13:32:08 2023 +0200
@@ -314,7 +314,7 @@
         )  #  FIXME: OTR should not be skipped per profile, this need to be refactored
         self._p_hints = host.plugins["XEP-0334"]
         self._p_carbons = host.plugins["XEP-0280"]
-        host.trigger.add("messageReceived", self.message_received_trigger, priority=100000)
+        host.trigger.add("message_received", self.message_received_trigger, priority=100000)
         host.trigger.add("sendMessage", self.send_message_trigger, priority=100000)
         host.trigger.add("send_message_data", self._send_message_data_trigger)
         host.bridge.add_method(
--- a/sat/plugins/plugin_sec_oxps.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_sec_oxps.py	Mon May 29 13:32:08 2023 +0200
@@ -91,7 +91,7 @@
         host.trigger.add("XEP-0060_publish", self._publish_trigger)
         host.trigger.add("XEP-0060_items", self._items_trigger)
         host.trigger.add(
-            "messageReceived",
+            "message_received",
             self._message_received_trigger,
         )
         host.bridge.add_method(
--- a/sat/plugins/plugin_xep_0033.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_xep_0033.py	Mon May 29 13:32:08 2023 +0200
@@ -79,7 +79,7 @@
         host.trigger.add(
             "sendMessage", self.send_message_trigger, trigger.TriggerManager.MIN_PRIORITY
         )
-        host.trigger.add("messageReceived", self.message_received_trigger)
+        host.trigger.add("message_received", self.message_received_trigger)
 
     def send_message_trigger(
         self, client, mess_data, pre_xml_treatments, post_xml_treatments
--- a/sat/plugins/plugin_xep_0045.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_xep_0045.py	Mon May 29 13:32:08 2023 +0200
@@ -155,7 +155,7 @@
 
         host.trigger.add("presence_available", self.presence_trigger)
         host.trigger.add("presence_received", self.presence_received_trigger)
-        host.trigger.add("messageReceived", self.message_received_trigger, priority=1000000)
+        host.trigger.add("message_received", self.message_received_trigger, priority=1000000)
         host.trigger.add("message_parse", self._message_parse_trigger)
 
     async def profile_connected(self, client):
--- a/sat/plugins/plugin_xep_0071.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_xep_0071.py	Mon May 29 13:32:08 2023 +0200
@@ -100,7 +100,7 @@
             self.XHTML2XHTML_IM,
             [self._s.OPT_HIDDEN],
         )
-        host.trigger.add("messageReceived", self.message_received_trigger)
+        host.trigger.add("message_received", self.message_received_trigger)
         host.trigger.add("sendMessage", self.send_message_trigger)
 
     def get_handler(self, client):
@@ -109,7 +109,7 @@
     def _message_post_treat(self, data, message_elt, body_elts, client):
         """Callback which manage the post treatment of the message in case of XHTML-IM found
 
-        @param data: data send by messageReceived trigger through post_treat deferred
+        @param data: data send by message_received trigger through post_treat deferred
         @param message_elt: whole <message> stanza
         @param body_elts: XHTML-IM body elements found
         @return: the data with the extra parameter updated
--- a/sat/plugins/plugin_xep_0085.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_xep_0085.py	Mon May 29 13:32:08 2023 +0200
@@ -106,7 +106,7 @@
         host.memory.update_params(self.params)
 
         # triggers from core
-        host.trigger.add("messageReceived", self.message_received_trigger)
+        host.trigger.add("message_received", self.message_received_trigger)
         host.trigger.add("sendMessage", self.send_message_trigger)
         host.trigger.add("param_update_trigger", self.param_update_trigger)
 
--- a/sat/plugins/plugin_xep_0249.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_xep_0249.py	Mon May 29 13:32:08 2023 +0200
@@ -95,7 +95,7 @@
         except KeyError:
             log.info(_("Text commands not available"))
         host.register_namespace('x-conference', NS_X_CONFERENCE)
-        host.trigger.add("messageReceived", self._message_received_trigger)
+        host.trigger.add("message_received", self._message_received_trigger)
 
     def get_handler(self, client):
         return XEP_0249_handler()
--- a/sat/plugins/plugin_xep_0280.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_xep_0280.py	Mon May 29 13:32:08 2023 +0200
@@ -75,7 +75,7 @@
         log.info(_("Plugin XEP_0280 initialization"))
         self.host = host
         host.memory.update_params(self.params)
-        host.trigger.add("messageReceived", self.message_received_trigger, priority=200000)
+        host.trigger.add("message_received", self.message_received_trigger, priority=200000)
 
     def get_handler(self, client):
         return XEP_0280_handler()
--- a/sat/plugins/plugin_xep_0320.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_xep_0320.py	Mon May 29 13:32:08 2023 +0200
@@ -1,6 +1,5 @@
 #!/usr/bin/env python3
 
-
 # Libervia plugin
 # Copyright (C) 2009-2023 Jérôme Poisson (goffi@goffi.org)
 
--- a/sat/plugins/plugin_xep_0334.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_xep_0334.py	Mon May 29 13:32:08 2023 +0200
@@ -68,7 +68,7 @@
         log.info(_("Message Processing Hints plugin initialization"))
         self.host = host
         host.trigger.add("sendMessage", self.send_message_trigger)
-        host.trigger.add("messageReceived", self.message_received_trigger, priority=-1000)
+        host.trigger.add("message_received", self.message_received_trigger, priority=-1000)
 
     def get_handler(self, client):
         return XEP_0334_handler()
--- a/sat/plugins/plugin_xep_0353.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_xep_0353.py	Mon May 29 13:32:08 2023 +0200
@@ -55,7 +55,7 @@
         host.register_namespace("jingle-message", NS_JINGLE_MESSAGE)
         self._j = host.plugins["XEP-0166"]
         host.trigger.add("XEP-0166_initiate", self._on_initiate_trigger)
-        host.trigger.add("messageReceived", self._on_message_received)
+        host.trigger.add("message_received", self._on_message_received)
 
     def get_handler(self, client):
         return Handler()
--- a/sat/plugins/plugin_xep_0372.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_xep_0372.py	Mon May 29 13:32:08 2023 +0200
@@ -65,7 +65,7 @@
         host.register_namespace("refs", NS_REFS)
         self.host = host
         self._h = host.plugins["XEP-0334"]
-        host.trigger.add("messageReceived", self._message_received_trigger)
+        host.trigger.add("message_received", self._message_received_trigger)
         host.bridge.add_method(
             "reference_send",
             ".plugin",
--- a/sat/plugins/plugin_xep_0374.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_xep_0374.py	Mon May 29 13:32:08 2023 +0200
@@ -85,7 +85,7 @@
 
         # Triggers
         sat.trigger.add(
-            "messageReceived",
+            "message_received",
             self.__message_received_trigger,
             priority=100050
         )
--- a/sat/plugins/plugin_xep_0380.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_xep_0380.py	Mon May 29 13:32:08 2023 +0200
@@ -48,7 +48,7 @@
     def __init__(self, host):
         self.host = host
         host.trigger.add("sendMessage", self._send_message_trigger)
-        host.trigger.add("messageReceived", self._message_received_trigger, priority=100)
+        host.trigger.add("message_received", self._message_received_trigger, priority=100)
         host.register_namespace("eme", NS_EME)
 
     def _add_eme_element(self, mess_data, namespace, name):
--- a/sat/plugins/plugin_xep_0384.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_xep_0384.py	Mon May 29 13:32:08 2023 +0200
@@ -1578,9 +1578,9 @@
 
         # These triggers are used by oldmemo, which doesn't do SCE and only applies to
         # messages. Temporarily, until a more fitting trigger for SCE-based encryption is
-        # added, the messageReceived trigger is also used for twomemo.
+        # added, the message_received trigger is also used for twomemo.
         sat.trigger.add(
-            "messageReceived",
+            "message_received",
             self._message_received_trigger,
             priority=100050
         )
--- a/sat/plugins/plugin_xep_0424.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_xep_0424.py	Mon May 29 13:32:08 2023 +0200
@@ -74,7 +74,7 @@
         self._h = host.plugins["XEP-0334"]
         self._f = host.plugins["XEP-0422"]
         host.register_namespace("message-retract", NS_MESSAGE_RETRACT)
-        host.trigger.add("messageReceived", self._message_received_trigger, 100)
+        host.trigger.add("message_received", self._message_received_trigger, 100)
         host.bridge.add_method(
             "message_retract",
             ".plugin",
--- a/sat/plugins/plugin_xep_0444.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_xep_0444.py	Mon May 29 13:32:08 2023 +0200
@@ -64,7 +64,7 @@
             method=self._reactions_set,
             async_=True,
         )
-        host.trigger.add("messageReceived", self._message_received_trigger)
+        host.trigger.add("message_received", self._message_received_trigger)
 
     def get_handler(self, client):
         return XEP_0444_Handler()
--- a/sat/plugins/plugin_xep_0447.py	Mon May 15 17:19:54 2023 +0200
+++ b/sat/plugins/plugin_xep_0447.py	Mon May 29 13:32:08 2023 +0200
@@ -73,7 +73,7 @@
             self._u.namespace, "url-data", self._u.parse_url_data_elt
         )
         host.plugins["DOWNLOAD"].register_download_handler(self._u.namespace, self.download)
-        host.trigger.add("messageReceived", self._message_received_trigger)
+        host.trigger.add("message_received", self._message_received_trigger)
 
     def register_source_handler(
         self, namespace: str, element_name: str,