Commit b249dad7 authored by mathieui's avatar mathieui

Fix #2341 (/message <bare/resource> doesn’t open a new tab…)

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.
parent cbcac035
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment