redraw chat buttons when we get caps information. Fixes #6114

This commit is contained in:
Yann Leboulanger 2010-12-23 17:51:26 +01:00
parent e990f978f0
commit 241f666bc6
2 changed files with 12 additions and 3 deletions

View File

@ -1605,6 +1605,8 @@ class ChatControl(ChatControlBase):
self._nec_failed_decrypt)
gajim.ged.register_event_handler('chatstate-received', ged.GUI1,
self._nec_chatstate_received)
gajim.ged.register_event_handler('caps-received', ged.GUI1,
self._nec_caps_received)
# PluginSystem: adding GUI extension point for this ChatControl
# instance object
@ -2597,6 +2599,8 @@ class ChatControl(ChatControlBase):
self._nec_failed_decrypt)
gajim.ged.remove_event_handler('chatstate-received', ged.GUI1,
self._nec_chatstate_received)
gajim.ged.remove_event_handler('caps-received', ged.GUI1,
self._nec_caps_received)
self.send_chatstate('gone', self.contact)
self.contact.chatstate = None
@ -2673,6 +2677,11 @@ class ChatControl(ChatControlBase):
# update chatstate in tab for this chat
self.parent_win.redraw_tab(self, self.contact.chatstate)
def _nec_caps_received(self, obj):
if obj.conn.name != self.account or obj.jid != self.contact.jid:
return
self.update_ui()
def set_control_active(self, state):
ChatControlBase.set_control_active(self, state)
# send chatstate inactive to the one we're leaving

View File

@ -149,18 +149,18 @@ class PrivateChatControl(ChatControl):
ChatControl.__init__(self, parent_win, contact, account, session)
self.TYPE_ID = 'pm'
gajim.ged.register_event_handler('caps-received', ged.GUI1,
self._nec_caps_received)
self._nec_caps_received_pm)
gajim.ged.register_event_handler('gc-presence-received', ged.GUI1,
self._nec_gc_presence_received)
def shutdown(self):
super(PrivateChatControl, self).shutdown()
gajim.ged.remove_event_handler('caps-received', ged.GUI1,
self._nec_caps_received)
self._nec_caps_received_pm)
gajim.ged.remove_event_handler('gc-presence-received', ged.GUI1,
self._nec_gc_presence_received)
def _nec_caps_received(self, obj):
def _nec_caps_received_pm(self, obj):
if obj.conn.name != self.account or \
obj.fjid != self.gc_contact.get_full_jid():
return