Mercurial > libervia-backend
diff src/core/xmpp.py @ 1480:8d61160ee4b8
core, plugin watched: new plugin, show an alert when a watched entity goes online
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 20 Aug 2015 18:43:56 +0200 |
parents | 7797dda847ae |
children | 7d7e57a84792 |
line wrap: on
line diff
--- a/src/core/xmpp.py Thu Aug 20 18:41:06 2015 +0200 +++ b/src/core/xmpp.py Thu Aug 20 18:43:56 2015 +0200 @@ -350,6 +350,9 @@ if None in statuses: # we only want string keys statuses[C.PRESENCE_STATUSES_DEFAULT] = statuses.pop(None) + if not self.host.trigger.point("presenceReceived", entity, show, priority, statuses, self.parent.profile): + return + self.host.memory.setPresenceStatus(entity, show or "", int(priority), statuses, self.parent.profile) @@ -367,11 +370,12 @@ if None in statuses: # we only want string keys statuses[C.PRESENCE_STATUSES_DEFAULT] = statuses.pop(None) - self.host.memory.setPresenceStatus(entity, "unavailable", 0, statuses, self.parent.profile) if not self.host.trigger.point("presenceReceived", entity, "unavailable", 0, statuses, self.parent.profile): return + self.host.memory.setPresenceStatus(entity, C.PRESENCE_UNAVAILABLE, 0, statuses, self.parent.profile) + # now it's time to notify frontends self.host.bridge.presenceUpdate(entity.full(), "unavailable", 0, statuses, self.parent.profile)