Commit a1f0d26a authored by Philipp Hörist's avatar Philipp Hörist
Browse files

Pubsub: Handle only new item notifications

parent 1cbd94ea
...@@ -42,6 +42,7 @@ class PubSub: ...@@ -42,6 +42,7 @@ class PubSub:
] ]
def _process_pubsub_base(self, _con, stanza, properties): def _process_pubsub_base(self, _con, stanza, properties):
properties.pubsub = True
event = stanza.getTag('event', namespace=NS_PUBSUB_EVENT) event = stanza.getTag('event', namespace=NS_PUBSUB_EVENT)
items = event.getTag('items') items = event.getTag('items')
if len(items.getChildren()) != 1: if len(items.getChildren()) != 1:
...@@ -49,6 +50,8 @@ class PubSub: ...@@ -49,6 +50,8 @@ class PubSub:
log.warning(stanza) log.warning(stanza)
node = items.getAttr('node') node = items.getAttr('node')
item = items.getTag('item') item = items.getTag('item')
if item is None:
return
id_ = item.getAttr('id') id_ = item.getAttr('id')
properties.pubsub_event = PubSubEventData(node, id_, item, None) properties.pubsub_event = PubSubEventData(node, id_, item, None)
......
...@@ -109,8 +109,13 @@ class MessageProperties: ...@@ -109,8 +109,13 @@ class MessageProperties:
self.voice_request = None self.voice_request = None
self.self_message = False self.self_message = False
self.mam = None self.mam = None
self.pubsub = False
self.pubsub_event = None self.pubsub_event = None
@property
def is_pubsub(self):
return self.pubsub
@property @property
def is_pubsub_event(self): def is_pubsub_event(self):
return self.pubsub_event is not None return self.pubsub_event is not None
......
Supports Markdown
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