From b89a10bd053168a897ac2a794de0b77f7297f9dc Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Wed, 26 Jan 2011 23:32:41 +0100 Subject: Fix a traceback occuring when an (unknown) tab has a name corresponding to an existant MucTab. --- src/core.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') 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 -- cgit v1.2.3