Mercurial > libervia-backend
diff src/plugins/plugin_xep_0277.py @ 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 | 3c0bb714a80b |
children | 085f29c20f7e |
line wrap: on
line diff
--- 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)