core, plugin watched: new plugin, show an alert when a watched entity goes online
This commit is contained in:
parent
1fde823a9c
commit
135fba2de1
1 changed files with 89 additions and 8 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue