From 8c86a126cc38cb3556ce4c50a97baefaec4e2c3f Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Sun, 7 Aug 2005 21:21:23 +0000 Subject: [PATCH] avoid a TB, and detect better if we were composing --- src/tabbed_chat_window.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/tabbed_chat_window.py b/src/tabbed_chat_window.py index 1b55f601d..dfeae2847 100644 --- a/src/tabbed_chat_window.py +++ b/src/tabbed_chat_window.py @@ -391,7 +391,7 @@ class TabbedChatWindow(chat.Chat): self.send_chatstate('composing') else: if self.chatstates[contact.jid] == 'composing': - self.send_chatstate('paused') # pause composing + self.send_chatstate('paused', contact.jid) # pause composing # assume no activity and let the motion-notify or key_press make them True self.mouse_over_in_last_5_secs = False @@ -414,7 +414,7 @@ class TabbedChatWindow(chat.Chat): if not (self.mouse_over_in_last_30_secs or\ self.kbd_activity_in_last_30_secs): - self.send_chatstate('inactive') + self.send_chatstate('inactive', contact.jid) # assume no activity and let the motion-notify or key_press make them True self.mouse_over_in_last_5_secs = False @@ -488,13 +488,18 @@ class TabbedChatWindow(chat.Chat): # Shift + Escape is not composing, so we let the gtk+ decide # in an workaround way (we could also get somehow the listed shortcuts # but I don't know if it's possible) + + # get images too (eg. emoticons) + message = message_buffer.get_slice(start_iter, end_iter, True) + message = message.strip() # enter and space does not mean writing chars_no = len(message) gobject.timeout_add(1000, self.check_for_possible_composing, message_buffer, jid, chars_no) def check_for_possible_composing(self, message_buffer, jid, chars_no): start_iter, end_iter = message_buffer.get_bounds() - message = message_buffer.get_text(start_iter, end_iter, False) + message = message_buffer.get_slice(start_iter, end_iter, True) + message = message.strip() # enter and space does not mean writing chars_no_after_one_sec = len(message) if chars_no != chars_no_after_one_sec: # so GTK+ decided key_press was for writing..