introduce get_full_jid for MessageControl. Fix TB when removing a tab with a resource. see #1697

This commit is contained in:
Yann Leboulanger 2006-03-14 16:35:17 +00:00
parent 01a99ee766
commit e76ac7f406
2 changed files with 8 additions and 4 deletions

View File

@ -59,6 +59,11 @@ class MessageControl:
# Autoconnect glade signals # Autoconnect glade signals
self.xml.signal_autoconnect(self) self.xml.signal_autoconnect(self)
def get_full_jid(self):
fjid = self.contact.jid
if self.resource:
fjid += '/' + self.resource
def set_control_active(self, state): def set_control_active(self, state):
'''Called when the control becomes active (state is True) '''Called when the control becomes active (state is True)
or inactive (state is False)''' or inactive (state is False)'''

View File

@ -139,9 +139,7 @@ class MessageWindow:
def new_tab(self, control): def new_tab(self, control):
if not self._controls.has_key(control.account): if not self._controls.has_key(control.account):
self._controls[control.account] = {} self._controls[control.account] = {}
fjid = control.contact.jid fjid = control.get_full_jid()
if control.resource:
fjid += '/' + control.resource
self._controls[control.account][fjid] = control self._controls[control.account][fjid] = control
if self.get_num_controls() > 1: if self.get_num_controls() > 1:
@ -268,7 +266,8 @@ class MessageWindow:
self.disconnect_tab_dnd(ctrl.widget) self.disconnect_tab_dnd(ctrl.widget)
self.notebook.remove_page(self.notebook.page_num(ctrl.widget)) self.notebook.remove_page(self.notebook.page_num(ctrl.widget))
del self._controls[ctrl.account][ctrl.contact.jid] fjid = control.get_full_jid()
del self._controls[ctrl.account][fjid]
if len(self._controls[ctrl.account]) == 0: if len(self._controls[ctrl.account]) == 0:
del self._controls[ctrl.account] del self._controls[ctrl.account]