do not play sound on recv chatstates. also comment on this so at last that code is somehow readable. thx Jim for report
This commit is contained in:
		
							parent
							
								
									7c0dca4dbd
								
							
						
					
					
						commit
						a91654ba9b
					
				
					 1 changed files with 27 additions and 26 deletions
				
			
		
							
								
								
									
										51
									
								
								src/gajim.py
									
										
									
									
									
								
							
							
						
						
									
										51
									
								
								src/gajim.py
									
										
									
									
									
								
							|  | @ -465,6 +465,32 @@ class Interface: | |||
| 		 | ||||
| 		chat_control = self.msg_win_mgr.get_control(jid, account) | ||||
| 
 | ||||
| 		# Handle chat states   | ||||
| 		contact = gajim.contacts.get_first_contact_from_jid(account, jid) | ||||
| 		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 | ||||
| 				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 | ||||
| 
 | ||||
| 		# THIS MUST BE AFTER chatstates handling | ||||
| 		# AND BEFORE playsound (else we here sounding on chatstates!) | ||||
| 		if not array[1]: # empty message text | ||||
| 			return | ||||
| 
 | ||||
| 		first = False | ||||
| 		if not chat_control and not gajim.awaiting_events[account].has_key(jid): | ||||
| 			first = True | ||||
|  | @ -516,31 +542,6 @@ class Interface: | |||
| 			chat_control = None | ||||
| 			jid_of_control = fjid | ||||
| 		 | ||||
| 		# Handle chat states   | ||||
| 		contact = gajim.contacts.get_first_contact_from_jid(account, jid) | ||||
| 		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 | ||||
| 				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 | ||||
| 
 | ||||
| 		# THIS MUST BE AFTER chatstates handling | ||||
| 		if not array[1]: # empty message text | ||||
| 			return | ||||
| 		 | ||||
| 		if not chat_control and not gajim.awaiting_events[account].has_key(jid): | ||||
| 			if gajim.config.get('notify_on_new_message'): | ||||
| 				if helpers.allow_showing_notification(account): | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue