changeset aa13cbd5b7d6 in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=aa13cbd5b7d6
description: fix bug when merging server logs of MUC conversations

diffstat:

 src/common/connection_handlers.py |   9 +++++----
 src/common/logger.py              |  15 ++++++++++-----
 src/common/message_archiving.py   |  16 ++++++++--------
 src/gui_interface.py              |   1 -
 4 files changed, 23 insertions(+), 18 deletions(-)

diffs (124 lines):

diff -r d875ab6b8a95 -r aa13cbd5b7d6 src/common/connection_handlers.py
--- a/src/common/connection_handlers.py Sun Nov 15 11:33:05 2009 +0100
+++ b/src/common/connection_handlers.py Sun Nov 15 15:37:41 2009 +0100
@@ -1243,12 +1243,12 @@
                        pass
 
                elif self.awaiting_answers[id_][0] == 
ARCHIVING_COLLECTION_ARRIVED:
-                       def save_if_not_exists(with_, direction, tim, payload):
+                       def save_if_not_exists(with_, nick, direction, tim, 
payload):
                                assert len(payload) == 1, 'got several 
archiving messages in the' +\
                                        ' same time %s' % ''.join(payload)
                                if payload[0].getName() == 'body':
                                        gajim.logger.save_if_not_exists(with_, 
direction, tim,
-                                               msg=payload[0].getData())
+                                               msg=payload[0].getData(), 
nick=nick)
                                elif payload[0].getName() == 'message':
                                        print 'Not implemented'
                        chat = iq_obj.getTag('chat')
@@ -1265,12 +1265,13 @@
                                                secs = 0
                                        if secs:
                                                tim += secs
+                                       nick = element.getAttr('name')
                                        if element.getName() == 'from':
-                                               save_if_not_exists(with_, 
'from', localtime(tim),
+                                               save_if_not_exists(with_, nick, 
'from', localtime(tim),
                                                        element.getPayload())
                                                nb += 1
                                        if element.getName() == 'to':
-                                               save_if_not_exists(with_, 'to', 
localtime(tim),
+                                               save_if_not_exists(with_, nick, 
'to', localtime(tim),
                                                        element.getPayload())
                                                nb += 1
                                set_ = chat.getTag('set')
diff -r d875ab6b8a95 -r aa13cbd5b7d6 src/common/logger.py
--- a/src/common/logger.py      Sun Nov 15 11:33:05 2009 +0100
+++ b/src/common/logger.py      Sun Nov 15 15:37:41 2009 +0100
@@ -981,16 +981,21 @@
                        (account_jid_id,))
                self.con.commit()
 
-       def save_if_not_exists(self, with_, direction, tim, msg=''):
+       def save_if_not_exists(self, with_, direction, tim, msg='', nick=None):
                if tim:
                        time_col = int(float(time.mktime(tim)))
                else:
                        time_col = int(float(time.time()))
                if msg:
-                       if self.jid_is_from_pm(with_):
-                               # We cannot know if it's a pm or groupchat 
message because we only
-                               # get body of the message
-                               type_ = 'gc_msg'
+                       if self.jid_is_room_jid(with_) or nick:
+                               # It's a groupchat message
+                               if nick:
+                                       # It's a message from a groupchat 
occupent
+                                       type_ = 'gc_msg'
+                                       with_ = with_ + '/' + nick
+                               else:
+                                       # It's a server message message, we 
don't log them
+                                       return
                        else:
                                if direction == 'from':
                                        type_ = 'chat_msg_recv'
diff -r d875ab6b8a95 -r aa13cbd5b7d6 src/common/message_archiving.py
--- a/src/common/message_archiving.py   Sun Nov 15 11:33:05 2009 +0100
+++ b/src/common/message_archiving.py   Sun Nov 15 15:37:41 2009 +0100
@@ -179,12 +179,12 @@
                                self.dispatch('ARCHIVING_CHANGED', 
('itemremove',
                                        item.getAttr('jid')))
 
-       def request_collections_list_page(self, with='', start=None, end=None,
+       def request_collections_list_page(self, with_='', start=None, end=None,
        after=None, max=30, exact_match=False):
                iq_ = common.xmpp.Iq('get')
                list_ = iq_.setTag('list', namespace=common.xmpp.NS_ARCHIVE)
-               if with:
-                       list_.setAttr('with', with)
+               if with_:
+                       list_.setAttr('with', with_)
                        if exact_match:
                                list_.setAttr('exactmatch', 'true')
                if start:
@@ -200,11 +200,11 @@
                self.awaiting_answers[id_] = (ARCHIVING_COLLECTIONS_ARRIVED, )
                self.connection.send(iq_)
 
-       def request_collection_page(self, with, start, end=None, after=None,
+       def request_collection_page(self, with_, start, end=None, after=None,
        max=30, exact_match=False):
                iq_ = common.xmpp.Iq('get')
                retrieve = iq_.setTag('retrieve', 
namespace=common.xmpp.NS_ARCHIVE,
-                       attrs={'with': with, 'start': start})
+                       attrs={'with': with_, 'start': start})
                if exact_match:
                        retrieve.setAttr('exactmatch', 'true')
                set_ = retrieve.setTag('set', namespace=common.xmpp.NS_RSM)
@@ -216,12 +216,12 @@
                self.awaiting_answers[id_] = (ARCHIVING_COLLECTION_ARRIVED, )
                self.connection.send(iq_)
                
-       def remove_collection(self, with='', start=None, end=None,
+       def remove_collection(self, with_='', start=None, end=None,
        exact_match=False, open=False):
                iq_ = common.xmpp.Iq('set')
                remove = iq_.setTag('remove', namespace=common.xmpp.NS_ARCHIVE)
-               if with:
-                       remove.setAttr('with', with)
+               if with_:
+                       remove.setAttr('with', with_)
                        if exact_match:
                                remove.setAttr('exactmatch', 'true')
                if start:
diff -r d875ab6b8a95 -r aa13cbd5b7d6 src/gui_interface.py
--- a/src/gui_interface.py      Sun Nov 15 11:33:05 2009 +0100
+++ b/src/gui_interface.py      Sun Nov 15 15:37:41 2009 +0100
@@ -3405,7 +3405,6 @@
                self.last_ftwindow_update = 0
 
                self.music_track_changed_signal = None
-               self.create_ipython_window()
                
                
 class PassphraseRequest:
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to