Fix unlimited muc_restore_timeout

muc_restore_timeout set to -1 means we want no particular time set, up
to which we request messages. But we should not deliberate request
messages we already have. Hence even if muc_restore_timeout is set
to -1, we should only request up to the last message we received.
This commit is contained in:
Philipp Hörist 2017-07-10 20:13:10 +02:00
parent b625199c47
commit a818b60ba7
1 changed files with 9 additions and 10 deletions

View File

@ -2592,16 +2592,15 @@ class Connection(CommonConnection, ConnectionHandlers):
'muc_restore_timeout')
if timeout is None or timeout == -2:
timeout = gajim.config.get('muc_restore_timeout')
timeout *= 60
if timeout >= 0:
last_date = self.last_history_time[room_jid]
if last_date == 0:
last_date = time.time() - timeout
elif not rejoin:
last_date = max(last_date, time.time() - timeout)
last_date = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(
last_date))
tags['since'] = last_date
last_date = self.last_history_time[room_jid]
if last_date == 0 and timeout >= 0:
last_date = time.time() - timeout * 60
elif not rejoin and timeout >= 0:
last_date = max(last_date, time.time() - timeout * 60)
last_date = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(
last_date))
tags['since'] = last_date
nb = gajim.config.get_per('rooms', room_jid, 'muc_restore_lines')
if nb is None or nb == -2:
nb = gajim.config.get('muc_restore_lines')