* clean roster tables when we remove an account
This commit is contained in:
		
							parent
							
								
									b3fbd59866
								
							
						
					
					
						commit
						ff2be61483
					
				
					 2 changed files with 14 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -858,7 +858,7 @@ class Logger:
 | 
			
		|||
			jid_id = self.get_jid_id(jid)
 | 
			
		||||
		except exceptions.PysqliteOperationalError, e:
 | 
			
		||||
			raise exceptions.PysqliteOperationalError(str(e))
 | 
			
		||||
		sql = 'DELETE FROM roster_entry WHERE account_jid_id = %d AND jid_id = %d' % (account_jid_id, jid_id)
 | 
			
		||||
		sql = 'DELETE FROM roster_entry WHERE account_jid_id=%d AND jid_id=%d' % (account_jid_id, jid_id)
 | 
			
		||||
		self.simple_commit(sql)
 | 
			
		||||
 | 
			
		||||
	def add_or_update_contact(self, account_jid, jid, name, sub, ask, groups):
 | 
			
		||||
| 
						 | 
				
			
			@ -875,7 +875,7 @@ class Logger:
 | 
			
		|||
 | 
			
		||||
		# Update groups information
 | 
			
		||||
		# First we delete all previous groups information
 | 
			
		||||
		sql = 'DELETE FROM roster_group WHERE account_jid_id = %d AND jid_id = %d' % (account_jid_id, jid_id)
 | 
			
		||||
		sql = 'DELETE FROM roster_group WHERE account_jid_id=%d AND jid_id=%d' % (account_jid_id, jid_id)
 | 
			
		||||
		self.cur.execute(sql)
 | 
			
		||||
		# Then we add all new groups information
 | 
			
		||||
		for group in groups:
 | 
			
		||||
| 
						 | 
				
			
			@ -923,4 +923,15 @@ class Logger:
 | 
			
		|||
 | 
			
		||||
		return data
 | 
			
		||||
 | 
			
		||||
	def remove_roster(self, account_jid):
 | 
			
		||||
		account_jid_id = self.get_jid_id(account_jid)
 | 
			
		||||
 | 
			
		||||
		sql = 'DELETE FROM roster_group WHERE account_jid_id=%d' % (
 | 
			
		||||
			account_jid_id)
 | 
			
		||||
		self.cur.execute(sql)
 | 
			
		||||
 | 
			
		||||
		sql = 'DELETE FROM roster_entry WHERE account_jid_id=%d' % (
 | 
			
		||||
			account_jid_id)
 | 
			
		||||
		self.simple_commit(sql)
 | 
			
		||||
 | 
			
		||||
# vim: se ts=3:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2632,6 +2632,7 @@ class RemoveAccountWindow:
 | 
			
		|||
		gajim.interface.roster.close_all(self.account, force = True)
 | 
			
		||||
		gajim.connections[self.account].disconnect(on_purpose = True)
 | 
			
		||||
		del gajim.connections[self.account]
 | 
			
		||||
		gajim.logger.remove_roster(gajim.get_jid_from_account(self.account))
 | 
			
		||||
		gajim.config.del_per('accounts', self.account)
 | 
			
		||||
		gajim.interface.save_config()
 | 
			
		||||
		del gajim.interface.instances[self.account]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue