From 0ac61706d8188bc3798ccda1ebaadf70edd4a176 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Thu, 6 Jan 2011 14:53:34 +0100 Subject: [PATCH] add ability for chatstate to fo from inactive to pause when we re-select a tab where we already typed something. Fixes #4380 --- src/chat_control.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index 055dfd6ba..548f2ad49 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -2248,8 +2248,8 @@ class ChatControl(ChatControlBase): if self.kbd_activity_in_last_5_secs and message_buffer.get_char_count(): # Only composing if the keyboard activity was in text entry self.send_chatstate('composing') - elif self.mouse_over_in_last_5_secs and\ - jid == self.parent_win.get_active_jid(): + elif self.mouse_over_in_last_5_secs and current_state == 'inactive' and\ + jid == self.parent_win.get_active_jid(): self.send_chatstate('active') else: if current_state == 'composing': @@ -2563,15 +2563,8 @@ class ChatControl(ChatControlBase): self.reset_kbd_mouse_timeout_vars() return - # prevent going paused if we we were not composing (JEP violation) - if state == 'paused' and not contact.our_chatstate == 'composing': - # go active before - MessageControl.send_message(self, None, chatstate = 'active') - contact.our_chatstate = 'active' - self.reset_kbd_mouse_timeout_vars() - # if we're inactive prevent composing (JEP violation) - elif contact.our_chatstate == 'inactive' and state == 'composing': + if contact.our_chatstate == 'inactive' and state == 'composing': # go active before MessageControl.send_message(self, None, chatstate = 'active') contact.our_chatstate = 'active' @@ -2687,7 +2680,15 @@ class ChatControl(ChatControlBase): # send chatstate inactive to the one we're leaving # and active to the one we visit if state: - self.send_chatstate('active', self.contact) + message_buffer = self.msg_textview.get_buffer() + if message_buffer.get_char_count(): + self.send_chatstate('paused', self.contact) + else: + self.send_chatstate('active', self.contact) + self.reset_kbd_mouse_timeout_vars() + gobject.source_remove(self.possible_paused_timeout_id) + gobject.source_remove(self.possible_inactive_timeout_id) + self._schedule_activity_timers() else: self.send_chatstate('inactive', self.contact) # Hide bigger avatar window