mirror of
				https://github.com/ergochat/ergo.git
				synced 2025-11-04 07:47:25 +01:00 
			
		
		
		
	fix #1076
This commit is contained in:
		
							parent
							
								
									c1d4c5596d
								
							
						
					
					
						commit
						2def06b98f
					
				@ -1333,7 +1333,7 @@ func (client *Client) destroy(session *Session) {
 | 
			
		||||
 | 
			
		||||
	// alert monitors
 | 
			
		||||
	if registered {
 | 
			
		||||
		client.server.monitorManager.AlertAbout(client, false)
 | 
			
		||||
		client.server.monitorManager.AlertAbout(details.nick, details.nickCasefolded, false)
 | 
			
		||||
	}
 | 
			
		||||
	// clean up monitor state
 | 
			
		||||
	client.server.monitorManager.RemoveAll(client)
 | 
			
		||||
 | 
			
		||||
@ -25,9 +25,7 @@ func (mm *MonitorManager) Initialize() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AlertAbout alerts everyone monitoring `client`'s nick that `client` is now {on,off}line.
 | 
			
		||||
func (manager *MonitorManager) AlertAbout(client *Client, online bool) {
 | 
			
		||||
	cfnick := client.NickCasefolded()
 | 
			
		||||
	nick := client.Nick()
 | 
			
		||||
func (manager *MonitorManager) AlertAbout(nick, cfnick string, online bool) {
 | 
			
		||||
	var watchers []*Client
 | 
			
		||||
	// safely copy the list of clients watching our nick
 | 
			
		||||
	manager.RLock()
 | 
			
		||||
@ -42,7 +40,7 @@ func (manager *MonitorManager) AlertAbout(client *Client, online bool) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, mClient := range watchers {
 | 
			
		||||
		mClient.Send(nil, client.server.name, command, mClient.Nick(), nick)
 | 
			
		||||
		mClient.Send(nil, mClient.server.name, command, mClient.Nick(), nick)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -89,7 +89,11 @@ func performNickChange(server *Server, client *Client, target *Client, session *
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if target.Registered() {
 | 
			
		||||
		client.server.monitorManager.AlertAbout(target, true)
 | 
			
		||||
		newCfnick := target.NickCasefolded()
 | 
			
		||||
		if newCfnick != details.nickCasefolded {
 | 
			
		||||
			client.server.monitorManager.AlertAbout(details.nick, details.nickCasefolded, false)
 | 
			
		||||
			client.server.monitorManager.AlertAbout(assignedNickname, newCfnick, true)
 | 
			
		||||
		}
 | 
			
		||||
		target.nickTimer.Touch(rb)
 | 
			
		||||
	} // else: these will be deferred to the end of registration (see #572)
 | 
			
		||||
	return nil
 | 
			
		||||
 | 
			
		||||
@ -271,7 +271,7 @@ func (server *Server) tryRegister(c *Client, session *Session) (exiting bool) {
 | 
			
		||||
 | 
			
		||||
	// count new user in statistics
 | 
			
		||||
	server.stats.Register()
 | 
			
		||||
	server.monitorManager.AlertAbout(c, true)
 | 
			
		||||
	server.monitorManager.AlertAbout(c.Nick(), c.NickCasefolded(), true)
 | 
			
		||||
 | 
			
		||||
	server.playRegistrationBurst(session)
 | 
			
		||||
	return false
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user