Procházet zdrojové kódy

update draft/register -> draft/account-registration

Fixes #1740
tags/v2.8.0-rc1
Shivaram Lingamneni před 2 roky
rodič
revize
59bddd066f
5 změnil soubory, kde provedl 24 přidání a 15 odebrání
  1. 4
    4
      gencapdefs.py
  2. 5
    5
      irc/caps/defs.go
  3. 1
    1
      irc/commands.go
  4. 2
    2
      irc/config.go
  5. 12
    3
      irc/handlers.go

+ 4
- 4
gencapdefs.py Zobrazit soubor

172
         standard="proposed IRCv3",
172
         standard="proposed IRCv3",
173
     ),
173
     ),
174
     CapDef(
174
     CapDef(
175
-        identifier="Register",
176
-        name="draft/register",
177
-        url="https://gist.github.com/edk0/bf3b50fc219fd1bed1aa15d98bfb6495",
178
-        standard="proposed IRCv3",
175
+        identifier="AccountRegistration",
176
+        name="draft/account-registration",
177
+        url="https://github.com/ircv3/ircv3-specifications/pull/435",
178
+        standard="draft IRCv3",
179
     ),
179
     ),
180
 ]
180
 ]
181
 
181
 

+ 5
- 5
irc/caps/defs.go Zobrazit soubor

37
 	// https://ircv3.net/specs/extensions/chghost-3.2.html
37
 	// https://ircv3.net/specs/extensions/chghost-3.2.html
38
 	ChgHost Capability = iota
38
 	ChgHost Capability = iota
39
 
39
 
40
+	// AccountRegistration is the draft IRCv3 capability named "draft/account-registration":
41
+	// https://github.com/ircv3/ircv3-specifications/pull/435
42
+	AccountRegistration Capability = iota
43
+
40
 	// ChannelRename is the draft IRCv3 capability named "draft/channel-rename":
44
 	// ChannelRename is the draft IRCv3 capability named "draft/channel-rename":
41
 	// https://ircv3.net/specs/extensions/channel-rename
45
 	// https://ircv3.net/specs/extensions/channel-rename
42
 	ChannelRename Capability = iota
46
 	ChannelRename Capability = iota
57
 	// https://github.com/ircv3/ircv3-specifications/pull/398
61
 	// https://github.com/ircv3/ircv3-specifications/pull/398
58
 	Multiline Capability = iota
62
 	Multiline Capability = iota
59
 
63
 
60
-	// Register is the proposed IRCv3 capability named "draft/register":
61
-	// https://gist.github.com/edk0/bf3b50fc219fd1bed1aa15d98bfb6495
62
-	Register Capability = iota
63
-
64
 	// Relaymsg is the proposed IRCv3 capability named "draft/relaymsg":
64
 	// Relaymsg is the proposed IRCv3 capability named "draft/relaymsg":
65
 	// https://github.com/ircv3/ircv3-specifications/pull/417
65
 	// https://github.com/ircv3/ircv3-specifications/pull/417
66
 	Relaymsg Capability = iota
66
 	Relaymsg Capability = iota
131
 		"batch",
131
 		"batch",
132
 		"cap-notify",
132
 		"cap-notify",
133
 		"chghost",
133
 		"chghost",
134
+		"draft/account-registration",
134
 		"draft/channel-rename",
135
 		"draft/channel-rename",
135
 		"draft/chathistory",
136
 		"draft/chathistory",
136
 		"draft/event-playback",
137
 		"draft/event-playback",
137
 		"draft/languages",
138
 		"draft/languages",
138
 		"draft/multiline",
139
 		"draft/multiline",
139
-		"draft/register",
140
 		"draft/relaymsg",
140
 		"draft/relaymsg",
141
 		"echo-message",
141
 		"echo-message",
142
 		"extended-join",
142
 		"extended-join",

+ 1
- 1
irc/commands.go Zobrazit soubor

246
 		},
246
 		},
247
 		"REGISTER": {
247
 		"REGISTER": {
248
 			handler:      registerHandler,
248
 			handler:      registerHandler,
249
-			minParams:    2,
249
+			minParams:    3,
250
 			usablePreReg: true,
250
 			usablePreReg: true,
251
 		},
251
 		},
252
 		"RENAME": {
252
 		"RENAME": {

+ 2
- 2
irc/config.go Zobrazit soubor

1385
 	}
1385
 	}
1386
 
1386
 
1387
 	if !config.Accounts.Registration.Enabled {
1387
 	if !config.Accounts.Registration.Enabled {
1388
-		config.Server.supportedCaps.Disable(caps.Register)
1388
+		config.Server.supportedCaps.Disable(caps.AccountRegistration)
1389
 	} else {
1389
 	} else {
1390
 		var registerValues []string
1390
 		var registerValues []string
1391
 		if config.Accounts.Registration.AllowBeforeConnect {
1391
 		if config.Accounts.Registration.AllowBeforeConnect {
1398
 			registerValues = append(registerValues, "account-required")
1398
 			registerValues = append(registerValues, "account-required")
1399
 		}
1399
 		}
1400
 		if len(registerValues) != 0 {
1400
 		if len(registerValues) != 0 {
1401
-			config.Server.capValues[caps.Register] = strings.Join(registerValues, ",")
1401
+			config.Server.capValues[caps.AccountRegistration] = strings.Join(registerValues, ",")
1402
 		}
1402
 		}
1403
 	}
1403
 	}
1404
 
1404
 

+ 12
- 3
irc/handlers.go Zobrazit soubor

2486
 	return true
2486
 	return true
2487
 }
2487
 }
2488
 
2488
 
2489
-// REGISTER < email | * > <password>
2489
+// REGISTER < account | * > < email | * > <password>
2490
 func registerHandler(server *Server, client *Client, msg ircmsg.Message, rb *ResponseBuffer) (exiting bool) {
2490
 func registerHandler(server *Server, client *Client, msg ircmsg.Message, rb *ResponseBuffer) (exiting bool) {
2491
 	accountName := client.Nick()
2491
 	accountName := client.Nick()
2492
 	if accountName == "*" {
2492
 	if accountName == "*" {
2493
 		accountName = client.preregNick
2493
 		accountName = client.preregNick
2494
 	}
2494
 	}
2495
+
2496
+	switch msg.Params[0] {
2497
+	case "*", accountName:
2498
+		// ok
2499
+	default:
2500
+		rb.Add(nil, server.name, "FAIL", "REGISTER", "ACCOUNTNAME_MUST_BE_NICK", utils.SafeErrorParam(msg.Params[0]), client.t("You may only register your nickname as your account name"))
2501
+		return
2502
+	}
2503
+
2495
 	// check that accountName is valid as a non-final parameter;
2504
 	// check that accountName is valid as a non-final parameter;
2496
 	// this is necessary for us to be valid and it will prevent us from emitting invalid error lines
2505
 	// this is necessary for us to be valid and it will prevent us from emitting invalid error lines
2497
 	nickErrorParam := utils.SafeErrorParam(accountName)
2506
 	nickErrorParam := utils.SafeErrorParam(accountName)
2514
 		return
2523
 		return
2515
 	}
2524
 	}
2516
 
2525
 
2517
-	callbackNamespace, callbackValue, err := parseCallback(msg.Params[0], config)
2526
+	callbackNamespace, callbackValue, err := parseCallback(msg.Params[1], config)
2518
 	if err != nil {
2527
 	if err != nil {
2519
 		rb.Add(nil, server.name, "FAIL", "REGISTER", "INVALID_EMAIL", accountName, client.t("A valid e-mail address is required"))
2528
 		rb.Add(nil, server.name, "FAIL", "REGISTER", "INVALID_EMAIL", accountName, client.t("A valid e-mail address is required"))
2520
 		return
2529
 		return
2521
 	}
2530
 	}
2522
 
2531
 
2523
-	err = server.accounts.Register(client, accountName, callbackNamespace, callbackValue, msg.Params[1], rb.session.certfp)
2532
+	err = server.accounts.Register(client, accountName, callbackNamespace, callbackValue, msg.Params[2], rb.session.certfp)
2524
 	switch err {
2533
 	switch err {
2525
 	case nil:
2534
 	case nil:
2526
 		if callbackNamespace == "*" {
2535
 		if callbackNamespace == "*" {

Načítá se…
Zrušit
Uložit