Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0277.py @ 2289:f8276bd8baf6
plugin XEP-0277: max_items fix (last "fix" about it was actually bad)
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 29 Jun 2017 23:40:12 +0200 |
parents | 330f8d4e2ad4 |
children | 972e33507609 |
comparison
equal
deleted
inserted
replaced
2288:f4d8d83a50e2 | 2289:f8276bd8baf6 |
---|---|
603 """ | 603 """ |
604 client = self.host.getClient(profile_key) | 604 client = self.host.getClient(profile_key) |
605 service = jid.JID(service) if service else None | 605 service = jid.JID(service) if service else None |
606 max_items = None if max_items == C.NO_LIMIT else max_items | 606 max_items = None if max_items == C.NO_LIMIT else max_items |
607 extra = self._p.parseExtra(extra_dict) | 607 extra = self._p.parseExtra(extra_dict) |
608 return self.mbGet(client, service, node or None, None if max_items==C.NO_LIMIT else None, item_ids, extra.rsm_request, extra.extra) | 608 return self.mbGet(client, service, node or None, max_items, item_ids, extra.rsm_request, extra.extra) |
609 | 609 |
610 | 610 |
611 @defer.inlineCallbacks | 611 @defer.inlineCallbacks |
612 def mbGet(self, client, service=None, node=None, max_items=10, item_ids=None, rsm_request=None, extra=None): | 612 def mbGet(self, client, service=None, node=None, max_items=10, item_ids=None, rsm_request=None, extra=None): |
613 """Get some microblogs | 613 """Get some microblogs |
802 @param max_items(int): maximum number of item to get, C.NO_LIMIT for no limit | 802 @param max_items(int): maximum number of item to get, C.NO_LIMIT for no limit |
803 """ | 803 """ |
804 max_items = None if max_items == C.NO_LIMIT else max_items | 804 max_items = None if max_items == C.NO_LIMIT else max_items |
805 publishers_type, publishers = self._checkPublishers(publishers_type, publishers) | 805 publishers_type, publishers = self._checkPublishers(publishers_type, publishers) |
806 extra = self._p.parseExtra(extra_dict) | 806 extra = self._p.parseExtra(extra_dict) |
807 return self.mbGetFromMany(publishers_type, publishers, None if max_items==C.NO_LIMIT else max_items, extra.rsm_request, extra.extra, profile_key) | 807 return self.mbGetFromMany(publishers_type, publishers, max_items, extra.rsm_request, extra.extra, profile_key) |
808 | 808 |
809 def mbGetFromMany(self, publishers_type, publishers, max_items=None, rsm_request=None, extra=None, profile_key=C.PROF_KEY_NONE): | 809 def mbGetFromMany(self, publishers_type, publishers, max_items=None, rsm_request=None, extra=None, profile_key=C.PROF_KEY_NONE): |
810 """Get the published microblogs for a list of groups or jids | 810 """Get the published microblogs for a list of groups or jids |
811 | 811 |
812 @param publishers_type (str): type of the list of publishers (one of "GROUP" or "JID" or "ALL") | 812 @param publishers_type (str): type of the list of publishers (one of "GROUP" or "JID" or "ALL") |
859 max_items = None if max_items == C.NO_LIMIT else max_items | 859 max_items = None if max_items == C.NO_LIMIT else max_items |
860 max_comments = None if max_comments == C.NO_LIMIT else max_comments | 860 max_comments = None if max_comments == C.NO_LIMIT else max_comments |
861 publishers_type, publishers = self._checkPublishers(publishers_type, publishers) | 861 publishers_type, publishers = self._checkPublishers(publishers_type, publishers) |
862 extra = self._p.parseExtra(extra_dict) | 862 extra = self._p.parseExtra(extra_dict) |
863 extra_comments = self._p.parseExtra(extra_comments_dict) | 863 extra_comments = self._p.parseExtra(extra_comments_dict) |
864 return self.mbGetFromManyWithComments(publishers_type, publishers, None if max_items==C.NO_LIMIT else max_items, max_comments or None, | 864 return self.mbGetFromManyWithComments(publishers_type, publishers, max_items, max_comments or None, |
865 extra.rsm_request, | 865 extra.rsm_request, |
866 extra.extra, | 866 extra.extra, |
867 extra_comments.rsm_request, | 867 extra_comments.rsm_request, |
868 extra_comments.extra, | 868 extra_comments.extra, |
869 profile_key) | 869 profile_key) |