changeset 3172:dcebc585c29f

core: renamed "MessageReceived" trigger to "messageReceived" for consistency.
author Goffi <goffi@goffi.org>
date Tue, 18 Feb 2020 18:13:19 +0100
parents d073d82d9044
children 343b8076e967
files sat/core/xmpp.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_otr.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_0334.py sat/plugins/plugin_xep_0380.py sat/plugins/plugin_xep_0384.py
diffstat 15 files changed, 24 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/sat/core/xmpp.py	Tue Feb 18 18:13:18 2020 +0100
+++ b/sat/core/xmpp.py	Tue Feb 18 18:13:19 2020 +0100
@@ -1081,7 +1081,7 @@
     def _onMessageStartWorkflow(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 messageReceived 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
@@ -1108,7 +1108,7 @@
         post_treat = defer.Deferred()
 
         d = self.host.trigger.asyncPoint(
-            "MessageReceived", client, message_elt, post_treat
+            "messageReceived", client, message_elt, post_treat
         )
 
         d.addCallback(self._onMessageStartWorkflow, client, message_elt, post_treat)
--- a/sat/plugins/plugin_exp_command_export.py	Tue Feb 18 18:13:18 2020 +0100
+++ b/sat/plugins/plugin_exp_command_export.py	Tue Feb 18 18:13:19 2020 +0100
@@ -92,7 +92,7 @@
         log.info(_("Plugin command export initialization"))
         self.host = host
         self.spawned = {}  # key = entity
-        host.trigger.add("MessageReceived", self.MessageReceivedTrigger, priority=10000)
+        host.trigger.add("messageReceived", self.messageReceivedTrigger, priority=10000)
         host.bridge.addMethod(
             "exportCommand",
             ".plugin",
@@ -113,7 +113,7 @@
         except ValueError:
             pass
 
-    def MessageReceivedTrigger(self, client, message_elt, post_treat):
+    def messageReceivedTrigger(self, client, message_elt, post_treat):
         """ Check if source is linked and repeat message, else do nothing  """
         from_jid = jid.JID(message_elt["from"])
         spawned_key = (from_jid.userhostJID(), client.profile)
@@ -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 messageReceived handling
         """
         client = self.host.getClient(profile_key)
         for target in targets:
--- a/sat/plugins/plugin_exp_lang_detect.py	Tue Feb 18 18:13:18 2020 +0100
+++ b/sat/plugins/plugin_exp_lang_detect.py	Tue Feb 18 18:13:19 2020 +0100
@@ -66,7 +66,7 @@
         log.info(_("Language detection plugin initialization"))
         self.host = host
         host.memory.updateParams(PARAMS)
-        host.trigger.add("MessageReceived", self.MessageReceivedTrigger)
+        host.trigger.add("messageReceived", self.messageReceivedTrigger)
         host.trigger.add("sendMessage", self.MessageSendTrigger)
 
     def addLanguage(self, mess_data):
@@ -77,7 +77,7 @@
             mess_data["message"] = {lang: msg}
         return mess_data
 
-    def MessageReceivedTrigger(self, client, message_elt, post_treat):
+    def messageReceivedTrigger(self, client, message_elt, post_treat):
         """ Check if source is linked and repeat message, else do nothing  """
 
         lang_detect = self.host.memory.getParamA(
--- a/sat/plugins/plugin_exp_parrot.py	Tue Feb 18 18:13:18 2020 +0100
+++ b/sat/plugins/plugin_exp_parrot.py	Tue Feb 18 18:13:19 2020 +0100
@@ -55,7 +55,7 @@
     def __init__(self, host):
         log.info(_("Plugin Parrot initialization"))
         self.host = host
-        host.trigger.add("MessageReceived", self.MessageReceivedTrigger, priority=100)
+        host.trigger.add("messageReceived", self.messageReceivedTrigger, priority=100)
         # host.trigger.add("sendMessage", self.sendMessageTrigger, priority=100)
         try:
             self.host.plugins[C.TEXT_CMDS].registerTextCommands(self)
@@ -73,7 +73,7 @@
     #        log.debug("Parrot link detected, skipping other triggers")
     #        raise trigger.SkipOtherTriggers
 
-    def MessageReceivedTrigger(self, client, message_elt, post_treat):
+    def messageReceivedTrigger(self, client, message_elt, post_treat):
         """ Check if source is linked and repeat message, else do nothing  """
         # TODO: many things are not repeated (subject, thread, etc)
         profile = client.profile
--- a/sat/plugins/plugin_misc_android.py	Tue Feb 18 18:13:18 2020 +0100
+++ b/sat/plugins/plugin_misc_android.py	Tue Feb 18 18:13:19 2020 +0100
@@ -251,7 +251,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.messageReceivedTrigger, priority=-1000)
+        host.trigger.add("messageReceived", self.messageReceivedTrigger, priority=-1000)
 
         # profiles autoconnection
         host.bridge.addMethod(
--- a/sat/plugins/plugin_sec_otr.py	Tue Feb 18 18:13:18 2020 +0100
+++ b/sat/plugins/plugin_sec_otr.py	Tue Feb 18 18:13:19 2020 +0100
@@ -313,7 +313,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.MessageReceivedTrigger, priority=100000)
+        host.trigger.add("messageReceived", self.messageReceivedTrigger, priority=100000)
         host.trigger.add("sendMessage", self.sendMessageTrigger, priority=100000)
         host.trigger.add("sendMessageData", self._sendMessageDataTrigger)
         host.bridge.addMethod(
@@ -730,7 +730,7 @@
             data["history"] = C.HISTORY_SKIP
         return data
 
-    def MessageReceivedTrigger(self, client, message_elt, post_treat):
+    def messageReceivedTrigger(self, client, message_elt, post_treat):
         if message_elt.getAttribute("type") == C.MESS_TYPE_GROUPCHAT:
             # OTR is not possible in group chats
             return True
--- a/sat/plugins/plugin_xep_0033.py	Tue Feb 18 18:13:18 2020 +0100
+++ b/sat/plugins/plugin_xep_0033.py	Tue Feb 18 18:13:19 2020 +0100
@@ -79,7 +79,7 @@
         host.trigger.add(
             "sendMessage", self.sendMessageTrigger, trigger.TriggerManager.MIN_PRIORITY
         )
-        host.trigger.add("MessageReceived", self.messageReceivedTrigger)
+        host.trigger.add("messageReceived", self.messageReceivedTrigger)
 
     def sendMessageTrigger(
         self, client, mess_data, pre_xml_treatments, post_xml_treatments
--- a/sat/plugins/plugin_xep_0045.py	Tue Feb 18 18:13:18 2020 +0100
+++ b/sat/plugins/plugin_xep_0045.py	Tue Feb 18 18:13:19 2020 +0100
@@ -157,7 +157,7 @@
 
         host.trigger.add("presence_available", self.presenceTrigger)
         host.trigger.add("presence_received", self.presenceReceivedTrigger)
-        host.trigger.add("MessageReceived", self.messageReceivedTrigger, priority=1000000)
+        host.trigger.add("messageReceived", self.messageReceivedTrigger, priority=1000000)
         host.trigger.add("message_parse", self._message_parseTrigger)
 
     def profileConnected(self, client):
--- a/sat/plugins/plugin_xep_0071.py	Tue Feb 18 18:13:18 2020 +0100
+++ b/sat/plugins/plugin_xep_0071.py	Tue Feb 18 18:13:19 2020 +0100
@@ -100,7 +100,7 @@
             self.XHTML2XHTML_IM,
             [self._s.OPT_HIDDEN],
         )
-        host.trigger.add("MessageReceived", self.messageReceivedTrigger)
+        host.trigger.add("messageReceived", self.messageReceivedTrigger)
         host.trigger.add("sendMessage", self.sendMessageTrigger)
 
     def getHandler(self, client):
@@ -109,7 +109,7 @@
     def _messagePostTreat(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 messageReceived 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	Tue Feb 18 18:13:18 2020 +0100
+++ b/sat/plugins/plugin_xep_0085.py	Tue Feb 18 18:13:19 2020 +0100
@@ -106,7 +106,7 @@
         host.memory.updateParams(self.params)
 
         # triggers from core
-        host.trigger.add("MessageReceived", self.messageReceivedTrigger)
+        host.trigger.add("messageReceived", self.messageReceivedTrigger)
         host.trigger.add("sendMessage", self.sendMessageTrigger)
         host.trigger.add("paramUpdateTrigger", self.paramUpdateTrigger)
 
--- a/sat/plugins/plugin_xep_0249.py	Tue Feb 18 18:13:18 2020 +0100
+++ b/sat/plugins/plugin_xep_0249.py	Tue Feb 18 18:13:19 2020 +0100
@@ -94,7 +94,7 @@
         except KeyError:
             log.info(_("Text commands not available"))
         host.registerNamespace('x-conference', NS_X_CONFERENCE)
-        host.trigger.add("MessageReceived", self._MessageReceivedTrigger)
+        host.trigger.add("messageReceived", self._messageReceivedTrigger)
 
     def getHandler(self, client):
         return XEP_0249_handler()
@@ -143,7 +143,7 @@
         d = self.host.plugins["XEP-0045"].join(client, room_jid, client.jid.user, {})
         return d
 
-    def _MessageReceivedTrigger(self, client, message_elt, post_treat):
+    def _messageReceivedTrigger(self, client, message_elt, post_treat):
         """Check if a direct invitation is in the message, and handle it"""
         x_elt = next(message_elt.elements(NS_X_CONFERENCE, 'x'), None)
         if x_elt is None:
--- a/sat/plugins/plugin_xep_0280.py	Tue Feb 18 18:13:18 2020 +0100
+++ b/sat/plugins/plugin_xep_0280.py	Tue Feb 18 18:13:19 2020 +0100
@@ -75,7 +75,7 @@
         log.info(_("Plugin XEP_0280 initialization"))
         self.host = host
         host.memory.updateParams(self.params)
-        host.trigger.add("MessageReceived", self.messageReceivedTrigger, priority=200000)
+        host.trigger.add("messageReceived", self.messageReceivedTrigger, priority=200000)
 
     def getHandler(self, client):
         return XEP_0280_handler()
--- a/sat/plugins/plugin_xep_0334.py	Tue Feb 18 18:13:18 2020 +0100
+++ b/sat/plugins/plugin_xep_0334.py	Tue Feb 18 18:13:19 2020 +0100
@@ -65,7 +65,7 @@
         log.info(_("Message Processing Hints plugin initialization"))
         self.host = host
         host.trigger.add("sendMessage", self.sendMessageTrigger)
-        host.trigger.add("MessageReceived", self.messageReceivedTrigger, priority=-1000)
+        host.trigger.add("messageReceived", self.messageReceivedTrigger, priority=-1000)
 
     def getHandler(self, client):
         return XEP_0334_handler()
--- a/sat/plugins/plugin_xep_0380.py	Tue Feb 18 18:13:18 2020 +0100
+++ b/sat/plugins/plugin_xep_0380.py	Tue Feb 18 18:13:19 2020 +0100
@@ -48,7 +48,7 @@
     def __init__(self, host):
         self.host = host
         host.trigger.add("sendMessage", self._sendMessageTrigger)
-        host.trigger.add("MessageReceived", self._MessageReceivedTrigger, priority=100)
+        host.trigger.add("messageReceived", self._messageReceivedTrigger, priority=100)
         host.registerNamespace("eme", NS_EME)
 
     def _addEMEElement(self, mess_data, namespace, name):
@@ -71,7 +71,7 @@
                 self._addEMEElement, namespace=namespace, name=name)
         return True
 
-    def _MessageReceivedTrigger(self, client, message_elt, post_treat):
+    def _messageReceivedTrigger(self, client, message_elt, post_treat):
         try:
             encryption_elt = next(message_elt.elements(NS_EME, 'encryption'))
         except StopIteration:
--- a/sat/plugins/plugin_xep_0384.py	Tue Feb 18 18:13:18 2020 +0100
+++ b/sat/plugins/plugin_xep_0384.py	Tue Feb 18 18:13:19 2020 +0100
@@ -393,7 +393,7 @@
         self._p = host.plugins["XEP-0060"]
         self._m = host.plugins.get("XEP-0045")
         self._sid = host.plugins.get("XEP-0359")
-        host.trigger.add("MessageReceived", self._messageReceivedTrigger, priority=100050)
+        host.trigger.add("messageReceived", self._messageReceivedTrigger, priority=100050)
         host.trigger.add("sendMessageData", self._sendMessageDataTrigger)
         self.host.registerEncryptionPlugin(self, "OMEMO", NS_OMEMO, 100)
         pep = host.plugins['XEP-0163']