From 7b102e4813623b2ecf534e4fc3cd0c9d0bd2d1ce Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Tue, 4 Apr 2006 17:51:52 +0000
Subject: [PATCH] fix TB when getting chatstate from contact not in roster of
 offline storaged chatstate

---
 src/gajim.py | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/gajim.py b/src/gajim.py
index fd49ccca0d..ceed59c171 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!)
-- 
GitLab