Dont fail on malformed pubsub events
This commit is contained in:
parent
b9b9dae6a0
commit
0b6fac44dc
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue