3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 10:42:52 +01:00

fix double application of guest prefix

This commit is contained in:
Shivaram Lingamneni 2020-03-19 05:08:53 -04:00
parent 5d9a03f031
commit ca3be51028

View File

@ -151,10 +151,19 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
}
if account == "" && config.Accounts.NickReservation.ForceGuestFormat {
newNick = strings.Replace(config.Accounts.NickReservation.GuestFormat, "*", newNick, 1)
newcfnick, err = CasefoldName(newNick)
if err != nil {
return "", errNicknameInvalid
}
if !config.Accounts.NickReservation.guestRegexpFolded.MatchString(newcfnick) {
newNick = strings.Replace(config.Accounts.NickReservation.GuestFormat, "*", newNick, 1)
newcfnick = "" // re-fold it below
}
}
newcfnick, err = CasefoldName(newNick)
if newcfnick == "" {
newcfnick, err = CasefoldName(newNick)
}
if err != nil {
return "", errNicknameInvalid
}