mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
fix #1886
Add more clarify in NS INFO and SAREGISTER about unregistered nicknames
This commit is contained in:
parent
03092769e7
commit
b11dc1c84c
4 changed files with 26 additions and 3 deletions
|
|
@ -433,7 +433,7 @@ func (am *AccountManager) Register(client *Client, account string, callbackNames
|
|||
|
||||
// can't register an account with the same name as a registered nick
|
||||
if am.NickToAccount(account) != "" {
|
||||
return errAccountAlreadyRegistered
|
||||
return errNameReserved
|
||||
}
|
||||
|
||||
return am.server.store.Update(func(tx *buntdb.Tx) error {
|
||||
|
|
@ -1480,6 +1480,22 @@ func (am *AccountManager) LoadAccount(accountName string) (result ClientAccount,
|
|||
return
|
||||
}
|
||||
|
||||
func (am *AccountManager) accountWasUnregistered(accountName string) (result bool) {
|
||||
casefoldedAccount, err := CasefoldName(accountName)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
unregisteredKey := fmt.Sprintf(keyAccountUnregistered, casefoldedAccount)
|
||||
am.server.store.View(func(tx *buntdb.Tx) error {
|
||||
if _, err := tx.Get(unregisteredKey); err == nil {
|
||||
result = true
|
||||
}
|
||||
return nil
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// look up the unfolded version of an account name, possibly after deletion
|
||||
func (am *AccountManager) AccountToAccountName(account string) (result string) {
|
||||
casefoldedAccount, err := CasefoldName(account)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue