From 6124a60b8f1cd9da90331d890659593b0ceb9db4 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 21 Sep 2009 21:22:57 +0200 Subject: [PATCH] don't fail when we get chat / normal messages from a room_jid. Fixes #5276 --- src/dialogs.py | 7 +++++++ src/roster_window.py | 11 +++++++++++ src/session.py | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/dialogs.py b/src/dialogs.py index d67d85ee2..e93c52772 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -2503,6 +2503,13 @@ class SingleMessageWindow: def on_single_message_window_destroy(self, widget): self.instances.remove(self) + c = gajim.contacts.get_contact_with_highest_priority(self.account, + self.from_whom) + if c.is_groupchat() and not self.from_whom in \ + gajim.interface.minimized_controls[self.account] and self.action == \ + 'receive' and gajim.events.get_nb_roster_events(self.account, + self.from_whom, types=['chat', 'normal']) == 0: + gajim.interface.roster.remove_groupchat(self.from_whom, self.account) def set_cursor_to_end(self): end_iter = self.message_tv_buffer.get_end_iter() diff --git a/src/roster_window.py b/src/roster_window.py index 5e1f33221..d00361c70 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -807,6 +807,11 @@ class RosterWindow: gajim.contacts.add_contact(account, contact) self.add_contact(jid, account) else: + if jid not in gajim.interface.minimized_controls[account]: + # there is a window that we can minimize + gc_control = gajim.interface.msg_win_mgr.get_gc_control(jid, + account) + gajim.interface.minimized_controls[account][jid] = gc_control contact.show = show contact.status = status self.adjust_and_draw_contact_context(jid, account) @@ -2919,6 +2924,12 @@ class RosterWindow: def on_groupchat_maximized(self, widget, jid, account): '''When a groupchat is maximised''' if not jid in gajim.interface.minimized_controls[account]: + # Already opened? + gc_control = gajim.interface.msg_win_mgr.get_gc_control(jid, account) + if gc_control: + mw = gajim.interface.msg_win_mgr.get_window(jid, account) + mw.set_active_tab(gc_control) + mw.window.window.focus() return ctrl = gajim.interface.minimized_controls[account][jid] mw = gajim.interface.msg_win_mgr.get_window(jid, account) diff --git a/src/session.py b/src/session.py index f23f3fe9f..8f5617106 100644 --- a/src/session.py +++ b/src/session.py @@ -250,7 +250,7 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession): if self.control: parent_win = self.control.parent_win - if self.control == parent_win.get_active_control() and \ + if parent_win and self.control == parent_win.get_active_control() and \ parent_win.window.has_focus: focused = True