1
0
Fork 0
forked from External/ergo
This commit is contained in:
Shivaram Lingamneni 2020-08-06 03:16:58 -04:00
parent 8f490ae298
commit 06882a9b89
5 changed files with 22 additions and 24 deletions

View file

@ -1124,14 +1124,21 @@ func (client *Client) SetVHost(vhost string) (updated bool) {
return
}
// updateNick updates `nick` and `nickCasefolded`.
func (client *Client) updateNick(nick, nickCasefolded, skeleton string) {
// SetNick gives the client a nickname and marks it as registered, if necessary
func (client *Client) SetNick(nick, nickCasefolded, skeleton string) (success bool) {
client.stateMutex.Lock()
defer client.stateMutex.Unlock()
if client.destroyed {
return false
} else if !client.registered {
// XXX test this before setting it to avoid annoying the race detector
client.registered = true
}
client.nick = nick
client.nickCasefolded = nickCasefolded
client.skeleton = skeleton
client.updateNickMaskNoMutex()
return true
}
// updateNickMaskNoMutex updates the casefolded nickname and nickmask, not acquiring any mutexes.