send gone chatstate to every tab when closing a window with many tabs

This commit is contained in:
Nikos Kouremenos 2005-07-19 17:08:01 +00:00
parent b8de6a0275
commit f094f65bd2
2 changed files with 10 additions and 6 deletions

View File

@ -141,13 +141,17 @@ class Chat:
def on_window_destroy(self, widget, kind): #kind is 'chats' or 'gc'
#clean self.plugin.windows[self.account][kind]
for jid in self.xmls:
windows = self.plugin.windows[self.account][kind]
if kind == 'chats':
# send 'gone' chatstate to every tabbed chat tab
windows[jid].send_chatstate('gone')
if self.plugin.systray_enabled and self.nb_unread[jid] > 0:
self.plugin.systray.remove_jid(jid, self.account)
del self.plugin.windows[self.account][kind][jid]
del windows[jid]
if self.print_time_timeout_id.has_key(jid):
gobject.source_remove(self.print_time_timeout_id[jid])
if self.plugin.windows[self.account][kind].has_key('tabbed'):
del self.plugin.windows[self.account][kind]['tabbed']
if windows.has_key('tabbed'):
del windows['tabbed']
def get_active_jid(self):
notebook = self.notebook

View File

@ -209,8 +209,6 @@ class TabbedChatWindow(chat.Chat):
gajim.config.set('chat-height', height)
def on_tabbed_chat_window_destroy(self, widget):
# on window destroy, send 'gone' chatstate
self.send_chatstate('gone') # FIXME: loop to each tab and send that
#clean self.plugin.windows[self.account]['chats']
chat.Chat.on_window_destroy(self, widget, 'chats')
@ -360,8 +358,10 @@ class TabbedChatWindow(chat.Chat):
self.send_chatstate('composing')
def send_chatstate(self, state):
''' sends our chatstate to the current tab '''
# please read jep-85 to get an idea of this
# we keep track of jep85 support by the peer by three extra states: None, -1 and 'ask'
# we keep track of jep85 support by the peer by three extra states:
# None, -1 and 'ask'
# None if no info about peer
# -1 if peer does not support jep85
# 'ask' if we sent 'active' chatstate and are waiting for reply