From de60232020258b35af61cdda051ca65a01f785e0 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Fri, 22 Jul 2005 18:10:28 +0000 Subject: [PATCH] on_chat_notebook_switch_page now sends chatstates --- src/chat.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/chat.py b/src/chat.py index c6f9d6c97..18e587b87 100644 --- a/src/chat.py +++ b/src/chat.py @@ -251,12 +251,29 @@ class Chat: menu.show_all() def on_chat_notebook_switch_page(self, notebook, page, page_num): + + # get the index of the page and then the page that we're leaving + old_no = notebook.get_current_page() + old_child = notebook.get_nth_page(old_no) + new_child = notebook.get_nth_page(page_num) + + old_jid = '' new_jid = '' for jid in self.xmls: if self.childs[jid] == new_child: new_jid = jid - break + elif self.childs[jid] == old_child: + old_jid = jid + + if old_jid != '' and new_jid != '': # we found both jids + break # so stop looping + + if self.widget_name == 'tabbed_chat_window': + # send chatstate inactive to the one we're leaving + # and active to the one we visit + self.send_chatstate('inactive', old_jid) + self.send_chatstate('active', new_jid) conversation_textview = self.xmls[new_jid].get_widget( 'conversation_textview')