simplify code to compute how many logs do we request when we re-join a room

This commit is contained in:
Yann Leboulanger 2012-02-22 15:36:35 +01:00
parent f577ec9af7
commit 97e5283f88
1 changed files with 1 additions and 5 deletions

View File

@ -2349,15 +2349,11 @@ class Connection(CommonConnection, ConnectionHandlers):
last_date = self.last_history_time[room_jid] last_date = self.last_history_time[room_jid]
if last_date == 0: if last_date == 0:
last_date = time.time() - timeout last_date = time.time() - timeout
else: elif not rejoin:
last_date = min(last_date, time.time() - timeout) last_date = min(last_date, time.time() - timeout)
last_date = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime( last_date = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(
last_date)) last_date))
tags['since'] = last_date tags['since'] = last_date
if rejoin:
tags['since'] = time.strftime('%Y-%m-%dT%H:%M:%SZ',
time.gmtime(gajim.logger.get_last_date_that_has_logs(
room_jid, is_room=True)))
nb = gajim.config.get('muc_restore_lines') nb = gajim.config.get('muc_restore_lines')
if nb >= 0: if nb >= 0:
tags['maxstanzas'] = nb tags['maxstanzas'] = nb