From b249dad73d2e7c6dde05855ccfbc4d2541cf10d8 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 30 Jul 2013 20:47:12 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20#2341=20(/message=20=20doe?= =?UTF-8?q?sn=E2=80=99t=20open=20a=20new=20tab=E2=80=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a tab with the given fulljid is not found, then a new tab will be opened, even if we are in discussion with the bare jid. --- src/core.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core.py b/src/core.py index 009cfaa4..2bafc871 100644 --- a/src/core.py +++ b/src/core.py @@ -762,16 +762,19 @@ class Core(object): self.current_tab_nb = self.current_tab_nb return self.tabs[self.current_tab_nb] - def get_conversation_by_jid(self, jid, create=True): + def get_conversation_by_jid(self, jid, create=True, fallback_barejid=True): """ From a JID, get the tab containing the conversation with it. If none already exist, and create is "True", we create it - and return it. Otherwise, we return None + and return it. Otherwise, we return None. + + If fallback_barejid is True, then this method will seek other + tabs with the same barejid, instead of searching only by fulljid. """ jid = safeJID(jid) # We first check if we have a static conversation opened with this precise resource conversation = self.get_tab_by_name(jid.full, tabs.StaticConversationTab) - if not conversation: + if not conversation and fallback_barejid: # If not, we search for a conversation with the bare jid conversation = self.get_tab_by_name(jid.bare, tabs.DynamicConversationTab) if not conversation: @@ -2524,7 +2527,7 @@ class Core(object): jid = safeJID(args[0]) if not jid.user and not jid.domain and not jid.resource: return self.information('Invalid JID.', 'Error') - tab = self.get_conversation_by_jid(jid.full, False) + tab = self.get_conversation_by_jid(jid.full, False, fallback_barejid=False) if not tab: tab = self.open_conversation_window(jid.full, focus=True) else: