plugin XEP-0045: don't loop when initiating MAM archive
This commit is contained in:
parent
8cc39ea3a5
commit
bea35db274
1 changed files with 3 additions and 1 deletions
|
|
@ -871,12 +871,14 @@ class SatMUCClient(muc.MUCClient):
|
||||||
if last_mess:
|
if last_mess:
|
||||||
stanza_id = last_mess[0][-1][u'stanza_id']
|
stanza_id = last_mess[0][-1][u'stanza_id']
|
||||||
rsm_req = rsm.RSMRequest(max_=100, after=stanza_id)
|
rsm_req = rsm.RSMRequest(max_=100, after=stanza_id)
|
||||||
|
no_loop=False
|
||||||
else:
|
else:
|
||||||
log.info(u"We have no MAM archive for room {room_jid}.".format(
|
log.info(u"We have no MAM archive for room {room_jid}.".format(
|
||||||
room_jid=room_jid))
|
room_jid=room_jid))
|
||||||
# we don't want the whole archive if we have no archive yet
|
# we don't want the whole archive if we have no archive yet
|
||||||
# as it can be huge
|
# as it can be huge
|
||||||
rsm_req = rsm.RSMRequest(max_=50, before=u'')
|
rsm_req = rsm.RSMRequest(max_=50, before=u'')
|
||||||
|
no_loop=True
|
||||||
|
|
||||||
mam_req = mam.MAMRequest(rsm_=rsm_req)
|
mam_req = mam.MAMRequest(rsm_=rsm_req)
|
||||||
complete = False
|
complete = False
|
||||||
|
|
@ -885,7 +887,7 @@ class SatMUCClient(muc.MUCClient):
|
||||||
mam_data = yield self._mam.getArchives(client, mam_req,
|
mam_data = yield self._mam.getArchives(client, mam_req,
|
||||||
service=room_jid)
|
service=room_jid)
|
||||||
elt_list, rsm_response, mam_response = mam_data
|
elt_list, rsm_response, mam_response = mam_data
|
||||||
complete = mam_response[u"complete"]
|
complete = True if no_loop else mam_response[u"complete"]
|
||||||
# we update MAM request for next iteration
|
# we update MAM request for next iteration
|
||||||
mam_req.rsm.after = rsm_response.last
|
mam_req.rsm.after = rsm_response.last
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue