Always remove contacts from GUI when we receive a roster via xmppy.
This fixes a bug with metacontacts over different groups and should stop contact duplication in most cases.
This commit is contained in:
		
							parent
							
								
									ea3e43c15a
								
							
						
					
					
						commit
						a06468b846
					
				
					 2 changed files with 6 additions and 0 deletions
				
			
		|  | @ -652,6 +652,8 @@ class Interface: | ||||||
| 
 | 
 | ||||||
| 	def handle_event_roster(self, account, data): | 	def handle_event_roster(self, account, data): | ||||||
| 		#('ROSTER', account, array) | 		#('ROSTER', account, array) | ||||||
|  | 		# FIXME: Those methods depend to highly on each other | ||||||
|  | 		# and the order in which they are called | ||||||
| 		self.roster.fill_contacts_and_groups_dicts(data, account) | 		self.roster.fill_contacts_and_groups_dicts(data, account) | ||||||
| 		self.roster.add_account_contacts(account) | 		self.roster.add_account_contacts(account) | ||||||
| 		self.roster.fire_up_unread_messages_events(account) | 		self.roster.fire_up_unread_messages_events(account) | ||||||
|  |  | ||||||
|  | @ -1501,11 +1501,15 @@ class RosterWindow: | ||||||
| 
 | 
 | ||||||
| 	def fill_contacts_and_groups_dicts(self, array, account): | 	def fill_contacts_and_groups_dicts(self, array, account): | ||||||
| 		'''fill gajim.contacts and gajim.groups''' | 		'''fill gajim.contacts and gajim.groups''' | ||||||
|  | 		# FIXME: This function needs to be splitted | ||||||
|  | 		# Most of the logic SHOULD NOT be done at GUI level | ||||||
| 		if account not in gajim.contacts.get_accounts(): | 		if account not in gajim.contacts.get_accounts(): | ||||||
| 			gajim.contacts.add_account(account) | 			gajim.contacts.add_account(account) | ||||||
| 		if not gajim.groups.has_key(account): | 		if not gajim.groups.has_key(account): | ||||||
| 			gajim.groups[account] = {} | 			gajim.groups[account] = {} | ||||||
| 		for jid in array.keys(): | 		for jid in array.keys(): | ||||||
|  | 			# Remove the contact in roster. It might has changed | ||||||
|  | 			self.remove_contact(jid, account) | ||||||
| 			# Remove old Contact instances | 			# Remove old Contact instances | ||||||
| 			gajim.contacts.remove_jid(account, jid, remove_meta=False) | 			gajim.contacts.remove_jid(account, jid, remove_meta=False) | ||||||
| 			jids = jid.split('/') | 			jids = jid.split('/') | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue