Browse Source

Merge pull request #1339 from slingamn/issue1337

fix #1337
tags/v2.4.0-rc1
Shivaram Lingamneni 3 years ago
parent
commit
4737578748
No account linked to committer's email address
4 changed files with 15 additions and 0 deletions
  1. 5
    0
      conventional.yaml
  2. 5
    0
      default.yaml
  3. 1
    0
      irc/config.go
  4. 4
    0
      irc/handlers.go

+ 5
- 0
conventional.yaml View File

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

+ 5
- 0
default.yaml View File

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

+ 1
- 0
irc/config.go View File

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

+ 4
- 0
irc/handlers.go View File

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

Loading…
Cancel
Save