core, plugin watched: new plugin, show an alert when a watched entity goes online

This commit is contained in:
Goffi 2015-08-20 18:43:56 +02:00
commit 135fba2de1

View file

@ -350,6 +350,9 @@ class SatPresenceProtocol(xmppim.PresenceClientProtocol):
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 @@ class SatPresenceProtocol(xmppim.PresenceClientProtocol):
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)