mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
rename config keys from review feedback
This commit is contained in:
parent
851c9ef198
commit
edd161ddfd
@ -348,11 +348,11 @@ func (am *AccountManager) Register(client *Client, account string, callbackNames
|
|||||||
// as an account; this prevents "land-grab" situations where someone else
|
// as an account; this prevents "land-grab" situations where someone else
|
||||||
// registers your nick out from under you and then NS GHOSTs you
|
// registers your nick out from under you and then NS GHOSTs you
|
||||||
// n.b. client is nil during a SAREGISTER
|
// n.b. client is nil during a SAREGISTER
|
||||||
// n.b. if EnforceGuestFormat, then there's no concern, because you can't
|
// n.b. if ForceGuestFormat, then there's no concern, because you can't
|
||||||
// register a guest nickname anyway, and the actual registration system
|
// register a guest nickname anyway, and the actual registration system
|
||||||
// will prevent any double-register
|
// will prevent any double-register
|
||||||
if client != nil && config.Accounts.NickReservation.Enabled &&
|
if client != nil && config.Accounts.NickReservation.Enabled &&
|
||||||
!config.Accounts.NickReservation.EnforceGuestFormat &&
|
!config.Accounts.NickReservation.ForceGuestFormat &&
|
||||||
client.NickCasefolded() != casefoldedAccount {
|
client.NickCasefolded() != casefoldedAccount {
|
||||||
return errAccountMustHoldNick
|
return errAccountMustHoldNick
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
|
|||||||
var alwaysOn, useAccountName bool
|
var alwaysOn, useAccountName bool
|
||||||
if account != "" {
|
if account != "" {
|
||||||
alwaysOn = persistenceEnabled(config.Accounts.Multiclient.AlwaysOn, settings.AlwaysOn)
|
alwaysOn = persistenceEnabled(config.Accounts.Multiclient.AlwaysOn, settings.AlwaysOn)
|
||||||
useAccountName = alwaysOn || config.Accounts.NickReservation.EnforceAccountName
|
useAccountName = alwaysOn || config.Accounts.NickReservation.ForceNickEqualsAccount
|
||||||
}
|
}
|
||||||
|
|
||||||
if useAccountName {
|
if useAccountName {
|
||||||
@ -150,7 +150,7 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
|
|||||||
return "", errNickMissing
|
return "", errNickMissing
|
||||||
}
|
}
|
||||||
|
|
||||||
if account == "" && config.Accounts.NickReservation.EnforceGuestFormat {
|
if account == "" && config.Accounts.NickReservation.ForceGuestFormat {
|
||||||
newNick = strings.Replace(config.Accounts.NickReservation.GuestFormat, "*", newNick, 1)
|
newNick = strings.Replace(config.Accounts.NickReservation.GuestFormat, "*", newNick, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,12 +251,12 @@ type AccountConfig struct {
|
|||||||
AllowCustomEnforcement bool `yaml:"allow-custom-enforcement"`
|
AllowCustomEnforcement bool `yaml:"allow-custom-enforcement"`
|
||||||
RenameTimeout time.Duration `yaml:"rename-timeout"`
|
RenameTimeout time.Duration `yaml:"rename-timeout"`
|
||||||
// RenamePrefix is the legacy field, GuestFormat is the new version
|
// RenamePrefix is the legacy field, GuestFormat is the new version
|
||||||
RenamePrefix string `yaml:"rename-prefix"`
|
RenamePrefix string `yaml:"rename-prefix"`
|
||||||
GuestFormat string `yaml:"guest-nickname-format"`
|
GuestFormat string `yaml:"guest-nickname-format"`
|
||||||
guestRegexp *regexp.Regexp
|
guestRegexp *regexp.Regexp
|
||||||
guestRegexpFolded *regexp.Regexp
|
guestRegexpFolded *regexp.Regexp
|
||||||
EnforceGuestFormat bool `yaml:"enforce-guest-format"`
|
ForceGuestFormat bool `yaml:"force-guest-format"`
|
||||||
EnforceAccountName bool `yaml:"enforce-account-name"`
|
ForceNickEqualsAccount bool `yaml:"force-nick-equals-account"`
|
||||||
} `yaml:"nick-reservation"`
|
} `yaml:"nick-reservation"`
|
||||||
Multiclient MulticlientConfig
|
Multiclient MulticlientConfig
|
||||||
Bouncer *MulticlientConfig // # handle old name for 'multiclient'
|
Bouncer *MulticlientConfig // # handle old name for 'multiclient'
|
||||||
|
@ -610,12 +610,12 @@ func nsLoginThrottleCheck(client *Client, rb *ResponseBuffer) (success bool) {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// if enforce-account-name is set, account name and nickname must be equal,
|
// if force-nick-equals-account is set, account name and nickname must be equal,
|
||||||
// so we need to re-NICK automatically on every login event (IDENTIFY,
|
// so we need to re-NICK automatically on every login event (IDENTIFY,
|
||||||
// VERIFY, and a REGISTER that auto-verifies). if we can't get the nick
|
// VERIFY, and a REGISTER that auto-verifies). if we can't get the nick
|
||||||
// then we log them out (they will be able to reattach with SASL)
|
// then we log them out (they will be able to reattach with SASL)
|
||||||
func nsFixNickname(client *Client, rb *ResponseBuffer, config *Config) (success bool) {
|
func nsFixNickname(client *Client, rb *ResponseBuffer, config *Config) (success bool) {
|
||||||
if !config.Accounts.NickReservation.EnforceAccountName {
|
if !config.Accounts.NickReservation.ForceNickEqualsAccount {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// don't need to supply a nickname, SetNick will use the account name
|
// don't need to supply a nickname, SetNick will use the account name
|
||||||
@ -753,7 +753,7 @@ func nsRegisterHandler(server *Server, client *Client, command string, params []
|
|||||||
|
|
||||||
config := server.Config()
|
config := server.Config()
|
||||||
account := details.nick
|
account := details.nick
|
||||||
if config.Accounts.NickReservation.EnforceGuestFormat {
|
if config.Accounts.NickReservation.ForceGuestFormat {
|
||||||
matches := config.Accounts.NickReservation.guestRegexp.FindStringSubmatch(account)
|
matches := config.Accounts.NickReservation.guestRegexp.FindStringSubmatch(account)
|
||||||
if matches == nil || len(matches) < 2 {
|
if matches == nil || len(matches) < 2 {
|
||||||
nsNotice(rb, client.t("Erroneous nickname"))
|
nsNotice(rb, client.t("Erroneous nickname"))
|
||||||
|
@ -356,13 +356,13 @@ accounts:
|
|||||||
# a nickname matching the guest template. a caveat: this may prevent
|
# a nickname matching the guest template. a caveat: this may prevent
|
||||||
# users from choosing nicknames in scripts different from the guest
|
# users from choosing nicknames in scripts different from the guest
|
||||||
# nickname format.
|
# nickname format.
|
||||||
enforce-guest-format: false
|
force-guest-format: false
|
||||||
|
|
||||||
# when enabled, forces users logged into an account to use the
|
# when enabled, forces users logged into an account to use the
|
||||||
# account name as their nickname. when combined with strict nickname
|
# account name as their nickname. when combined with strict nickname
|
||||||
# enforcement, this lets users treat nicknames and account names
|
# enforcement, this lets users treat nicknames and account names
|
||||||
# as equivalent for the purpose of ban/invite/exception lists.
|
# as equivalent for the purpose of ban/invite/exception lists.
|
||||||
enforce-account-name: false
|
force-nick-equals-account: false
|
||||||
|
|
||||||
# multiclient controls whether oragono allows multiple connections to
|
# multiclient controls whether oragono allows multiple connections to
|
||||||
# attach to the same client/nickname identity; this is part of the
|
# attach to the same client/nickname identity; this is part of the
|
||||||
|
Loading…
Reference in New Issue
Block a user