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