diff browser_side/panels.py @ 267:a76243c02074

browser_side: changes regarding widgets and tabs: - getOrCreateLiberviaWidget gets a tab_label argument to add widgets in a specific tab - ChatPanel can be matched not only regarding the target jid but also the dialog type ("one2one", "group"...)
author souliane <souliane@mailoo.org>
date Sun, 17 Nov 2013 17:53:37 +0100
parents 2a93f8e6f989
children 9eb9c7d41bdc
line wrap: on
line diff
--- a/browser_side/panels.py	Sun Nov 17 17:47:39 2013 +0100
+++ b/browser_side/panels.py	Sun Nov 17 17:53:37 2013 +0100
@@ -728,12 +728,17 @@
 
     def matchEntity(self, entity):
         """
-        @param entity: target jid as a string or JID instance
+        @param entity: target jid as a string or JID instance.
+        Could also be a couple with a type in the second element.
         @return: True if self matches the given entity
         """
+        if isinstance(entity, tuple):
+            entity, type_ = entity if len(entity) > 1 else (entity[0], self.type)
+        else:
+            type_ = self.type
         entity = entity if isinstance(entity, JID) else JID(entity)
         try:
-            return self.target.bare == entity.bare
+            return self.target.bare == entity.bare and self.type == type_
         except AttributeError as e:
             e.include_traceback()
             return False