Philipp Hörist pushed to branch master at gajim / gajim

Commits:
0b6fac44 by Philipp Hörist at 2019-02-01T16:03:46Z
Dont fail on malformed pubsub events

- - - - -


3 changed files:

- gajim/common/modules/user_activity.py
- gajim/common/modules/user_mood.py
- gajim/common/modules/util.py


Changes:

=====================================
gajim/common/modules/user_activity.py
=====================================
@@ -45,6 +45,8 @@ 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
         for contact in app.contacts.get_contacts(self._account,
                                                  str(properties.jid)):
             if data.activity is not None:


=====================================
gajim/common/modules/user_mood.py
=====================================
@@ -45,6 +45,8 @@ 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
         for contact in app.contacts.get_contacts(self._account,
                                                  str(properties.jid)):
             if data.mood is not None:


=====================================
gajim/common/modules/util.py
=====================================
@@ -55,6 +55,8 @@ def event_node(node):
     def event_node_decorator(func):
         @wraps(func)
         def func_wrapper(self, _con, _stanza, properties):
+            if not properties.is_pubsub_event:
+                return
             if properties.pubsub_event.node != node:
                 return
             func(self, _con, _stanza, properties)



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/0b6fac44dc4775e667ac8d956df2295c8b0766d2

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/0b6fac44dc4775e667ac8d956df2295c8b0766d2
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to