diff options
author | mathieui <mathieui@mathieui.net> | 2013-07-30 20:47:12 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2013-07-30 20:47:12 +0200 |
commit | b249dad73d2e7c6dde05855ccfbc4d2541cf10d8 (patch) | |
tree | 4c1742b50214923cce37ea0a8297a1fc6af02880 | |
parent | cbcac03510de5c316bc5e5c0136547911beeacd2 (diff) | |
download | poezio-b249dad73d2e7c6dde05855ccfbc4d2541cf10d8.tar.gz poezio-b249dad73d2e7c6dde05855ccfbc4d2541cf10d8.tar.bz2 poezio-b249dad73d2e7c6dde05855ccfbc4d2541cf10d8.tar.xz poezio-b249dad73d2e7c6dde05855ccfbc4d2541cf10d8.zip |
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.
-rw-r--r-- | src/core.py | 11 |
1 files 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: |