diff --git a/sat/core/xmpp.py b/sat/core/xmpp.py index 985c68bc..49e7ded2 100644 --- a/sat/core/xmpp.py +++ b/sat/core/xmpp.py @@ -1247,7 +1247,7 @@ class SatPresenceProtocol(xmppim.PresenceClientProtocol): statuses[C.PRESENCE_STATUSES_DEFAULT] = statuses.pop(None) if not self.host.trigger.point( - "presenceReceived", entity, show, priority, statuses, self.parent.profile + "presence_received", self.parent, entity, show, priority, statuses ): return @@ -1273,7 +1273,7 @@ class SatPresenceProtocol(xmppim.PresenceClientProtocol): statuses[C.PRESENCE_STATUSES_DEFAULT] = statuses.pop(None) if not self.host.trigger.point( - "presenceReceived", entity, "unavailable", 0, statuses, self.parent.profile + "presence_received", self.parent, entity, C.PRESENCE_UNAVAILABLE, 0, statuses, ): return diff --git a/sat/plugins/plugin_misc_watched.py b/sat/plugins/plugin_misc_watched.py index f4674fec..aa9d478c 100755 --- a/sat/plugins/plugin_misc_watched.py +++ b/sat/plugins/plugin_misc_watched.py @@ -62,20 +62,22 @@ class Watched(object): 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 @@ class Watched(object): _(NOTIF).format(entity=entity.full()) ).toXml() }, - profile=profile, + profile=client.profile, ) return True diff --git a/sat/plugins/plugin_sec_otr.py b/sat/plugins/plugin_sec_otr.py index 138e2f98..5c99d25c 100644 --- a/sat/plugins/plugin_sec_otr.py +++ b/sat/plugins/plugin_sec_otr.py @@ -354,7 +354,7 @@ class OTR(object): # security_limit=0, # type_=C.MENU_SINGLE, # ) - host.trigger.add("presenceReceived", self._presenceReceivedTrigger) + host.trigger.add("presence_received", self._presenceReceivedTrigger) self.host.registerEncryptionPlugin(self, u"OTR", NS_OTR, directed=True) def _skipOTR(self, profile): @@ -810,10 +810,9 @@ class OTR(object): mess_data["to"] = to_jid return True - def _presenceReceivedTrigger(self, entity, show, priority, statuses, profile): + def _presenceReceivedTrigger(self, client, entity, show, priority, statuses): if show != C.PRESENCE_UNAVAILABLE: return True - client = self.host.getClient(profile) if not entity.resource: try: entity.resource = self.host.memory.getMainResource(