diff --git a/src/common/config.py b/src/common/config.py index 7f5bd2de5..a1bc9949b 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -168,8 +168,8 @@ class Config: 'change_roster_title': [ opt_bool, True, _('Add * and [n] in roster title?')], 'restore_lines': [opt_int, 4, _('How many lines to remember from previous conversation when a chat tab/window is reopened.')], 'restore_timeout': [opt_int, 60, _('How many minutes should last lines from previous conversation last.')], - 'muc_restore_lines': [opt_int, 20, _('How many lines to request to server when entering a groupchat.')], - 'muc_restore_timeout': [opt_int, 60, _('How many minutes back to request logs when a entering a groupchat.')], + 'muc_restore_lines': [opt_int, 20, _('How many lines to request to server when entering a groupchat. -1 means no limit')], + 'muc_restore_timeout': [opt_int, 60, _('How many minutes back to request logs when a entering a groupchat. -1 means no limit')], 'muc_autorejoin_timeout': [opt_int, 1, _('How many seconds to wait before trying to autorejoin to a conference you are being disconnected from. Set to 0 to disable autorejoining.')], 'muc_autorejoin_on_kick': [opt_bool, False, _('Should autorejoin be activated when we are being kicked from a conference?')], 'send_on_ctrl_enter': [opt_bool, False, _('Send message on Ctrl+Enter and with Enter make new line (Mirabilis ICQ Client default behaviour).')], diff --git a/src/common/connection.py b/src/common/connection.py index b5443a69f..9ec3bea1e 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -2269,16 +2269,22 @@ class Connection(CommonConnection, ConnectionHandlers): self.add_lang(p) if not change_nick: t = p.setTag(common.xmpp.NS_MUC + ' x') - last_date = self.last_history_time[room_jid] - if last_date == 0: - last_date = time.time() - gajim.config.get( - 'muc_restore_timeout') * 60 - else: - last_date = min(last_date, time.time() - gajim.config.get( - 'muc_restore_timeout') * 60) - last_date = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(last_date)) - t.setTag('history', {'maxstanzas': gajim.config.get( - 'muc_restore_lines'), 'since': last_date}) + tags = {} + timeout = gajim.config.get('muc_restore_timeout') * 60 + if timeout >= 0: + last_date = self.last_history_time[room_jid] + if last_date == 0: + last_date = time.time() - timeout + else: + last_date = min(last_date, time.time() - timeout) + last_date = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime( + last_date)) + tags['since'] = last_date + nb = gajim.config.get('muc_restore_lines') + if nb >= 0: + tags['maxstanzas'] = nb + if tags: + t.setTag('history', tags) if password: t.setTagData('password', password) self.connection.send(p) @@ -2497,7 +2503,7 @@ class Connection(CommonConnection, ConnectionHandlers): self.connection.send(message) def request_voice(self, room, nick): - """ + """ Request voice in a moderated room """ message = common.xmpp.Message(to=room)