From 761528f213149b3b3d0deab7ac8f7495120f63a8 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Tue, 13 Dec 2005 22:13:07 +0000 Subject: [PATCH] don't remove contact in gc roster when he leaves if there are awaiting events from him, but only when we read his messages --- src/groupchat_window.py | 8 +++++++- src/tabbed_chat_window.py | 13 +++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/groupchat_window.py b/src/groupchat_window.py index e6d5fcab5..90dc68641 100644 --- a/src/groupchat_window.py +++ b/src/groupchat_window.py @@ -486,7 +486,13 @@ class GroupchatWindow(chat.Chat): s = _('%s is now known as %s') % (nick, new_nick) self.print_conversation(s, room_jid) - self.remove_contact(room_jid, nick) + if not gajim.awaiting_events[self.account].has_key( + room_jid + '/' + nick): + self.remove_contact(room_jid, nick) + else: + c = gajim.gc_contacts[self.account][room_jid][nick] + c.show = show + c.status = status if nick == self.nicks[room_jid] and statusCode != '303': # We became offline self.got_disconnected(room_jid) else: diff --git a/src/tabbed_chat_window.py b/src/tabbed_chat_window.py index cfcc284dc..58e5e2d27 100644 --- a/src/tabbed_chat_window.py +++ b/src/tabbed_chat_window.py @@ -828,7 +828,7 @@ class TabbedChatWindow(chat.Chat): contact = self.contacts[jid] # Is it a pm ? is_pm = False - room_jid = jid.split('/', 1)[0] + room_jid, nick = gajim.get_room_and_nick_from_fjid(jid) gcs = gajim.interface.instances[self.account]['gc'] if gcs.has_key(room_jid): is_pm = True @@ -864,7 +864,6 @@ class TabbedChatWindow(chat.Chat): del gajim.awaiting_events[self.account][jid] typ = 'chat' # Is it a normal chat or a pm ? # reset to status image in gc if it is a pm - room_jid = jid.split('/', 1)[0] gcs = gajim.interface.instances[self.account]['gc'] if gcs.has_key(room_jid): gcs[room_jid].draw_all_roster() @@ -873,11 +872,13 @@ class TabbedChatWindow(chat.Chat): gajim.interface.roster.draw_contact(jid, self.account) if gajim.interface.systray_enabled: gajim.interface.systray.remove_jid(jid, self.account, typ) - showOffline = gajim.config.get('showoffline') - if (contact.show == 'offline' or contact.show == 'error') and \ - not showOffline and typ == 'chat': - if len(gajim.contacts[self.account][jid]) == 1: + if (contact.show == 'offline' or contact.show == 'error'): + showOffline = gajim.config.get('showoffline') + if not showOffline and typ == 'chat' and \ + len(gajim.contacts[self.account][jid]) == 1: gajim.interface.roster.really_remove_contact(contact, self.account) + elif typ == 'pm': + gcs[room_jid].remove_contact(room_jid, nick) def print_conversation(self, text, jid, frm = '', tim = None, encrypted = False, subject = None):