From edd161ddfdccf981b4d6df81ffb9050f07a05ec0 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Mon, 16 Mar 2020 23:25:50 -0400 Subject: [PATCH] rename config keys from review feedback --- irc/accounts.go | 4 ++-- irc/client_lookup_set.go | 4 ++-- irc/config.go | 12 ++++++------ irc/nickserv.go | 6 +++--- oragono.yaml | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/irc/accounts.go b/irc/accounts.go index 95b11663..d2c38386 100644 --- a/irc/accounts.go +++ b/irc/accounts.go @@ -348,11 +348,11 @@ func (am *AccountManager) Register(client *Client, account string, callbackNames // as an account; this prevents "land-grab" situations where someone else // registers your nick out from under you and then NS GHOSTs you // 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 // will prevent any double-register if client != nil && config.Accounts.NickReservation.Enabled && - !config.Accounts.NickReservation.EnforceGuestFormat && + !config.Accounts.NickReservation.ForceGuestFormat && client.NickCasefolded() != casefoldedAccount { return errAccountMustHoldNick } diff --git a/irc/client_lookup_set.go b/irc/client_lookup_set.go index 7ca700e7..4a480060 100644 --- a/irc/client_lookup_set.go +++ b/irc/client_lookup_set.go @@ -131,7 +131,7 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick var alwaysOn, useAccountName bool if account != "" { alwaysOn = persistenceEnabled(config.Accounts.Multiclient.AlwaysOn, settings.AlwaysOn) - useAccountName = alwaysOn || config.Accounts.NickReservation.EnforceAccountName + useAccountName = alwaysOn || config.Accounts.NickReservation.ForceNickEqualsAccount } if useAccountName { @@ -150,7 +150,7 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick return "", errNickMissing } - if account == "" && config.Accounts.NickReservation.EnforceGuestFormat { + if account == "" && config.Accounts.NickReservation.ForceGuestFormat { newNick = strings.Replace(config.Accounts.NickReservation.GuestFormat, "*", newNick, 1) } diff --git a/irc/config.go b/irc/config.go index 6c9cb453..9d5e9331 100644 --- a/irc/config.go +++ b/irc/config.go @@ -251,12 +251,12 @@ type AccountConfig struct { AllowCustomEnforcement bool `yaml:"allow-custom-enforcement"` RenameTimeout time.Duration `yaml:"rename-timeout"` // RenamePrefix is the legacy field, GuestFormat is the new version - RenamePrefix string `yaml:"rename-prefix"` - GuestFormat string `yaml:"guest-nickname-format"` - guestRegexp *regexp.Regexp - guestRegexpFolded *regexp.Regexp - EnforceGuestFormat bool `yaml:"enforce-guest-format"` - EnforceAccountName bool `yaml:"enforce-account-name"` + RenamePrefix string `yaml:"rename-prefix"` + GuestFormat string `yaml:"guest-nickname-format"` + guestRegexp *regexp.Regexp + guestRegexpFolded *regexp.Regexp + ForceGuestFormat bool `yaml:"force-guest-format"` + ForceNickEqualsAccount bool `yaml:"force-nick-equals-account"` } `yaml:"nick-reservation"` Multiclient MulticlientConfig Bouncer *MulticlientConfig // # handle old name for 'multiclient' diff --git a/irc/nickserv.go b/irc/nickserv.go index 8898e1ac..c6dfa663 100644 --- a/irc/nickserv.go +++ b/irc/nickserv.go @@ -610,12 +610,12 @@ func nsLoginThrottleCheck(client *Client, rb *ResponseBuffer) (success bool) { 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, // 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) func nsFixNickname(client *Client, rb *ResponseBuffer, config *Config) (success bool) { - if !config.Accounts.NickReservation.EnforceAccountName { + if !config.Accounts.NickReservation.ForceNickEqualsAccount { return true } // 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() account := details.nick - if config.Accounts.NickReservation.EnforceGuestFormat { + if config.Accounts.NickReservation.ForceGuestFormat { matches := config.Accounts.NickReservation.guestRegexp.FindStringSubmatch(account) if matches == nil || len(matches) < 2 { nsNotice(rb, client.t("Erroneous nickname")) diff --git a/oragono.yaml b/oragono.yaml index 49964f9a..4df55c55 100644 --- a/oragono.yaml +++ b/oragono.yaml @@ -356,13 +356,13 @@ accounts: # a nickname matching the guest template. a caveat: this may prevent # users from choosing nicknames in scripts different from the guest # nickname format. - enforce-guest-format: false + force-guest-format: false # when enabled, forces users logged into an account to use the # account name as their nickname. when combined with strict nickname # enforcement, this lets users treat nicknames and account names # 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 # attach to the same client/nickname identity; this is part of the