add 2 advanced option to configure how many log lines we want when entering a room. Fixes #5237

This commit is contained in:
Yann Leboulanger 2009-08-27 18:08:14 +02:00
parent 062add136e
commit 982db9636c
2 changed files with 12 additions and 0 deletions

View File

@ -160,6 +160,8 @@ class Config:
'change_roster_title': [ opt_bool, True, _('Add * and [n] in roster title?')], '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_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.')], '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.')],
'send_on_ctrl_enter': [opt_bool, False, _('Send message on Ctrl+Enter and with Enter make new line (Mirabilis ICQ Client default behaviour).')], 'send_on_ctrl_enter': [opt_bool, False, _('Send message on Ctrl+Enter and with Enter make new line (Mirabilis ICQ Client default behaviour).')],
'show_roster_on_startup': [opt_bool, True], 'show_roster_on_startup': [opt_bool, True],
'key_up_lines': [opt_int, 25, _('How many lines to store for Ctrl+KeyUP.')], 'key_up_lines': [opt_int, 25, _('How many lines to store for Ctrl+KeyUP.')],

View File

@ -1746,6 +1746,16 @@ class Connection(ConnectionHandlers):
self.add_lang(p) self.add_lang(p)
if not change_nick: if not change_nick:
t = p.setTag(common.xmpp.NS_MUC + ' x') t = p.setTag(common.xmpp.NS_MUC + ' x')
last_date = gajim.logger.get_last_date_that_has_logs(room_jid, self.name,
is_room=True)
if last_date is None:
last_date = time.time() - gajim.config.get('muc_restore_timeout') * 60
else:
last_time = 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})
if password: if password:
t.setTagData('password', password) t.setTagData('password', password)
self.connection.send(p) self.connection.send(p)