Mercurial > libervia-backend
changeset 1865:fc6eeacf31bc
plugin XEP-0277: service can be None in mbGet, resulting in a request on default pubsub service of profile (i.e. profile's PEP)
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 01 Mar 2016 01:47:32 +0100 |
parents | 96ba685162f6 |
children | 397ef87958b9 |
files | src/plugins/plugin_xep_0060.py src/plugins/plugin_xep_0277.py |
diffstat | 2 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0060.py Mon Feb 29 16:52:51 2016 +0100 +++ b/src/plugins/plugin_xep_0060.py Tue Mar 01 01:47:32 2016 +0100 @@ -270,7 +270,7 @@ def getItems(self, service, node, max_items=None, item_ids=None, sub_id=None, rsm_request=None, extra=None, profile_key=C.PROF_KEY_NONE): """Retrieve pubsub items from a node. - @param service (JID): pubsub service. + @param service (JID, None): pubsub service. @param node (str): node id. @param max_items (int): optional limit on the number of retrieved items. @param item_ids (list[str]): identifiers of the items to be retrieved (can't be used with rsm_request).
--- a/src/plugins/plugin_xep_0277.py Mon Feb 29 16:52:51 2016 +0100 +++ b/src/plugins/plugin_xep_0277.py Tue Mar 01 01:47:32 2016 +0100 @@ -577,20 +577,23 @@ ## get ## - def _mbGet(self, service_jid_s, node="", max_items=10, item_ids=None, extra_dict=None, profile_key=C.PROF_KEY_NONE): + def _mbGet(self, service='', node='', max_items=10, item_ids=None, extra_dict=None, profile_key=C.PROF_KEY_NONE): """ @param max_items(int): maximum number of item to get, C.NO_LIMIT for no limit @param item_ids (list[unicode]): list of item IDs """ + service = jid.JID(service) if service else None max_items = None if max_items == C.NO_LIMIT else max_items extra = self._p.parseExtra(extra_dict) - return self.mbGet(jid.JID(service_jid_s), node or None, max_items or None, item_ids, extra.rsm_request, extra.extra, profile_key) + return self.mbGet(service, node or None, max_items or None, item_ids, extra.rsm_request, extra.extra, profile_key) + @defer.inlineCallbacks - def mbGet(self, service_jid, node=None, max_items=None, item_ids=None, rsm_request=None, extra=None, profile_key=C.PROF_KEY_NONE): + def mbGet(self, service=None, node=None, max_items=None, item_ids=None, rsm_request=None, extra=None, profile_key=C.PROF_KEY_NONE): """Get some microblogs - @param service_jid(jid.JID): jid of the publisher + @param service(jid.JID, None): jid of the publisher + None to get profile's PEP @param node(unicode, None): node to get (or microblog node if None) @param max_items(int): maximum number of item to get, C.NO_LIMIT for no limit @param item_ids (list[unicode]): list of item IDs @@ -602,7 +605,7 @@ """ if node is None: node = NS_MICROBLOG - items_data = yield self._p.getItems(service_jid, node, max_items=max_items, item_ids=item_ids, rsm_request=rsm_request, extra=extra, profile_key=profile_key) + items_data = yield self._p.getItems(service, node, max_items=max_items, item_ids=item_ids, rsm_request=rsm_request, extra=extra, profile_key=profile_key) serialised = yield self._p.serItemsDataD(items_data, self.item2mbdata) defer.returnValue(serialised)