diff src/plugins/plugin_xep_0277.py @ 2360:72cbb6478f97

plugin XEP-0060: use client instead of profile_key in getItems
author Goffi <goffi@goffi.org>
date Sun, 24 Sep 2017 16:32:22 +0200
parents f9580b4a105a
children f57a8eaec8ed
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0277.py	Sun Sep 24 16:29:18 2017 +0200
+++ b/src/plugins/plugin_xep_0277.py	Sun Sep 24 16:32:22 2017 +0200
@@ -630,7 +630,7 @@
         """
         if node is None:
             node = NS_MICROBLOG
-        items_data = yield self._p.getItems(service, node, max_items=max_items, item_ids=item_ids, rsm_request=rsm_request, extra=extra, profile_key=client.profile)
+        items_data = yield self._p.getItems(client, service, node, max_items=max_items, item_ids=item_ids, rsm_request=rsm_request, extra=extra)
         serialised = yield self._p.serItemsDataD(items_data, self.item2mbdata)
         defer.returnValue(serialised)
 
@@ -892,6 +892,8 @@
         #      to serialise and associate the data, but it make life in frontends side
         #      a lot easier
 
+        client, node_data = self._getClientAndNodeData(publishers_type, publishers, profile_key)
+
         def getComments(items_data):
             """Retrieve comments and add them to the items_data
 
@@ -910,7 +912,7 @@
                         service_s = value
                         node = item["{}{}".format(prefix, "_node")]
                         # time to get the comments
-                        d = self._p.getItems(jid.JID(service_s), node, max_comments, rsm_request=rsm_comments, extra=extra_comments, profile_key=profile_key)
+                        d = self._p.getItems(client, jid.JID(service_s), node, max_comments, rsm_request=rsm_comments, extra=extra_comments)
                         # then serialise
                         d.addCallback(lambda items_data: self._p.serItemsDataD(items_data, self.item2mbdata))
                         # with failure handling
@@ -930,10 +932,9 @@
             items_d.addCallback(lambda items_completed: (items_completed, metadata))
             return items_d
 
-        client, node_data = self._getClientAndNodeData(publishers_type, publishers, profile_key)
         deferreds = {}
         for service, node in node_data:
-            d = deferreds[(service, node)] = self._p.getItems(service, node, max_items, rsm_request=rsm_request, extra=extra, profile_key=profile_key)
+            d = deferreds[(service, node)] = self._p.getItems(client, service, node, max_items, rsm_request=rsm_request, extra=extra)
             d.addCallback(lambda items_data: self._p.serItemsDataD(items_data, self.item2mbdata))
             d.addCallback(getComments)
             d.addCallback(lambda items_comments_data: ('', items_comments_data))