comparison src/plugins/plugin_xep_0277.py @ 1775:0876352459e5

plugin XEP-0277: ignore maxItems if it is null
author Goffi <goffi@goffi.org>
date Tue, 05 Jan 2016 23:20:22 +0100
parents b77dc676a4df
children 1fa50da8bfbe
comparison
equal deleted inserted replaced
1774:0c21dafedd22 1775:0876352459e5
541 @param max_items(int): maximum number of item to get, C.NO_LIMIT for no limit 541 @param max_items(int): maximum number of item to get, C.NO_LIMIT for no limit
542 @param item_ids (list[unicode]): list of item IDs 542 @param item_ids (list[unicode]): list of item IDs
543 """ 543 """
544 max_items = None if max_items == C.NO_LIMIT else max_items 544 max_items = None if max_items == C.NO_LIMIT else max_items
545 extra = self._p.parseExtra(extra_dict) 545 extra = self._p.parseExtra(extra_dict)
546 return self.mbGet(jid.JID(service_jid_s), node or None, max_items, item_ids, extra.rsm_request, extra.extra, profile_key) 546 return self.mbGet(jid.JID(service_jid_s), node or None, max_items or None, item_ids, extra.rsm_request, extra.extra, profile_key)
547 547
548 @defer.inlineCallbacks 548 @defer.inlineCallbacks
549 def mbGet(self, service_jid, node=None, max_items=None, item_ids=None, rsm_request=None, extra=None, profile_key=C.PROF_KEY_NONE): 549 def mbGet(self, service_jid, node=None, max_items=None, item_ids=None, rsm_request=None, extra=None, profile_key=C.PROF_KEY_NONE):
550 """Get some microblogs 550 """Get some microblogs
551 551
740 @param max_items(int): maximum number of item to get, C.NO_LIMIT for no limit 740 @param max_items(int): maximum number of item to get, C.NO_LIMIT for no limit
741 """ 741 """
742 max_items = None if max_items == C.NO_LIMIT else max_items 742 max_items = None if max_items == C.NO_LIMIT else max_items
743 publishers_type, publishers = self._checkPublishers(publishers_type, publishers) 743 publishers_type, publishers = self._checkPublishers(publishers_type, publishers)
744 extra = self._p.parseExtra(extra_dict) 744 extra = self._p.parseExtra(extra_dict)
745 return self.mbGetFromMany(publishers_type, publishers, max_items, extra.rsm_request, extra.extra, profile_key) 745 return self.mbGetFromMany(publishers_type, publishers, max_items or None, extra.rsm_request, extra.extra, profile_key)
746 746
747 def mbGetFromMany(self, publishers_type, publishers, max_items=None, rsm_request=None, extra=None, profile_key=C.PROF_KEY_NONE): 747 def mbGetFromMany(self, publishers_type, publishers, max_items=None, rsm_request=None, extra=None, profile_key=C.PROF_KEY_NONE):
748 """Get the published microblogs for a list of groups or jids 748 """Get the published microblogs for a list of groups or jids
749 749
750 @param publishers_type (str): type of the list of publishers (one of "GROUP" or "JID" or "ALL") 750 @param publishers_type (str): type of the list of publishers (one of "GROUP" or "JID" or "ALL")
797 max_items = None if max_items == C.NO_LIMIT else max_items 797 max_items = None if max_items == C.NO_LIMIT else max_items
798 max_comments = None if max_comments == C.NO_LIMIT else max_comments 798 max_comments = None if max_comments == C.NO_LIMIT else max_comments
799 publishers_type, publishers = self._checkPublishers(publishers_type, publishers) 799 publishers_type, publishers = self._checkPublishers(publishers_type, publishers)
800 extra = self._p.parseExtra(extra_dict) 800 extra = self._p.parseExtra(extra_dict)
801 extra_comments = self._p.parseExtra(extra_comments_dict) 801 extra_comments = self._p.parseExtra(extra_comments_dict)
802 return self.mbGetFromManyWithComments(publishers_type, publishers, max_items, max_comments, 802 return self.mbGetFromManyWithComments(publishers_type, publishers, max_items or None, max_comments,
803 extra.rsm_request, 803 extra.rsm_request,
804 extra.extra, 804 extra.extra,
805 extra_comments.rsm_request, 805 extra_comments.rsm_request,
806 extra_comments.extra, 806 extra_comments.extra,
807 profile_key) 807 profile_key)
887 @param profile_key: %(doc_profile_key)s 887 @param profile_key: %(doc_profile_key)s
888 @return: a deferred unicode (atom XML feed) 888 @return: a deferred unicode (atom XML feed)
889 """ 889 """
890 max_items = None if max_items == C.NO_LIMIT else max_items 890 max_items = None if max_items == C.NO_LIMIT else max_items
891 extra = self._p.parseExtra(extra_dict) 891 extra = self._p.parseExtra(extra_dict)
892 return self.mbGetAtom(jid.JID(service_jid_s), node or None, max_items, item_ids, extra.rsm_request, extra.extra, profile_key) 892 return self.mbGetAtom(jid.JID(service_jid_s), node or None, max_items or None, item_ids, extra.rsm_request, extra.extra, profile_key)
893 893
894 @defer.inlineCallbacks 894 @defer.inlineCallbacks
895 def mbGetAtom(self, service_jid, node=None, max_items=None, item_ids=None, rsm_request=None, extra=None, profile_key=C.PROF_KEY_NONE): 895 def mbGetAtom(self, service_jid, node=None, max_items=None, item_ids=None, rsm_request=None, extra=None, profile_key=C.PROF_KEY_NONE):
896 """Get the atom feed of the last published microblogs 896 """Get the atom feed of the last published microblogs
897 897