mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
refactor account registration, add nick enforcement
This commit is contained in:
parent
fcd0a75469
commit
ad73d68807
18 changed files with 865 additions and 602 deletions
|
|
@ -98,6 +98,12 @@ func (clients *ClientManager) SetNick(client *Client, newNick string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
var reservedAccount string
|
||||
reservation := client.server.AccountConfig().NickReservation
|
||||
if reservation != NickReservationDisabled {
|
||||
reservedAccount = client.server.accounts.NickToAccount(newcfnick)
|
||||
}
|
||||
|
||||
clients.Lock()
|
||||
defer clients.Unlock()
|
||||
|
||||
|
|
@ -107,6 +113,9 @@ func (clients *ClientManager) SetNick(client *Client, newNick string) error {
|
|||
if currentNewEntry != nil && currentNewEntry != client {
|
||||
return errNicknameInUse
|
||||
}
|
||||
if reservation == NickReservationStrict && reservedAccount != client.Account() {
|
||||
return errNicknameReserved
|
||||
}
|
||||
clients.byNick[newcfnick] = client
|
||||
client.updateNickMask(newNick)
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue