From 3f03e6e0a4440d9addcd1df73d7258997e7145e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sat, 2 Feb 2019 12:55:07 +0100 Subject: [PATCH] Better handle disable notifitcations --- gajim/common/modules/user_activity.py | 8 ++++---- gajim/common/modules/user_mood.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gajim/common/modules/user_activity.py b/gajim/common/modules/user_activity.py index 6ec034560..e2ddea2fd 100644 --- a/gajim/common/modules/user_activity.py +++ b/gajim/common/modules/user_activity.py @@ -45,17 +45,17 @@ class UserActivity(BaseModule): @event_node(nbxmpp.NS_ACTIVITY) def _activity_received(self, _con, _stanza, properties): data = properties.pubsub_event.data - if data is None: - return + empty = properties.pubsub_event.empty + for contact in app.contacts.get_contacts(self._account, str(properties.jid)): - if data.activity is not None: + if not empty: contact.pep[PEPEventType.ACTIVITY] = data else: contact.pep.pop(PEPEventType.ACTIVITY, None) if properties.is_self_message: - if data.activity is not None: + if not empty: self._con.pep[PEPEventType.ACTIVITY] = data else: self._con.pep.pop(PEPEventType.ACTIVITY, None) diff --git a/gajim/common/modules/user_mood.py b/gajim/common/modules/user_mood.py index 4fe9b2737..9842b108d 100644 --- a/gajim/common/modules/user_mood.py +++ b/gajim/common/modules/user_mood.py @@ -45,17 +45,17 @@ class UserMood(BaseModule): @event_node(nbxmpp.NS_MOOD) def _mood_received(self, _con, _stanza, properties): data = properties.pubsub_event.data - if data is None: - return + empty = properties.pubsub_event.empty + for contact in app.contacts.get_contacts(self._account, str(properties.jid)): - if data.mood is not None: + if not empty: contact.pep[PEPEventType.MOOD] = data else: contact.pep.pop(PEPEventType.MOOD, None) if properties.is_self_message: - if data.mood is not None: + if not empty: self._con.pep[PEPEventType.MOOD] = data else: self._con.pep.pop(PEPEventType.MOOD, None)