diff src/plugins/plugin_xep_0277.py @ 1513:955221487a3e

plugin XEP-0277, quick_frontend: rename mbGetLast to mbGet and add it the parameter "item_ids"
author souliane <souliane@mailoo.org>
date Thu, 10 Sep 2015 07:39:09 +0200
parents 83f71763e1a7
children afa0894dcc71
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0277.py	Thu Sep 10 07:37:14 2015 +0200
+++ b/src/plugins/plugin_xep_0277.py	Thu Sep 10 07:39:09 2015 +0200
@@ -78,9 +78,9 @@
                               in_sign='ssss', out_sign='',
                               method=self._mbRetract,
                               async=True)
-        host.bridge.addMethod("mbGetLast", ".plugin",
-                              in_sign='ssia{ss}s', out_sign='(aa{ss}a{ss})',
-                              method=self._mbGetLast,
+        host.bridge.addMethod("mbGet", ".plugin",
+                              in_sign='ssiasa{ss}s', out_sign='(aa{ss}a{ss})',
+                              method=self._mbGet,
                               async=True)
         host.bridge.addMethod("mbSetAccess", ".plugin", in_sign='ss', out_sign='',
                               method=self.mbSetAccess,
@@ -487,21 +487,23 @@
 
     ## get ##
 
-    def _mbGetLast(self, service_jid_s, node="", max_items=10, extra_dict=None, profile_key=C.PROF_KEY_NONE):
+    def _mbGet(self, service_jid_s, 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
         """
         max_items = None if max_items == C.NO_LIMIT else max_items
         extra = self._p.parseExtra(extra_dict)
-        return self.mbGetLast(jid.JID(service_jid_s), node or None, max_items, extra.rsm_request, extra.extra, profile_key)
+        return self.mbGet(jid.JID(service_jid_s), node or None, max_items, item_ids, extra.rsm_request, extra.extra, profile_key)
 
     @defer.inlineCallbacks
-    def mbGetLast(self, service_jid, node=None, max_items=None, rsm_request=None, extra=None, profile_key=C.PROF_KEY_NONE):
+    def mbGet(self, service_jid, node=None, max_items=None, item_ids=None, rsm_request=None, extra=None, profile_key=C.PROF_KEY_NONE):
         """Get the last published microblogs
 
         @param service_jid(jid.JID): jid of the publisher
         @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
         @param rsm_request (rsm.RSMRequest): RSM request data
         @param profile_key: profile key
 
@@ -509,7 +511,7 @@
         """
         if node is None:
             node = NS_MICROBLOG
-        items_data = yield self._p.getItems(service_jid, node, max_items=max_items, rsm_request=rsm_request, extra=extra, profile_key=profile_key)
+        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)
         serialised = yield self._p.serItemsDataD(items_data, self.item2mbdata)
         defer.returnValue(serialised)
 
@@ -656,8 +658,8 @@
                 - service (unicode): pubsub service
                 - node (unicode): pubsub node
                 - failure (unicode): empty string in case of success, error message else
-                - items_data(list): data as returned by [mbGetLast]
-                - items_metadata(dict): metadata as returned by [mbGetLast]
+                - items_data(list): data as returned by [mbGet]
+                - items_metadata(dict): metadata as returned by [mbGet]
         @param profile_key: %(doc_profile_key)s
         """
         def onSuccess(items_data):