don't fail when we get chat / normal messages from a room_jid. Fixes #5276

This commit is contained in:
Yann Leboulanger 2009-09-21 21:22:57 +02:00
parent d89abc9195
commit 6124a60b8f
3 changed files with 19 additions and 1 deletions

View File

@ -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()

View File

@ -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)

View File

@ -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