Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0163.py @ 2305:972e33507609
plugin XEP-0060: addManagedNode callbacks now use client syntax instead of profile
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 05 Jul 2017 15:04:43 +0200 |
parents | b5befe7722d3 |
children | 8b37a62336c3 |
comparison
equal
deleted
inserted
replaced
2304:666ad9de044c | 2305:972e33507609 |
---|---|
76 if out_callback: | 76 if out_callback: |
77 self.pep_out_cb[event_type] = out_callback | 77 self.pep_out_cb[event_type] = out_callback |
78 self.pep_events.add(node) | 78 self.pep_events.add(node) |
79 if notify: | 79 if notify: |
80 self.pep_events.add(node + "+notify") | 80 self.pep_events.add(node + "+notify") |
81 def filterPEPEvent(itemsEvent, profile): | 81 def filterPEPEvent(client, itemsEvent): |
82 """Ignore messages which are not coming from PEP (i.e. main server) | 82 """Ignore messages which are not coming from PEP (i.e. main server) |
83 | 83 |
84 @param itemsEvent(pubsub.ItemsEvent): pubsub event | 84 @param itemsEvent(pubsub.ItemsEvent): pubsub event |
85 @param profile(unicode): %(doc_profile)s | |
86 """ | 85 """ |
87 if itemsEvent.sender.user or itemsEvent.sender.resource: | 86 if itemsEvent.sender.user or itemsEvent.sender.resource: |
88 log.debug("ignoring non PEP event from {} (profile={})".format(itemsEvent.sender.full(), profile)) | 87 log.debug("ignoring non PEP event from {} (profile={})".format(itemsEvent.sender.full(), client.profile)) |
89 return | 88 return |
90 in_callback(itemsEvent, profile) | 89 in_callback(itemsEvent, client.profile) |
91 | 90 |
92 self.host.plugins["XEP-0060"].addManagedNode(node, items_cb=filterPEPEvent) | 91 self.host.plugins["XEP-0060"].addManagedNode(node, items_cb=filterPEPEvent) |
93 | 92 |
94 def sendPEPEvent(self, node, data, profile): | 93 def sendPEPEvent(self, node, data, profile): |
95 """Publish the event data | 94 """Publish the event data |