changeset ade83280fda6 in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=ade83280fda6
description: ability to request room logs without time / number of stanza 
limit. Fixes #6877

diffstat:

 src/common/config.py     |   4 ++--
 src/common/connection.py |  28 +++++++++++++++++-----------
 2 files changed, 19 insertions(+), 13 deletions(-)

diffs (59 lines):

diff -r 252bb3cf2c59 -r ade83280fda6 src/common/config.py
--- a/src/common/config.py      Sat May 07 08:44:15 2011 +0200
+++ b/src/common/config.py      Mon May 09 20:32:48 2011 +0200
@@ -168,8 +168,8 @@
             '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 -r 252bb3cf2c59 -r ade83280fda6 src/common/connection.py
--- a/src/common/connection.py  Sat May 07 08:44:15 2011 +0200
+++ b/src/common/connection.py  Mon May 09 20:32:48 2011 +0200
@@ -2269,16 +2269,22 @@
         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 @@
         self.connection.send(message)
 
     def request_voice(self, room, nick):
-        """ 
+        """
         Request voice in a moderated room
         """
         message = common.xmpp.Message(to=room)
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to