changeset 325:8d939378f023

mam: removed requestor in favor of mam_request.sender and recipient + fixed bad use of requestor instead of recipient in getItemsData
author Goffi <goffi@goffi.org>
date Fri, 08 Jan 2016 20:47:52 +0100
parents e73e42b4f6ff
children b76cbf59772b
files sat_pubsub/mam.py
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/sat_pubsub/mam.py	Fri Jan 08 17:27:44 2016 +0100
+++ b/sat_pubsub/mam.py	Fri Jan 08 20:47:52 2016 +0100
@@ -61,15 +61,12 @@
 
         raise exc
 
-    def onArchiveRequest(self, mam_request, requestor):
+    def onArchiveRequest(self, mam_request):
         """
 
         @param mam_request: The MAM archive request.
         @type mam_request: L{MAMQueryReques<wokkel.mam.MAMRequest>}
 
-        @param requestor: JID of the requestor.
-        @type requestor: L{JID<twisted.words.protocols.jabber.jid.JID>}
-
         @return: A tuple with list of message data (id, element, data) and RSM element
         @rtype: C{tuple}
         """
@@ -88,7 +85,7 @@
         else:
             ext_data['rsm'] = mam_request.rsm
 
-        d = self.backend.getItemsData(mam_request.node, requestor, None, None, ext_data)
+        d = self.backend.getItemsData(mam_request.node, mam_request.recipient, None, None, ext_data)
 
         def make_message(elt):
             # XXX: http://xmpp.org/extensions/xep-0297.html#sect-idp629952 (rule 3)
@@ -115,7 +112,7 @@
                 # so me manage the sending ourself, and return
                 # an empty msg_data list to avoid double sending
                 for data in msg_data:
-                    self.forwardPEPMessage(mam_request, requestor, *data)
+                    self.forwardPEPMessage(mam_request, *data)
                 msg_data = []
             return (msg_data, rsm_elt)
 
@@ -123,10 +120,10 @@
         d.addCallback(cb)
         return d
 
-    def forwardPEPMessage(self, mam_request, requestor, id_, elt, date):
+    def forwardPEPMessage(self, mam_request, id_, elt, date):
         msg = domish.Element((None, 'message'))
         msg['from'] = self.backend.privilege.server_jid.full()
-        msg['to'] = requestor.full()
+        msg['to'] = mam_request.sender.full()
         result = msg.addElement((mam.NS_MAM, 'result'))
         if mam_request.query_id is not None:
             result['queryid'] = mam_request.query_id