comparison sat_tmp/wokkel/rsm.py @ 58:f4d569dc8e6b

wokkel/mam, wokkel/pubsub, wokkel/rsm: implemented "order-by" protoXEP (for Pubsub and MAM)
author Goffi <goffi@goffi.org>
date Sun, 06 Jan 2019 17:25:30 +0100
parents c8cb4e867897
children 938c740d31fe
comparison
equal deleted inserted replaced
57:a1ae63fe666d 58:f4d569dc8e6b
343 class PubSubClient(pubsub.PubSubClient): 343 class PubSubClient(pubsub.PubSubClient):
344 """PubSubClient extension to handle RSM.""" 344 """PubSubClient extension to handle RSM."""
345 345
346 _request_class = PubSubRequest 346 _request_class = PubSubRequest
347 347
348 def items(self, service, nodeIdentifier, maxItems=None, itemIdentifiers=None, 348 def items(self, service, nodeIdentifier, maxItems=None,
349 subscriptionIdentifier=None, sender=None, rsm_request=None): 349 subscriptionIdentifier=None, sender=None, itemIdentifiers=None,
350 orderBy=None, rsm_request=None):
350 """ 351 """
351 Retrieve previously published items from a publish subscribe node. 352 Retrieve previously published items from a publish subscribe node.
352 353
353 @param service: The publish subscribe service that keeps the node. 354 @param service: The publish subscribe service that keeps the node.
354 @type service: L{JID<twisted.words.protocols.jabber.jid.JID>} 355 @type service: L{JID<twisted.words.protocols.jabber.jid.JID>}
356 @param nodeIdentifier: The identifier of the node. 357 @param nodeIdentifier: The identifier of the node.
357 @type nodeIdentifier: C{unicode} 358 @type nodeIdentifier: C{unicode}
358 359
359 @param maxItems: Optional limit on the number of retrieved items. 360 @param maxItems: Optional limit on the number of retrieved items.
360 @type maxItems: C{int} 361 @type maxItems: C{int}
361
362 @param itemIdentifiers: Identifiers of the items to be retrieved.
363 @type itemIdentifiers: C{set}
364 362
365 @param subscriptionIdentifier: Optional subscription identifier. In 363 @param subscriptionIdentifier: Optional subscription identifier. In
366 case the node has been subscribed to multiple times, this narrows 364 case the node has been subscribed to multiple times, this narrows
367 the results to the specific subscription. 365 the results to the specific subscription.
368 @type subscriptionIdentifier: C{unicode} 366 @type subscriptionIdentifier: C{unicode}
367
368 @param itemIdentifiers: Identifiers of the items to be retrieved.
369 @type itemIdentifiers: C{set}
370
371 @param orderBy: Keys to order by
372 @type orderBy: L{list} of L{unicode}
369 373
370 @param ext_data: extension data. 374 @param ext_data: extension data.
371 @type ext_data: L{dict} 375 @type ext_data: L{dict}
372 376
373 @return: a Deferred that fires a C{list} of C{tuple} of L{domish.Element}, L{RSMResponse}. 377 @return: a Deferred that fires a C{list} of C{tuple} of L{domish.Element}, L{RSMResponse}.
381 if maxItems: 385 if maxItems:
382 request.maxItems = str(int(maxItems)) 386 request.maxItems = str(int(maxItems))
383 request.subscriptionIdentifier = subscriptionIdentifier 387 request.subscriptionIdentifier = subscriptionIdentifier
384 request.sender = sender 388 request.sender = sender
385 request.itemIdentifiers = itemIdentifiers 389 request.itemIdentifiers = itemIdentifiers
390 request.orderBy = orderBy
386 request.rsm = rsm_request 391 request.rsm = rsm_request
387 392
388 def cb(iq): 393 def cb(iq):
389 items = [] 394 items = []
390 pubsub_elt = iq.pubsub 395 pubsub_elt = iq.pubsub