Better handle disable notifitcations
This commit is contained in:
parent
59b39b049a
commit
3f03e6e0a4
2 changed files with 8 additions and 8 deletions
|
@ -45,17 +45,17 @@ class UserActivity(BaseModule):
|
||||||
@event_node(nbxmpp.NS_ACTIVITY)
|
@event_node(nbxmpp.NS_ACTIVITY)
|
||||||
def _activity_received(self, _con, _stanza, properties):
|
def _activity_received(self, _con, _stanza, properties):
|
||||||
data = properties.pubsub_event.data
|
data = properties.pubsub_event.data
|
||||||
if data is None:
|
empty = properties.pubsub_event.empty
|
||||||
return
|
|
||||||
for contact in app.contacts.get_contacts(self._account,
|
for contact in app.contacts.get_contacts(self._account,
|
||||||
str(properties.jid)):
|
str(properties.jid)):
|
||||||
if data.activity is not None:
|
if not empty:
|
||||||
contact.pep[PEPEventType.ACTIVITY] = data
|
contact.pep[PEPEventType.ACTIVITY] = data
|
||||||
else:
|
else:
|
||||||
contact.pep.pop(PEPEventType.ACTIVITY, None)
|
contact.pep.pop(PEPEventType.ACTIVITY, None)
|
||||||
|
|
||||||
if properties.is_self_message:
|
if properties.is_self_message:
|
||||||
if data.activity is not None:
|
if not empty:
|
||||||
self._con.pep[PEPEventType.ACTIVITY] = data
|
self._con.pep[PEPEventType.ACTIVITY] = data
|
||||||
else:
|
else:
|
||||||
self._con.pep.pop(PEPEventType.ACTIVITY, None)
|
self._con.pep.pop(PEPEventType.ACTIVITY, None)
|
||||||
|
|
|
@ -45,17 +45,17 @@ class UserMood(BaseModule):
|
||||||
@event_node(nbxmpp.NS_MOOD)
|
@event_node(nbxmpp.NS_MOOD)
|
||||||
def _mood_received(self, _con, _stanza, properties):
|
def _mood_received(self, _con, _stanza, properties):
|
||||||
data = properties.pubsub_event.data
|
data = properties.pubsub_event.data
|
||||||
if data is None:
|
empty = properties.pubsub_event.empty
|
||||||
return
|
|
||||||
for contact in app.contacts.get_contacts(self._account,
|
for contact in app.contacts.get_contacts(self._account,
|
||||||
str(properties.jid)):
|
str(properties.jid)):
|
||||||
if data.mood is not None:
|
if not empty:
|
||||||
contact.pep[PEPEventType.MOOD] = data
|
contact.pep[PEPEventType.MOOD] = data
|
||||||
else:
|
else:
|
||||||
contact.pep.pop(PEPEventType.MOOD, None)
|
contact.pep.pop(PEPEventType.MOOD, None)
|
||||||
|
|
||||||
if properties.is_self_message:
|
if properties.is_self_message:
|
||||||
if data.mood is not None:
|
if not empty:
|
||||||
self._con.pep[PEPEventType.MOOD] = data
|
self._con.pep[PEPEventType.MOOD] = data
|
||||||
else:
|
else:
|
||||||
self._con.pep.pop(PEPEventType.MOOD, None)
|
self._con.pep.pop(PEPEventType.MOOD, None)
|
||||||
|
|
Loading…
Add table
Reference in a new issue