diff sat/plugins/plugin_misc_watched.py @ 2820:7ab8684784c6

core: renamed presenceReceived to presence_reveiced + use "client" as first arguments instead of "profile"
author Goffi <goffi@goffi.org>
date Fri, 01 Mar 2019 12:12:50 +0100
parents 003b8b4b56a7
children ab2696e34d29
line wrap: on
line diff
--- a/sat/plugins/plugin_misc_watched.py	Fri Mar 01 12:11:16 2019 +0100
+++ b/sat/plugins/plugin_misc_watched.py	Fri Mar 01 12:12:50 2019 +0100
@@ -62,20 +62,22 @@
         log.info(_("Watched initialisation"))
         self.host = host
         host.memory.updateParams(self.params)
-        host.trigger.add("presenceReceived", self._presenceReceivedTrigger)
+        host.trigger.add("presence_received", self._presenceReceivedTrigger)
 
-    def _presenceReceivedTrigger(self, entity, show, priority, statuses, profile):
+    def _presenceReceivedTrigger(self, client, entity, show, priority, statuses):
         if show == C.PRESENCE_UNAVAILABLE:
             return True
 
         # we check that the previous presence was unavailable (no notification else)
         try:
-            old_show = self.host.memory.getEntityDatum(entity, "presence", profile).show
+            old_show = self.host.memory.getEntityDatum(
+                entity, "presence", client.profile).show
         except (KeyError, exceptions.UnknownEntityError):
             old_show = C.PRESENCE_UNAVAILABLE
 
         if old_show == C.PRESENCE_UNAVAILABLE:
-            watched = self.host.memory.getParamA(NAME, CATEGORY, profile_key=profile)
+            watched = self.host.memory.getParamA(
+                NAME, CATEGORY, profile_key=client.profile)
             if entity in watched or entity.userhostJID() in watched:
                 self.host.actionNew(
                     {
@@ -83,7 +85,7 @@
                             _(NOTIF).format(entity=entity.full())
                         ).toXml()
                     },
-                    profile=profile,
+                    profile=client.profile,
                 )
 
         return True