comparison sat/plugins/plugin_xep_0060.py @ 2643:189e38fb11ff

core: style improvments (90 chars limit)
author Goffi <goffi@goffi.org>
date Sun, 29 Jul 2018 18:44:27 +0200
parents 56f94936df1e
children 1bf7e89fded0
comparison
equal deleted inserted replaced
2642:755a0b8643bd 2643:189e38fb11ff
518 ) 518 )
519 except StopIteration: 519 except StopIteration:
520 raise exceptions.DataError(u"Can't find Item in MAM message element") 520 raise exceptions.DataError(u"Can't find Item in MAM message element")
521 return item_elt 521 return item_elt
522 522
523 def _getItems( 523 def _getItems(self, service="", node="", max_items=10, item_ids=None, sub_id=None,
524 self, 524 extra_dict=None, profile_key=C.PROF_KEY_NONE):
525 service="",
526 node="",
527 max_items=10,
528 item_ids=None,
529 sub_id=None,
530 extra_dict=None,
531 profile_key=C.PROF_KEY_NONE,
532 ):
533 """Get items from pubsub node 525 """Get items from pubsub node
534 526
535 @param max_items(int): maximum number of item to get, C.NO_LIMIT for no limit 527 @param max_items(int): maximum number of item to get, C.NO_LIMIT for no limit
536 """ 528 """
537 client = self.host.getClient(profile_key) 529 client = self.host.getClient(profile_key)
549 extra.extra, 541 extra.extra,
550 ) 542 )
551 d.addCallback(self.serItemsData) 543 d.addCallback(self.serItemsData)
552 return d 544 return d
553 545
554 def getItems( 546 def getItems(self, client, service, node, max_items=None, item_ids=None, sub_id=None,
555 self, 547 rsm_request=None, extra=None):
556 client,
557 service,
558 node,
559 max_items=None,
560 item_ids=None,
561 sub_id=None,
562 rsm_request=None,
563 extra=None,
564 ):
565 """Retrieve pubsub items from a node. 548 """Retrieve pubsub items from a node.
566 549
567 @param service (JID, None): pubsub service. 550 @param service (JID, None): pubsub service.
568 @param node (str): node id. 551 @param node (str): node id.
569 @param max_items (int): optional limit on the number of retrieved items. 552 @param max_items (int): optional limit on the number of retrieved items.
676 # log.debug(u"Skip the items retrieval for [{node}]: node doesn't exist".format(node=node)) 659 # log.debug(u"Skip the items retrieval for [{node}]: node doesn't exist".format(node=node))
677 # continue # avoid pubsub "item-not-found" error 660 # continue # avoid pubsub "item-not-found" error
678 # d_dict[publisher] = self.getItems(service, node, max_items, None, sub_id, rsm, client.profile) 661 # d_dict[publisher] = self.getItems(service, node, max_items, None, sub_id, rsm, client.profile)
679 # defer.returnValue(d_dict) 662 # defer.returnValue(d_dict)
680 663
681 def getOptions( 664 def getOptions(self, service, nodeIdentifier, subscriber, subscriptionIdentifier=None,
682 self, 665 profile_key=C.PROF_KEY_NONE):
683 service,
684 nodeIdentifier,
685 subscriber,
686 subscriptionIdentifier=None,
687 profile_key=C.PROF_KEY_NONE,
688 ):
689 client = self.host.getClient(profile_key) 666 client = self.host.getClient(profile_key)
690 return client.pubsub_client.getOptions( 667 return client.pubsub_client.getOptions(
691 service, nodeIdentifier, subscriber, subscriptionIdentifier 668 service, nodeIdentifier, subscriber, subscriptionIdentifier
692 ) 669 )
693 670
694 def setOptions( 671 def setOptions(self, service, nodeIdentifier, subscriber, options,
695 self, 672 subscriptionIdentifier=None, profile_key=C.PROF_KEY_NONE):
696 service,
697 nodeIdentifier,
698 subscriber,
699 options,
700 subscriptionIdentifier=None,
701 profile_key=C.PROF_KEY_NONE,
702 ):
703 client = self.host.getClient(profile_key) 673 client = self.host.getClient(profile_key)
704 return client.pubsub_client.setOptions( 674 return client.pubsub_client.setOptions(
705 service, nodeIdentifier, subscriber, options, subscriptionIdentifier 675 service, nodeIdentifier, subscriber, options, subscriptionIdentifier
706 ) 676 )
707 677