get_tab_by_name is safer now, by passing the type of the tab we want.
This avoid confusion between various tabs having an identical name (which should not happen anyway…)
This commit is contained in:
parent
b89a10bd05
commit
399434c1ae
1 changed files with 6 additions and 8 deletions
14
src/core.py
14
src/core.py
|
@ -260,8 +260,8 @@ class Core(object):
|
||||||
Search for a ConversationTab with the given jid (full or bare), if yes, add
|
Search for a ConversationTab with the given jid (full or bare), if yes, add
|
||||||
the given message to it
|
the given message to it
|
||||||
"""
|
"""
|
||||||
tab = self.get_tab_by_name(jid)
|
tab = self.get_tab_by_name(jid, tabs.ConversationTab)
|
||||||
if tab and isinstance(tab, tabs.ConversationTab):
|
if tab:
|
||||||
self.add_message_to_text_buffer(tab.get_room(), msg)
|
self.add_message_to_text_buffer(tab.get_room(), msg)
|
||||||
|
|
||||||
def on_failed_connection(self):
|
def on_failed_connection(self):
|
||||||
|
@ -314,10 +314,8 @@ class Core(object):
|
||||||
nick = jid.resource
|
nick = jid.resource
|
||||||
else:
|
else:
|
||||||
default = os.environ.get('USER') if os.environ.get('USER') else 'poezio'
|
default = os.environ.get('USER') if os.environ.get('USER') else 'poezio'
|
||||||
nick = config.get('default_nick', '')
|
nick = config.get('default_nick', '') or default
|
||||||
if nick == '':
|
tab = self.get_tab_by_name(jid.bare, tabs.MucTab)
|
||||||
nick = default
|
|
||||||
tab = self.get_tab_by_name(jid.bare)
|
|
||||||
if not tab:
|
if not tab:
|
||||||
self.open_new_room(jid.bare, nick, False)
|
self.open_new_room(jid.bare, nick, False)
|
||||||
muc.join_groupchat(self.xmpp, jid.bare, nick)
|
muc.join_groupchat(self.xmpp, jid.bare, nick)
|
||||||
|
@ -580,10 +578,10 @@ class Core(object):
|
||||||
if not body:
|
if not body:
|
||||||
return
|
return
|
||||||
# We first check if we have a conversation opened with this precise resource
|
# 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 conversation:
|
||||||
# If not, we search for a conversation with the bare jid
|
# 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:
|
if not conversation:
|
||||||
# We create the conversation with the bare Jid if nothing was found
|
# We create the conversation with the bare Jid if nothing was found
|
||||||
conversation = self.open_conversation_window(jid.bare, False)
|
conversation = self.open_conversation_window(jid.bare, False)
|
||||||
|
|
Loading…
Reference in a new issue