From 6b0664fa83169347345711601965de689096e9ce Mon Sep 17 00:00:00 2001 From: Jean-Marie Traissard Date: Sun, 26 Nov 2006 22:00:53 +0000 Subject: [PATCH] Cache xep85 support but continue to violate xep85 5.1.2 for release. See #2637. --- src/chat_control.py | 15 ++++++++++++--- src/common/connection.py | 5 +++-- src/gajim.py | 3 ++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index 5de4dcc34..68bff1f1d 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -1133,19 +1133,28 @@ class ChatControl(ChatControlBase): chatstates_on = gajim.config.get('outgoing_chat_state_notifications') != \ 'disabled' + composing_jep = contact.composing_jep chatstate_to_send = None if chatstates_on and contact is not None: - if contact.composing_jep is None: + if composing_jep is None: # no info about peer # send active to discover chat state capabilities # this is here (and not in send_chatstate) # because we want it sent with REAL message # (not standlone) eg. one that has body + + # Enable 3 next lines after 0.11 release. + # Having this disabled violate xep85 5.1.2 but then we don't break + # notifications between 0.10.1 and 0.11  See #2637 + # if contact.our_chatstate: + # # We already ask for xep 85, don't ask it twice + # composing_jep = 'asked_once' + chatstate_to_send = 'active' contact.our_chatstate = 'ask' # pseudo state # if peer supports jep85 and we are not 'ask', send 'active' # NOTE: first active and 'ask' is set in gajim.py - elif contact.composing_jep is not False: + elif composing_jep is not False: #send active chatstate on every message (as JEP says) chatstate_to_send = 'active' contact.our_chatstate = 'active' @@ -1156,7 +1165,7 @@ class ChatControl(ChatControlBase): ChatControlBase.send_message(self, message, keyID, type = 'chat', chatstate = chatstate_to_send, - composing_jep = contact.composing_jep) + composing_jep = composing_jep) self.print_conversation(message, self.contact.jid, encrypted = encrypted) def check_for_possible_paused_chatstate(self, arg): diff --git a/src/common/connection.py b/src/common/connection.py index 8008358d5..8b75c9695 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -733,10 +733,11 @@ class Connection(ConnectionHandlers): # please note that the only valid tag inside a message containing a # tag is the active event if chatstate is not None: - if composing_jep == 'JEP-0085' or not composing_jep: + if (composing_jep == 'JEP-0085' or not composing_jep) and \ + composing_jep != 'asked_once': # JEP-0085 msg_iq.setTag(chatstate, namespace = common.xmpp.NS_CHATSTATES) - if composing_jep == 'JEP-0022' or not composing_jep: + if composing_jep in ('JEP-0022', 'asked_once') or not composing_jep: # JEP-0022 chatstate_node = msg_iq.setTag('x', namespace = common.xmpp.NS_EVENT) diff --git a/src/gajim.py b/src/gajim.py index 02bb10cdf..7e0629581 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -592,7 +592,8 @@ class Interface: if contact and isinstance(contact, list): contact = contact[0] if contact: - contact.composing_jep = composing_jep + if contact.composing_jep != 'JEP-0085': # We cache xep85 support + contact.composing_jep = composing_jep if chat_control and chat_control.type_id == message_control.TYPE_CHAT: if chatstate is not None: # other peer sent us reply, so he supports jep85 or jep22