From 399434c1ae045b90ced7f48f3983150aa13fbf25 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Wed, 26 Jan 2011 23:43:07 +0100 Subject: [PATCH] =?UTF-8?q?get=5Ftab=5Fby=5Fname=20is=20safer=20now,=20by?= =?UTF-8?q?=20passing=20the=20type=20of=20the=20tab=20we=20want.=20This=20?= =?UTF-8?q?avoid=20confusion=20between=20various=20tabs=20having=20an=20id?= =?UTF-8?q?entical=20name=20(which=20should=20not=20happen=20anyway?= =?UTF-8?q?=E2=80=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/core.py b/src/core.py index 3ae36682..e2f3633e 100644 --- a/src/core.py +++ b/src/core.py @@ -260,8 +260,8 @@ class Core(object): Search for a ConversationTab with the given jid (full or bare), if yes, add the given message to it """ - tab = self.get_tab_by_name(jid) - if tab and isinstance(tab, tabs.ConversationTab): + tab = self.get_tab_by_name(jid, tabs.ConversationTab) + if tab: self.add_message_to_text_buffer(tab.get_room(), msg) def on_failed_connection(self): @@ -314,10 +314,8 @@ class Core(object): nick = jid.resource else: default = os.environ.get('USER') if os.environ.get('USER') else 'poezio' - nick = config.get('default_nick', '') - if nick == '': - nick = default - tab = self.get_tab_by_name(jid.bare) + nick = config.get('default_nick', '') or default + tab = self.get_tab_by_name(jid.bare, tabs.MucTab) if not tab: self.open_new_room(jid.bare, nick, False) muc.join_groupchat(self.xmpp, jid.bare, nick) @@ -580,10 +578,10 @@ class Core(object): if not body: return # We first check if we have a conversation opened with this precise resource - conversation = self.get_tab_by_name(jid.full) + conversation = self.get_tab_by_name(jid.full, tabs.ConversationTab) if not conversation: # If not, we search for a conversation with the bare jid - conversation = self.get_tab_by_name(jid.bare) + conversation = self.get_tab_by_name(jid.bare, tabs.ConversationTab) if not conversation: # We create the conversation with the bare Jid if nothing was found conversation = self.open_conversation_window(jid.bare, False)