comparison src/plugins/plugin_xep_0060.py @ 1260:c8cf61c6d238

plugin pubsub: fixed redefinition of PubSubRequest
author Goffi <goffi@goffi.org>
date Fri, 21 Nov 2014 16:36:24 +0100
parents 633fcd13a7dc
children 93bce9e4c9c8
comparison
equal deleted inserted replaced
1259:633fcd13a7dc 1260:c8cf61c6d238
23 log = getLogger(__name__) 23 log = getLogger(__name__)
24 from sat.memory.memory import Sessions 24 from sat.memory.memory import Sessions
25 25
26 from wokkel.compat import IQ 26 from wokkel.compat import IQ
27 from wokkel import disco, pubsub 27 from wokkel import disco, pubsub
28 from wokkel.pubsub import PubSubRequest, NS_PUBSUB
29 from zope.interface import implements 28 from zope.interface import implements
30 from twisted.internet import defer 29 from twisted.internet import defer
31 30
32 31
33 PLUGIN_INFO = { 32 PLUGIN_INFO = {
284 request.itemIdentifiers = itemIdentifiers # XXX: this line has been added 283 request.itemIdentifiers = itemIdentifiers # XXX: this line has been added
285 284
286 def cb(iq): 285 def cb(iq):
287 items = [] 286 items = []
288 for element in iq.pubsub.items.elements(): 287 for element in iq.pubsub.items.elements():
289 if element.uri == NS_PUBSUB and element.name == 'item': 288 if element.uri == pubsub.NS_PUBSUB and element.name == 'item':
290 items.append(element) 289 items.append(element)
291 # TODO: return (items, self.host.plugins['XEP-0059'].extractMetadata(iq)) ?? 290 # TODO: return (items, self.host.plugins['XEP-0059'].extractMetadata(iq)) ??
292 return items 291 return items
293 292
294 d = request.send(self.xmlstream) 293 d = request.send(self.xmlstream)
340 request.recipient = service 339 request.recipient = service
341 request.nodeIdentifier = nodeIdentifier 340 request.nodeIdentifier = nodeIdentifier
342 request.sender = sender 341 request.sender = sender
343 iq = yield request.send(self.xmlstream) 342 iq = yield request.send(self.xmlstream)
344 defer.returnValue([sub for sub in iq.pubsub.subscriptions.elements() if 343 defer.returnValue([sub for sub in iq.pubsub.subscriptions.elements() if
345 (sub.uri == NS_PUBSUB and sub.name == 'subscription')]) 344 (sub.uri == pubsub.NS_PUBSUB and sub.name == 'subscription')])
346 345
347 def getDiscoInfo(self, requestor, service, nodeIdentifier=''): 346 def getDiscoInfo(self, requestor, service, nodeIdentifier=''):
348 disco_info = [] 347 disco_info = []
349 self.host.trigger.point("PubSub Disco Info", disco_info, self.parent.profile) 348 self.host.trigger.point("PubSub Disco Info", disco_info, self.parent.profile)
350 return disco_info 349 return disco_info