summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-01-26 23:32:41 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-01-26 23:32:41 +0100
commitb89a10bd053168a897ac2a794de0b77f7297f9dc (patch)
tree78c1c086ba8dc015da2c5bfef5246e83cf1b91a9
parent698bb167859a8d6383867c46a160496f2b11d087 (diff)
downloadpoezio-b89a10bd053168a897ac2a794de0b77f7297f9dc.tar.gz
poezio-b89a10bd053168a897ac2a794de0b77f7297f9dc.tar.bz2
poezio-b89a10bd053168a897ac2a794de0b77f7297f9dc.tar.xz
poezio-b89a10bd053168a897ac2a794de0b77f7297f9dc.zip
Fix a traceback occuring when an (unknown) tab has a name corresponding to an existant MucTab.
-rw-r--r--src/core.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core.py b/src/core.py
index 38c05d8b..3ae36682 100644
--- a/src/core.py
+++ b/src/core.py
@@ -720,13 +720,16 @@ class Core(object):
return tab.get_room()
return None
- def get_tab_by_name(self, name):
+ def get_tab_by_name(self, name, typ=None):
"""
Get the tab with the given name.
+ If typ is provided, return a tab of this type only
"""
for tab in self.tabs:
if tab.get_name() == name:
- return tab
+ if (typ and isinstance(tab, typ)) or\
+ not typ:
+ return tab
return None
def get_room_by_name(self, name):
@@ -952,7 +955,7 @@ class Core(object):
if nick_from == room_from:
nick_from = None
room = self.get_room_by_name(room_from)
- tab = self.get_tab_by_name(room_from)
+ tab = self.get_tab_by_name(room_from, tabs.MucTab)
if tab and tab.get_room() and tab.get_room().get_user_by_name(nick_from) and\
tab.get_room().get_user_by_name(nick_from) in tab.ignores:
return