Commit 0b6fac44 authored by Philipp Hörist's avatar Philipp Hörist

Dont fail on malformed pubsub events

parent b9b9dae6
Pipeline #3008 passed with stages
in 3 minutes and 43 seconds
......@@ -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:
......
......@@ -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:
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment