plugin XEP-0060: addManagedNode callbacks now use client syntax instead of profile

This commit is contained in:
Goffi 2017-07-05 15:04:43 +02:00
commit c56d3fc759

View file

@ -78,16 +78,15 @@ class XEP_0163(object):
self.pep_events.add(node)
if notify:
self.pep_events.add(node + "+notify")
def filterPEPEvent(itemsEvent, profile):
def filterPEPEvent(client, itemsEvent):
"""Ignore messages which are not coming from PEP (i.e. main server)
@param itemsEvent(pubsub.ItemsEvent): pubsub event
@param profile(unicode): %(doc_profile)s
"""
if itemsEvent.sender.user or itemsEvent.sender.resource:
log.debug("ignoring non PEP event from {} (profile={})".format(itemsEvent.sender.full(), profile))
log.debug("ignoring non PEP event from {} (profile={})".format(itemsEvent.sender.full(), client.profile))
return
in_callback(itemsEvent, profile)
in_callback(itemsEvent, client.profile)
self.host.plugins["XEP-0060"].addManagedNode(node, items_cb=filterPEPEvent)