|
@@ -12,6 +12,7 @@ import (
|
12
|
12
|
"github.com/goshuirc/irc-go/ircfmt"
|
13
|
13
|
|
14
|
14
|
"github.com/oragono/oragono/irc/modes"
|
|
15
|
+ "github.com/oragono/oragono/irc/utils"
|
15
|
16
|
)
|
16
|
17
|
|
17
|
18
|
// "enabled" callbacks for specific nickserv commands
|
|
@@ -209,46 +210,51 @@ information on the settings and their possible values, see HELP SET.`,
|
209
|
210
|
capabs: []string{"accreg"},
|
210
|
211
|
},
|
211
|
212
|
"set": {
|
212
|
|
- handler: nsSetHandler,
|
213
|
|
- help: `Syntax $bSET <setting> <value>$b
|
|
213
|
+ handler: nsSetHandler,
|
|
214
|
+ helpShort: `$bSET$b modifies your account settings`,
|
|
215
|
+ // these are broken out as separate strings so they can be translated separately
|
|
216
|
+ helpStrings: []string{
|
|
217
|
+ `Syntax $bSET <setting> <value>$b
|
214
|
218
|
|
215
|
|
-Set modifies your account settings. The following settings ara available:
|
|
219
|
+Set modifies your account settings. The following settings are available:`,
|
216
|
220
|
|
217
|
|
-$bENFORCE$b
|
|
221
|
+ `$bENFORCE$b
|
218
|
222
|
'enforce' lets you specify a custom enforcement mechanism for your registered
|
219
|
223
|
nicknames. Your options are:
|
220
|
224
|
1. 'none' [no enforcement, overriding the server default]
|
221
|
225
|
2. 'timeout' [anyone using the nick must authenticate before a deadline,
|
222
|
226
|
or else they will be renamed]
|
223
|
227
|
3. 'strict' [you must already be authenticated to use the nick]
|
224
|
|
-4. 'default' [use the server default]
|
|
228
|
+4. 'default' [use the server default]`,
|
225
|
229
|
|
226
|
|
-$bBOUNCER$b
|
|
230
|
+ `$bBOUNCER$b
|
227
|
231
|
If 'bouncer' is enabled and you are already logged in and using a nick, a
|
228
|
232
|
second client of yours that authenticates with SASL and requests the same nick
|
229
|
233
|
is allowed to attach to the nick as well (this is comparable to the behavior
|
230
|
234
|
of IRC "bouncers" like ZNC). Your options are 'on' (allow this behavior),
|
231
|
|
-'off' (disallow it), and 'default' (use the server default value).
|
|
235
|
+'off' (disallow it), and 'default' (use the server default value).`,
|
232
|
236
|
|
233
|
|
-$bAUTOREPLAY-LINES$b
|
|
237
|
+ `$bAUTOREPLAY-LINES$b
|
234
|
238
|
'autoreplay-lines' controls the number of lines of channel history that will
|
235
|
239
|
be replayed to you automatically when joining a channel. Your options are any
|
236
|
240
|
positive number, 0 to disable the feature, and 'default' to use the server
|
237
|
|
-default.
|
|
241
|
+default.`,
|
238
|
242
|
|
239
|
|
-$bAUTOREPLAY-JOINS$b
|
|
243
|
+ `$bAUTOREPLAY-JOINS$b
|
240
|
244
|
'autoreplay-joins' controls whether autoreplayed channel history will include
|
241
|
245
|
lines for join and part. This provides more information about the context of
|
242
|
|
-messages, but may be spammy. Your options are 'on' and 'off'.
|
243
|
|
-`,
|
244
|
|
- helpShort: `$bSET$b modifies your account settings`,
|
|
246
|
+messages, but may be spammy. Your options are 'on' and 'off'.`,
|
|
247
|
+ },
|
245
|
248
|
authRequired: true,
|
246
|
249
|
enabled: servCmdRequiresAccreg,
|
247
|
250
|
minParams: 2,
|
248
|
251
|
},
|
249
|
252
|
"saset": {
|
250
|
|
- handler: nsSetHandler,
|
251
|
|
- help: `Syntax: $bSASET <account> <setting> <value>$b`,
|
|
253
|
+ handler: nsSetHandler,
|
|
254
|
+ help: `Syntax: $bSASET <account> <setting> <value>$b
|
|
255
|
+
|
|
256
|
+SASET modifies the values of someone else's account settings. For more
|
|
257
|
+information on the settings and their possible values, see HELP SET.`,
|
252
|
258
|
helpShort: `$bSASET$b modifies another user's account settings`,
|
253
|
259
|
enabled: servCmdRequiresAccreg,
|
254
|
260
|
minParams: 3,
|
|
@@ -328,22 +334,6 @@ func displaySetting(settingName string, settings AccountSettings, client *Client
|
328
|
334
|
}
|
329
|
335
|
}
|
330
|
336
|
|
331
|
|
-func stringToBool(str string) (result bool, err error) {
|
332
|
|
- switch strings.ToLower(str) {
|
333
|
|
- case "on":
|
334
|
|
- result = true
|
335
|
|
- case "off":
|
336
|
|
- result = false
|
337
|
|
- case "true":
|
338
|
|
- result = true
|
339
|
|
- case "false":
|
340
|
|
- result = false
|
341
|
|
- default:
|
342
|
|
- err = errInvalidParams
|
343
|
|
- }
|
344
|
|
- return
|
345
|
|
-}
|
346
|
|
-
|
347
|
337
|
func nsSetHandler(server *Server, client *Client, command string, params []string, rb *ResponseBuffer) {
|
348
|
338
|
var account string
|
349
|
339
|
if command == "saset" {
|
|
@@ -395,7 +385,7 @@ func nsSetHandler(server *Server, client *Client, command string, params []strin
|
395
|
385
|
newValue = BouncerAllowedServerDefault
|
396
|
386
|
} else {
|
397
|
387
|
var enabled bool
|
398
|
|
- enabled, err = stringToBool(params[1])
|
|
388
|
+ enabled, err = utils.StringToBool(params[1])
|
399
|
389
|
if enabled {
|
400
|
390
|
newValue = BouncerAllowedByUser
|
401
|
391
|
} else {
|
|
@@ -411,7 +401,7 @@ func nsSetHandler(server *Server, client *Client, command string, params []strin
|
411
|
401
|
}
|
412
|
402
|
case "autoreplay-joins":
|
413
|
403
|
var newValue bool
|
414
|
|
- newValue, err = stringToBool(params[1])
|
|
404
|
+ newValue, err = utils.StringToBool(params[1])
|
415
|
405
|
if err == nil {
|
416
|
406
|
munger = func(in AccountSettings) (out AccountSettings, err error) {
|
417
|
407
|
out = in
|
|
@@ -787,7 +777,7 @@ func nsPasswdHandler(server *Server, client *Client, command string, params []st
|
787
|
777
|
}
|
788
|
778
|
}
|
789
|
779
|
default:
|
790
|
|
- errorMessage = "Invalid parameters"
|
|
780
|
+ errorMessage = `Invalid parameters`
|
791
|
781
|
}
|
792
|
782
|
|
793
|
783
|
if errorMessage != "" {
|