diff --git a/src/gajim.py b/src/gajim.py index fd49ccca0d3bc35f99f95d63012c7690e90db8c6..ceed59c171c5b095a487026dfda88d1693918d6f 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -518,22 +518,22 @@ class Interface: contact = contact[0] if contact: 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 + 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 + contact.chatstate = chatstate + if contact.our_chatstate == 'ask': # we were jep85 disco? + contact.our_chatstate = 'active' # no more + chat_control.handle_incoming_chatstate() + elif contact.chatstate != 'active': + # got no valid jep85 answer, peer does not support it + contact.chatstate = False + elif chatstate == 'active': + # Brand new message, incoming. + contact.our_chatstate = chatstate contact.chatstate = chatstate - if contact.our_chatstate == 'ask': # we were jep85 disco? - contact.our_chatstate = 'active' # no more - chat_control.handle_incoming_chatstate() - elif contact.chatstate != 'active': - # got no valid jep85 answer, peer does not support it - contact.chatstate = False - elif contact and chatstate == 'active': - # Brand new message, incoming. - contact.our_chatstate = chatstate - contact.chatstate = chatstate - if msg_id: # Do not overwrite an existing msg_id with None - contact.msg_id = msg_id + if msg_id: # Do not overwrite an existing msg_id with None + contact.msg_id = msg_id # THIS MUST BE AFTER chatstates handling # AND BEFORE playsound (else we here sounding on chatstates!)