3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

Merge pull request #1339 from slingamn/issue1337

fix #1337
This commit is contained in:
Shivaram Lingamneni 2020-10-19 08:22:00 -07:00 committed by GitHub
commit 4737578748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 0 deletions

View File

@ -433,6 +433,11 @@ accounts:
# as equivalent for the purpose of ban/invite/exception lists.
force-nick-equals-account: false
# parallel setting to force-nick-equals-account: if true, this forbids
# anonymous users (i.e., users not logged into an account) to change their
# nickname after the initial connection is complete
forbid-anon-nick-changes: false
# multiclient controls whether oragono allows multiple connections to
# attach to the same client/nickname identity; this is part of the
# functionality traditionally provided by a bouncer like ZNC

View File

@ -461,6 +461,11 @@ accounts:
# as equivalent for the purpose of ban/invite/exception lists.
force-nick-equals-account: true
# parallel setting to force-nick-equals-account: if true, this forbids
# anonymous users (i.e., users not logged into an account) to change their
# nickname after the initial connection is complete
forbid-anonymous-nick-changes: false
# multiclient controls whether oragono allows multiple connections to
# attach to the same client/nickname identity; this is part of the
# functionality traditionally provided by a bouncer like ZNC

View File

@ -274,6 +274,7 @@ type AccountConfig struct {
guestRegexpFolded *regexp.Regexp
ForceGuestFormat bool `yaml:"force-guest-format"`
ForceNickEqualsAccount bool `yaml:"force-nick-equals-account"`
ForbidAnonNickChanges bool `yaml:"forbid-anonymous-nick-changes"`
} `yaml:"nick-reservation"`
Multiclient MulticlientConfig
Bouncer *MulticlientConfig // # handle old name for 'multiclient'

View File

@ -1919,6 +1919,10 @@ func namesHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Res
// NICK <nickname>
func nickHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
if client.registered {
if client.account == "" && server.Config().Accounts.NickReservation.ForbidAnonNickChanges {
rb.Add(nil, server.name, ERR_UNKNOWNERROR, client.Nick(), client.t("You may not change your nickname"))
return false
}
performNickChange(server, client, client, nil, msg.Params[0], rb)
} else {
client.preregNick = msg.Params[0]