From ab3263c5bac5c5cd5991f1c6f0c3ae1b7ad4466b Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Thu, 4 Aug 2005 17:05:39 +0000 Subject: [PATCH] fix TB --- src/common/gajim.py | 3 ++- src/tabbed_chat_window.py | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/common/gajim.py b/src/common/gajim.py index 0cec1da88..26c731ae2 100644 --- a/src/common/gajim.py +++ b/src/common/gajim.py @@ -95,7 +95,8 @@ def get_first_contact_instance_from_jid(account, jid): #FIXME: problem see comment in next line room, nick = \ get_room_and_nick_from_fjid(jid) # if we ban/kick we now real jid - if nick in gc_contacts[account][room]: + if gc_contacts[account].has_key(room) and \ + nick in gc_contacts[account][room]: contact = gc_contacts[account][room][nick] return contact diff --git a/src/tabbed_chat_window.py b/src/tabbed_chat_window.py index f8867ade1..26bcdf5a5 100644 --- a/src/tabbed_chat_window.py +++ b/src/tabbed_chat_window.py @@ -549,9 +549,16 @@ class TabbedChatWindow(chat.Chat): """Send the given message to the active tab""" if not message: return - + jid = self.get_active_jid() contact = gajim.get_first_contact_instance_from_jid(self.account, jid) + if contact is None: + # contact was from pm in MUC, and left the room, or we left the room + room, nick = gajim.get_room_and_nick_from_fjid(jid) + dialogs.ErrorDialog(_('Sending private message failed'), + _('You are no longer in room "%s" or "%s" has left.') % \ + (room, nick)).get_response() + return conversation_textview = self.xmls[jid].get_widget('conversation_textview') message_textview = self.xmls[jid].get_widget('message_textview') message_buffer = message_textview.get_buffer()