really remove not in roster contacts even if that have an opened chat window. Fixes #1997
This commit is contained in:
		
							parent
							
								
									10ba862ed4
								
							
						
					
					
						commit
						155e516642
					
				
					 1 changed files with 16 additions and 3 deletions
				
			
		| 
						 | 
					@ -273,7 +273,8 @@ class RosterWindow:
 | 
				
			||||||
		if (contact.show in ('offline', 'error') or hide) and \
 | 
							if (contact.show in ('offline', 'error') or hide) and \
 | 
				
			||||||
			not showOffline and (not _('Transports') in contact.groups or \
 | 
								not showOffline and (not _('Transports') in contact.groups or \
 | 
				
			||||||
			gajim.connections[account].connected < 2) and \
 | 
								gajim.connections[account].connected < 2) and \
 | 
				
			||||||
			not gajim.awaiting_events[account].has_key(jid):
 | 
								not gajim.awaiting_events[account].has_key(jid) and \
 | 
				
			||||||
 | 
								not _('Not in Roster') in contact.groups:
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		# Remove brother contacts that are already in roster to add them
 | 
							# Remove brother contacts that are already in roster to add them
 | 
				
			||||||
| 
						 | 
					@ -1779,14 +1780,26 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
 | 
				
			||||||
			for c in gajim.contacts.get_contact(account, contact.jid):
 | 
								for c in gajim.contacts.get_contact(account, contact.jid):
 | 
				
			||||||
				self.remove_contact(c, account)
 | 
									self.remove_contact(c, account)
 | 
				
			||||||
			gajim.contacts.remove_jid(account, c.jid)
 | 
								gajim.contacts.remove_jid(account, c.jid)
 | 
				
			||||||
 | 
								need_readd = False
 | 
				
			||||||
			if not remove_auth and contact.sub == 'both':
 | 
								if not remove_auth and contact.sub == 'both':
 | 
				
			||||||
				contact.name = ''
 | 
									contact.name = ''
 | 
				
			||||||
				contact.groups = []
 | 
									contact.groups = []
 | 
				
			||||||
				contact.sub = 'from'
 | 
									contact.sub = 'from'
 | 
				
			||||||
				gajim.contacts.add_contact(account, contact)
 | 
									gajim.contacts.add_contact(account, contact)
 | 
				
			||||||
				self.add_contact_to_roster(contact.jid, account)
 | 
									self.add_contact_to_roster(contact.jid, account)
 | 
				
			||||||
			elif gajim.interface.msg_win_mgr.has_window(contact.jid, account) or \
 | 
								elif gajim.awaiting_events[account].has_key(contact.jid):
 | 
				
			||||||
			gajim.awaiting_events[account].has_key(contact.jid):
 | 
									need_readd = True
 | 
				
			||||||
 | 
								elif gajim.interface.msg_win_mgr.has_window(contact.jid, account):
 | 
				
			||||||
 | 
									if _('Not in Roster') in contact.groups:
 | 
				
			||||||
 | 
										# Close chat window
 | 
				
			||||||
 | 
										msg_win = gajim.interface.msg_win_mgr.get_window(contact.jid,
 | 
				
			||||||
 | 
											account)
 | 
				
			||||||
 | 
										ctrl = gajim.interface.msg_win_mgr.get_control(contact.jid,
 | 
				
			||||||
 | 
											account)
 | 
				
			||||||
 | 
										msg_win.remove_tab(ctrl)
 | 
				
			||||||
 | 
									else:
 | 
				
			||||||
 | 
										need_readd = True
 | 
				
			||||||
 | 
								if need_readd:
 | 
				
			||||||
				c = gajim.contacts.create_contact(jid = contact.jid,
 | 
									c = gajim.contacts.create_contact(jid = contact.jid,
 | 
				
			||||||
					name = '', groups = [_('Not in Roster')],
 | 
										name = '', groups = [_('Not in Roster')],
 | 
				
			||||||
					show = 'not in roster', status = '', ask = 'none',
 | 
										show = 'not in roster', status = '', ask = 'none',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue