Bläddra i källkod

Make like every client-facing string translatable

tags/v0.11.0-alpha
Daniel Oaks 6 år sedan
förälder
incheckning
275227a461
17 ändrade filer med 205 tillägg och 208 borttagningar
  1. 15
    15
      irc/accountreg.go
  2. 13
    13
      irc/accounts.go
  3. 1
    1
      irc/capability.go
  4. 23
    23
      irc/channel.go
  5. 8
    8
      irc/chanserv.go
  6. 13
    12
      irc/client.go
  7. 4
    4
      irc/commands.go
  8. 14
    14
      irc/dline.go
  9. 3
    3
      irc/gateways.go
  10. 4
    4
      irc/help.go
  11. 12
    12
      irc/kline.go
  12. 9
    9
      irc/modes.go
  13. 3
    3
      irc/monitor.go
  14. 5
    5
      irc/nickname.go
  15. 1
    1
      irc/nickserv.go
  16. 7
    7
      irc/roleplay.go
  17. 70
    74
      irc/server.go

+ 15
- 15
irc/accountreg.go Visa fil

@@ -67,9 +67,9 @@ func accHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
67 67
 	if subcommand == "register" {
68 68
 		return accRegisterHandler(server, client, msg)
69 69
 	} else if subcommand == "verify" {
70
-		client.Notice("VERIFY is not yet implemented")
70
+		client.Notice(client.t("VERIFY is not yet implemented"))
71 71
 	} else {
72
-		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, "ACC", msg.Params[0], "Unknown subcommand")
72
+		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, "ACC", msg.Params[0], client.t("Unknown subcommand"))
73 73
 	}
74 74
 
75 75
 	return false
@@ -91,7 +91,7 @@ func removeFailedAccRegisterData(store *buntdb.DB, account string) {
91 91
 func accRegisterHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
92 92
 	// make sure reg is enabled
93 93
 	if !server.accountRegistration.Enabled {
94
-		client.Send(nil, server.name, ERR_REG_UNSPECIFIED_ERROR, client.nick, "*", "Account registration is disabled")
94
+		client.Send(nil, server.name, ERR_REG_UNSPECIFIED_ERROR, client.nick, "*", client.t("Account registration is disabled"))
95 95
 		return false
96 96
 	}
97 97
 
@@ -100,7 +100,7 @@ func accRegisterHandler(server *Server, client *Client, msg ircmsg.IrcMessage) b
100 100
 		if server.accountRegistration.AllowMultiplePerConnection {
101 101
 			client.LogoutOfAccount()
102 102
 		} else {
103
-			client.Send(nil, server.name, ERR_REG_UNSPECIFIED_ERROR, client.nick, "*", "You're already logged into an account")
103
+			client.Send(nil, server.name, ERR_REG_UNSPECIFIED_ERROR, client.nick, "*", client.t("You're already logged into an account"))
104 104
 			return false
105 105
 		}
106 106
 	}
@@ -110,7 +110,7 @@ func accRegisterHandler(server *Server, client *Client, msg ircmsg.IrcMessage) b
110 110
 	casefoldedAccount, err := CasefoldName(account)
111 111
 	// probably don't need explicit check for "*" here... but let's do it anyway just to make sure
112 112
 	if err != nil || msg.Params[1] == "*" {
113
-		client.Send(nil, server.name, ERR_REG_UNSPECIFIED_ERROR, client.nick, account, "Account name is not valid")
113
+		client.Send(nil, server.name, ERR_REG_UNSPECIFIED_ERROR, client.nick, account, client.t("Account name is not valid"))
114 114
 		return false
115 115
 	}
116 116
 
@@ -122,7 +122,7 @@ func accRegisterHandler(server *Server, client *Client, msg ircmsg.IrcMessage) b
122 122
 		_, err := tx.Get(accountKey)
123 123
 		if err != buntdb.ErrNotFound {
124 124
 			//TODO(dan): if account verified key doesn't exist account is not verified, calc the maximum time without verification and expire and continue if need be
125
-			client.Send(nil, server.name, ERR_ACCOUNT_ALREADY_EXISTS, client.nick, account, "Account already exists")
125
+			client.Send(nil, server.name, ERR_ACCOUNT_ALREADY_EXISTS, client.nick, account, client.t("Account already exists"))
126 126
 			return errAccountCreation
127 127
 		}
128 128
 
@@ -137,7 +137,7 @@ func accRegisterHandler(server *Server, client *Client, msg ircmsg.IrcMessage) b
137 137
 	// account could not be created and relevant numerics have been dispatched, abort
138 138
 	if err != nil {
139 139
 		if err != errAccountCreation {
140
-			client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, "ACC", "REGISTER", "Could not register")
140
+			client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, "ACC", "REGISTER", client.t("Could not register"))
141 141
 			log.Println("Could not save registration initial data:", err.Error())
142 142
 		}
143 143
 		return false
@@ -167,7 +167,7 @@ func accRegisterHandler(server *Server, client *Client, msg ircmsg.IrcMessage) b
167 167
 	}
168 168
 
169 169
 	if !callbackValid {
170
-		client.Send(nil, server.name, ERR_REG_INVALID_CALLBACK, client.nick, account, callbackNamespace, "Callback namespace is not supported")
170
+		client.Send(nil, server.name, ERR_REG_INVALID_CALLBACK, client.nick, account, callbackNamespace, client.t("Callback namespace is not supported"))
171 171
 		removeFailedAccRegisterData(server.store, casefoldedAccount)
172 172
 		return false
173 173
 	}
@@ -182,7 +182,7 @@ func accRegisterHandler(server *Server, client *Client, msg ircmsg.IrcMessage) b
182 182
 		credentialType = "passphrase" // default from the spec
183 183
 		credentialValue = msg.Params[3]
184 184
 	} else {
185
-		client.Send(nil, server.name, ERR_NEEDMOREPARAMS, client.nick, msg.Command, "Not enough parameters")
185
+		client.Send(nil, server.name, ERR_NEEDMOREPARAMS, client.nick, msg.Command, client.t("Not enough parameters"))
186 186
 		removeFailedAccRegisterData(server.store, casefoldedAccount)
187 187
 		return false
188 188
 	}
@@ -195,13 +195,13 @@ func accRegisterHandler(server *Server, client *Client, msg ircmsg.IrcMessage) b
195 195
 		}
196 196
 	}
197 197
 	if credentialType == "certfp" && client.certfp == "" {
198
-		client.Send(nil, server.name, ERR_REG_INVALID_CRED_TYPE, client.nick, credentialType, callbackNamespace, "You are not using a TLS certificate")
198
+		client.Send(nil, server.name, ERR_REG_INVALID_CRED_TYPE, client.nick, credentialType, callbackNamespace, client.t("You are not using a TLS certificate"))
199 199
 		removeFailedAccRegisterData(server.store, casefoldedAccount)
200 200
 		return false
201 201
 	}
202 202
 
203 203
 	if !credentialValid {
204
-		client.Send(nil, server.name, ERR_REG_INVALID_CRED_TYPE, client.nick, credentialType, callbackNamespace, "Credential type is not supported")
204
+		client.Send(nil, server.name, ERR_REG_INVALID_CRED_TYPE, client.nick, credentialType, callbackNamespace, client.t("Credential type is not supported"))
205 205
 		removeFailedAccRegisterData(server.store, casefoldedAccount)
206 206
 		return false
207 207
 	}
@@ -274,14 +274,14 @@ func accRegisterHandler(server *Server, client *Client, msg ircmsg.IrcMessage) b
274 274
 			server.accounts[casefoldedAccount] = &account
275 275
 			client.account = &account
276 276
 
277
-			client.Send(nil, server.name, RPL_REGISTRATION_SUCCESS, client.nick, account.Name, "Account created")
278
-			client.Send(nil, server.name, RPL_LOGGEDIN, client.nick, client.nickMaskString, account.Name, fmt.Sprintf("You are now logged in as %s", account.Name))
279
-			client.Send(nil, server.name, RPL_SASLSUCCESS, client.nick, "Authentication successful")
277
+			client.Send(nil, server.name, RPL_REGISTRATION_SUCCESS, client.nick, account.Name, client.t("Account created"))
278
+			client.Send(nil, server.name, RPL_LOGGEDIN, client.nick, client.nickMaskString, account.Name, fmt.Sprintf(client.t("You are now logged in as %s"), account.Name))
279
+			client.Send(nil, server.name, RPL_SASLSUCCESS, client.nick, client.t("Authentication successful"))
280 280
 			server.snomasks.Send(sno.LocalAccounts, fmt.Sprintf(ircfmt.Unescape("Account registered $c[grey][$r%s$c[grey]] by $c[grey][$r%s$c[grey]]"), account.Name, client.nickMaskString))
281 281
 			return nil
282 282
 		})
283 283
 		if err != nil {
284
-			client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, "ACC", "REGISTER", "Could not register")
284
+			client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, "ACC", "REGISTER", client.t("Could not register"))
285 285
 			log.Println("Could not save verification confirmation (*):", err.Error())
286 286
 			removeFailedAccRegisterData(server.store, casefoldedAccount)
287 287
 			return false

+ 13
- 13
irc/accounts.go Visa fil

@@ -91,7 +91,7 @@ func loadAccount(server *Server, tx *buntdb.Tx, accountKey string) *ClientAccoun
91 91
 func authenticateHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
92 92
 	// sasl abort
93 93
 	if !server.accountAuthenticationEnabled || len(msg.Params) == 1 && msg.Params[0] == "*" {
94
-		client.Send(nil, server.name, ERR_SASLABORTED, client.nick, "SASL authentication aborted")
94
+		client.Send(nil, server.name, ERR_SASLABORTED, client.nick, client.t("SASL authentication aborted"))
95 95
 		client.saslInProgress = false
96 96
 		client.saslMechanism = ""
97 97
 		client.saslValue = ""
@@ -108,7 +108,7 @@ func authenticateHandler(server *Server, client *Client, msg ircmsg.IrcMessage)
108 108
 			client.saslMechanism = mechanism
109 109
 			client.Send(nil, server.name, "AUTHENTICATE", "+")
110 110
 		} else {
111
-			client.Send(nil, server.name, ERR_SASLFAIL, client.nick, "SASL authentication failed")
111
+			client.Send(nil, server.name, ERR_SASLFAIL, client.nick, client.t("SASL authentication failed"))
112 112
 		}
113 113
 
114 114
 		return false
@@ -118,7 +118,7 @@ func authenticateHandler(server *Server, client *Client, msg ircmsg.IrcMessage)
118 118
 	rawData := msg.Params[0]
119 119
 
120 120
 	if len(rawData) > 400 {
121
-		client.Send(nil, server.name, ERR_SASLTOOLONG, client.nick, "SASL message too long")
121
+		client.Send(nil, server.name, ERR_SASLTOOLONG, client.nick, client.t("SASL message too long"))
122 122
 		client.saslInProgress = false
123 123
 		client.saslMechanism = ""
124 124
 		client.saslValue = ""
@@ -127,7 +127,7 @@ func authenticateHandler(server *Server, client *Client, msg ircmsg.IrcMessage)
127 127
 		client.saslValue += rawData
128 128
 		// allow 4 'continuation' lines before rejecting for length
129 129
 		if len(client.saslValue) > 400*4 {
130
-			client.Send(nil, server.name, ERR_SASLFAIL, client.nick, "SASL authentication failed: Passphrase too long")
130
+			client.Send(nil, server.name, ERR_SASLFAIL, client.nick, client.t("SASL authentication failed: Passphrase too long"))
131 131
 			client.saslInProgress = false
132 132
 			client.saslMechanism = ""
133 133
 			client.saslValue = ""
@@ -144,7 +144,7 @@ func authenticateHandler(server *Server, client *Client, msg ircmsg.IrcMessage)
144 144
 	if client.saslValue != "+" {
145 145
 		data, err = base64.StdEncoding.DecodeString(client.saslValue)
146 146
 		if err != nil {
147
-			client.Send(nil, server.name, ERR_SASLFAIL, client.nick, "SASL authentication failed: Invalid b64 encoding")
147
+			client.Send(nil, server.name, ERR_SASLFAIL, client.nick, client.t("SASL authentication failed: Invalid b64 encoding"))
148 148
 			client.saslInProgress = false
149 149
 			client.saslMechanism = ""
150 150
 			client.saslValue = ""
@@ -157,7 +157,7 @@ func authenticateHandler(server *Server, client *Client, msg ircmsg.IrcMessage)
157 157
 
158 158
 	// like 100% not required, but it's good to be safe I guess
159 159
 	if !handlerExists {
160
-		client.Send(nil, server.name, ERR_SASLFAIL, client.nick, "SASL authentication failed")
160
+		client.Send(nil, server.name, ERR_SASLFAIL, client.nick, client.t("SASL authentication failed"))
161 161
 		client.saslInProgress = false
162 162
 		client.saslMechanism = ""
163 163
 		client.saslValue = ""
@@ -188,18 +188,18 @@ func authPlainHandler(server *Server, client *Client, mechanism string, value []
188 188
 		if accountKey == "" {
189 189
 			accountKey = authzid
190 190
 		} else if accountKey != authzid {
191
-			client.Send(nil, server.name, ERR_SASLFAIL, client.nick, "SASL authentication failed: authcid and authzid should be the same")
191
+			client.Send(nil, server.name, ERR_SASLFAIL, client.nick, client.t("SASL authentication failed: authcid and authzid should be the same"))
192 192
 			return false
193 193
 		}
194 194
 	} else {
195
-		client.Send(nil, server.name, ERR_SASLFAIL, client.nick, "SASL authentication failed: Invalid auth blob")
195
+		client.Send(nil, server.name, ERR_SASLFAIL, client.nick, client.t("SASL authentication failed: Invalid auth blob"))
196 196
 		return false
197 197
 	}
198 198
 
199 199
 	// keep it the same as in the REG CREATE stage
200 200
 	accountKey, err := CasefoldName(accountKey)
201 201
 	if err != nil {
202
-		client.Send(nil, server.name, ERR_SASLFAIL, client.nick, "SASL authentication failed: Bad account name")
202
+		client.Send(nil, server.name, ERR_SASLFAIL, client.nick, client.t("SASL authentication failed: Bad account name"))
203 203
 		return false
204 204
 	}
205 205
 
@@ -236,7 +236,7 @@ func authPlainHandler(server *Server, client *Client, mechanism string, value []
236 236
 	})
237 237
 
238 238
 	if err != nil {
239
-		client.Send(nil, server.name, ERR_SASLFAIL, client.nick, "SASL authentication failed")
239
+		client.Send(nil, server.name, ERR_SASLFAIL, client.nick, client.t("SASL authentication failed"))
240 240
 		return false
241 241
 	}
242 242
 
@@ -295,7 +295,7 @@ func (client *Client) LogoutOfAccount() {
295 295
 // authExternalHandler parses the SASL EXTERNAL mechanism.
296 296
 func authExternalHandler(server *Server, client *Client, mechanism string, value []byte) bool {
297 297
 	if client.certfp == "" {
298
-		client.Send(nil, server.name, ERR_SASLFAIL, client.nick, "SASL authentication failed, you are not connecting with a certificate")
298
+		client.Send(nil, server.name, ERR_SASLFAIL, client.nick, client.t("SASL authentication failed, you are not connecting with a certificate"))
299 299
 		return false
300 300
 	}
301 301
 
@@ -336,7 +336,7 @@ func authExternalHandler(server *Server, client *Client, mechanism string, value
336 336
 	})
337 337
 
338 338
 	if err != nil {
339
-		client.Send(nil, server.name, ERR_SASLFAIL, client.nick, "SASL authentication failed")
339
+		client.Send(nil, server.name, ERR_SASLFAIL, client.nick, client.t("SASL authentication failed"))
340 340
 		return false
341 341
 	}
342 342
 
@@ -347,7 +347,7 @@ func authExternalHandler(server *Server, client *Client, mechanism string, value
347 347
 // successfulSaslAuth means that a SASL auth attempt completed successfully, and is used to dispatch messages.
348 348
 func (client *Client) successfulSaslAuth() {
349 349
 	client.Send(nil, client.server.name, RPL_LOGGEDIN, client.nick, client.nickMaskString, client.account.Name, fmt.Sprintf("You are now logged in as %s", client.account.Name))
350
-	client.Send(nil, client.server.name, RPL_SASLSUCCESS, client.nick, "SASL authentication successful")
350
+	client.Send(nil, client.server.name, RPL_SASLSUCCESS, client.nick, client.t("SASL authentication successful"))
351 351
 
352 352
 	// dispatch account-notify
353 353
 	for friend := range client.Friends(caps.AccountNotify) {

+ 1
- 1
irc/capability.go Visa fil

@@ -88,7 +88,7 @@ func capHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
88 88
 		}
89 89
 
90 90
 	default:
91
-		client.Send(nil, server.name, ERR_INVALIDCAPCMD, client.nick, subCommand, "Invalid CAP subcommand")
91
+		client.Send(nil, server.name, ERR_INVALIDCAPCMD, client.nick, subCommand, client.t("Invalid CAP subcommand"))
92 92
 	}
93 93
 	return false
94 94
 }

+ 23
- 23
irc/channel.go Visa fil

@@ -197,7 +197,7 @@ func (channel *Channel) Names(client *Client) {
197 197
 	}
198 198
 
199 199
 	client.Send(nil, client.server.name, RPL_NAMREPLY, client.nick, "=", channel.name, buffer)
200
-	client.Send(nil, client.server.name, RPL_ENDOFNAMES, client.nick, channel.name, "End of NAMES list")
200
+	client.Send(nil, client.server.name, RPL_ENDOFNAMES, client.nick, channel.name, client.t("End of NAMES list"))
201 201
 }
202 202
 
203 203
 // ClientIsAtLeast returns whether the client has at least the given channel privilege.
@@ -381,25 +381,25 @@ func (channel *Channel) Join(client *Client, key string) {
381 381
 	}
382 382
 
383 383
 	if channel.IsFull() {
384
-		client.Send(nil, client.server.name, ERR_CHANNELISFULL, channel.name, "Cannot join channel (+l)")
384
+		client.Send(nil, client.server.name, ERR_CHANNELISFULL, channel.name, fmt.Sprintf(client.t("Cannot join channel (+%s)"), "l"))
385 385
 		return
386 386
 	}
387 387
 
388 388
 	if !channel.CheckKey(key) {
389
-		client.Send(nil, client.server.name, ERR_BADCHANNELKEY, channel.name, "Cannot join channel (+k)")
389
+		client.Send(nil, client.server.name, ERR_BADCHANNELKEY, channel.name, fmt.Sprintf(client.t("Cannot join channel (+%s)"), "k"))
390 390
 		return
391 391
 	}
392 392
 
393 393
 	isInvited := channel.lists[InviteMask].Match(client.nickMaskCasefolded)
394 394
 	if channel.flags[InviteOnly] && !isInvited {
395
-		client.Send(nil, client.server.name, ERR_INVITEONLYCHAN, channel.name, "Cannot join channel (+i)")
395
+		client.Send(nil, client.server.name, ERR_INVITEONLYCHAN, channel.name, fmt.Sprintf(client.t("Cannot join channel (+%s)"), "i"))
396 396
 		return
397 397
 	}
398 398
 
399 399
 	if channel.lists[BanMask].Match(client.nickMaskCasefolded) &&
400 400
 		!isInvited &&
401 401
 		!channel.lists[ExceptMask].Match(client.nickMaskCasefolded) {
402
-		client.Send(nil, client.server.name, ERR_BANNEDFROMCHAN, channel.name, "Cannot join channel (+b)")
402
+		client.Send(nil, client.server.name, ERR_BANNEDFROMCHAN, channel.name, fmt.Sprintf(client.t("Cannot join channel (+%s)"), "b"))
403 403
 		return
404 404
 	}
405 405
 
@@ -455,7 +455,7 @@ func (channel *Channel) Join(client *Client, key string) {
455 455
 // Part parts the given client from this channel, with the given message.
456 456
 func (channel *Channel) Part(client *Client, message string) {
457 457
 	if !channel.hasClient(client) {
458
-		client.Send(nil, client.server.name, ERR_NOTONCHANNEL, channel.name, "You're not on that channel")
458
+		client.Send(nil, client.server.name, ERR_NOTONCHANNEL, channel.name, client.t("You're not on that channel"))
459 459
 		return
460 460
 	}
461 461
 
@@ -470,7 +470,7 @@ func (channel *Channel) Part(client *Client, message string) {
470 470
 // SendTopic sends the channel topic to the given client.
471 471
 func (channel *Channel) SendTopic(client *Client) {
472 472
 	if !channel.hasClient(client) {
473
-		client.Send(nil, client.server.name, ERR_NOTONCHANNEL, client.nick, channel.name, "You're not on that channel")
473
+		client.Send(nil, client.server.name, ERR_NOTONCHANNEL, client.nick, channel.name, client.t("You're not on that channel"))
474 474
 		return
475 475
 	}
476 476
 
@@ -482,7 +482,7 @@ func (channel *Channel) SendTopic(client *Client) {
482 482
 	channel.stateMutex.RUnlock()
483 483
 
484 484
 	if topic == "" {
485
-		client.Send(nil, client.server.name, RPL_NOTOPIC, client.nick, name, "No topic is set")
485
+		client.Send(nil, client.server.name, RPL_NOTOPIC, client.nick, name, client.t("No topic is set"))
486 486
 		return
487 487
 	}
488 488
 
@@ -493,12 +493,12 @@ func (channel *Channel) SendTopic(client *Client) {
493 493
 // SetTopic sets the topic of this channel, if the client is allowed to do so.
494 494
 func (channel *Channel) SetTopic(client *Client, topic string) {
495 495
 	if !(client.flags[Operator] || channel.hasClient(client)) {
496
-		client.Send(nil, client.server.name, ERR_NOTONCHANNEL, channel.name, "You're not on that channel")
496
+		client.Send(nil, client.server.name, ERR_NOTONCHANNEL, channel.name, client.t("You're not on that channel"))
497 497
 		return
498 498
 	}
499 499
 
500 500
 	if channel.HasMode(OpOnlyTopic) && !channel.ClientIsAtLeast(client, ChannelOperator) {
501
-		client.Send(nil, client.server.name, ERR_CHANOPRIVSNEEDED, channel.name, "You're not a channel operator")
501
+		client.Send(nil, client.server.name, ERR_CHANOPRIVSNEEDED, channel.name, client.t("You're not a channel operator"))
502 502
 		return
503 503
 	}
504 504
 
@@ -545,7 +545,7 @@ func (channel *Channel) TagMsg(msgid string, minPrefix *Mode, clientOnlyTags *ma
545 545
 // sendMessage sends a given message to everyone on this channel.
546 546
 func (channel *Channel) sendMessage(msgid, cmd string, requiredCaps []caps.Capability, minPrefix *Mode, clientOnlyTags *map[string]ircmsg.TagValue, client *Client, message *string) {
547 547
 	if !channel.CanSpeak(client) {
548
-		client.Send(nil, client.server.name, ERR_CANNOTSENDTOCHAN, channel.name, "Cannot send to channel")
548
+		client.Send(nil, client.server.name, ERR_CANNOTSENDTOCHAN, channel.name, client.t("Cannot send to channel"))
549 549
 		return
550 550
 	}
551 551
 
@@ -598,7 +598,7 @@ func (channel *Channel) SplitNotice(msgid string, minPrefix *Mode, clientOnlyTag
598 598
 
599 599
 func (channel *Channel) sendSplitMessage(msgid, cmd string, minPrefix *Mode, clientOnlyTags *map[string]ircmsg.TagValue, client *Client, message *SplitMessage) {
600 600
 	if !channel.CanSpeak(client) {
601
-		client.Send(nil, client.server.name, ERR_CANNOTSENDTOCHAN, channel.name, "Cannot send to channel")
601
+		client.Send(nil, client.server.name, ERR_CANNOTSENDTOCHAN, channel.name, client.t("Cannot send to channel"))
602 602
 		return
603 603
 	}
604 604
 
@@ -632,14 +632,14 @@ func (channel *Channel) applyModeMemberNoMutex(client *Client, mode Mode,
632 632
 	op ModeOp, nick string) *ModeChange {
633 633
 	if nick == "" {
634 634
 		//TODO(dan): shouldn't this be handled before it reaches this function?
635
-		client.Send(nil, client.server.name, ERR_NEEDMOREPARAMS, "MODE", "Not enough parameters")
635
+		client.Send(nil, client.server.name, ERR_NEEDMOREPARAMS, "MODE", client.t("Not enough parameters"))
636 636
 		return nil
637 637
 	}
638 638
 
639 639
 	casefoldedName, err := CasefoldName(nick)
640 640
 	target := channel.server.clients.Get(casefoldedName)
641 641
 	if err != nil || target == nil {
642
-		client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, nick, "No such nick")
642
+		client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, nick, client.t("No such nick"))
643 643
 		return nil
644 644
 	}
645 645
 
@@ -654,7 +654,7 @@ func (channel *Channel) applyModeMemberNoMutex(client *Client, mode Mode,
654 654
 	channel.stateMutex.Unlock()
655 655
 
656 656
 	if !exists {
657
-		client.Send(nil, client.server.name, ERR_USERNOTINCHANNEL, client.nick, channel.name, "They aren't on that channel")
657
+		client.Send(nil, client.server.name, ERR_USERNOTINCHANNEL, client.nick, channel.name, client.t("They aren't on that channel"))
658 658
 		return nil
659 659
 	} else if already {
660 660
 		return nil
@@ -690,7 +690,7 @@ func (channel *Channel) ShowMaskList(client *Client, mode Mode) {
690 690
 	}
691 691
 	channel.stateMutex.RUnlock()
692 692
 
693
-	client.Send(nil, client.server.name, rplendoflist, nick, channel.name, "End of list")
693
+	client.Send(nil, client.server.name, rplendoflist, nick, channel.name, client.t("End of list"))
694 694
 }
695 695
 
696 696
 func (channel *Channel) applyModeMask(client *Client, mode Mode, op ModeOp, mask string) bool {
@@ -706,7 +706,7 @@ func (channel *Channel) applyModeMask(client *Client, mode Mode, op ModeOp, mask
706 706
 	}
707 707
 
708 708
 	if !channel.ClientIsAtLeast(client, ChannelOperator) {
709
-		client.Send(nil, client.server.name, ERR_CHANOPRIVSNEEDED, channel.name, "You're not a channel operator")
709
+		client.Send(nil, client.server.name, ERR_CHANOPRIVSNEEDED, channel.name, client.t("You're not a channel operator"))
710 710
 		return false
711 711
 	}
712 712
 
@@ -733,19 +733,19 @@ func (channel *Channel) Quit(client *Client) {
733 733
 
734 734
 func (channel *Channel) Kick(client *Client, target *Client, comment string) {
735 735
 	if !(client.flags[Operator] || channel.hasClient(client)) {
736
-		client.Send(nil, client.server.name, ERR_NOTONCHANNEL, channel.name, "You're not on that channel")
736
+		client.Send(nil, client.server.name, ERR_NOTONCHANNEL, channel.name, client.t("You're not on that channel"))
737 737
 		return
738 738
 	}
739 739
 	if !channel.ClientIsAtLeast(client, ChannelOperator) {
740
-		client.Send(nil, client.server.name, ERR_CANNOTSENDTOCHAN, channel.name, "Cannot send to channel")
740
+		client.Send(nil, client.server.name, ERR_CANNOTSENDTOCHAN, channel.name, client.t("Cannot send to channel"))
741 741
 		return
742 742
 	}
743 743
 	if !channel.hasClient(target) {
744
-		client.Send(nil, client.server.name, ERR_USERNOTINCHANNEL, client.nick, channel.name, "They aren't on that channel")
744
+		client.Send(nil, client.server.name, ERR_USERNOTINCHANNEL, client.nick, channel.name, client.t("They aren't on that channel"))
745 745
 		return
746 746
 	}
747 747
 	if !channel.ClientHasPrivsOver(client, target) {
748
-		client.Send(nil, client.server.name, ERR_CHANOPRIVSNEEDED, channel.name, "You're not a channel operator")
748
+		client.Send(nil, client.server.name, ERR_CHANOPRIVSNEEDED, channel.name, client.t("You're not a channel operator"))
749 749
 		return
750 750
 	}
751 751
 
@@ -766,12 +766,12 @@ func (channel *Channel) Kick(client *Client, target *Client, comment string) {
766 766
 // Invite invites the given client to the channel, if the inviter can do so.
767 767
 func (channel *Channel) Invite(invitee *Client, inviter *Client) {
768 768
 	if channel.flags[InviteOnly] && !channel.ClientIsAtLeast(inviter, ChannelOperator) {
769
-		inviter.Send(nil, inviter.server.name, ERR_CHANOPRIVSNEEDED, channel.name, "You're not a channel operator")
769
+		inviter.Send(nil, inviter.server.name, ERR_CHANOPRIVSNEEDED, channel.name, inviter.t("You're not a channel operator"))
770 770
 		return
771 771
 	}
772 772
 
773 773
 	if !channel.hasClient(inviter) {
774
-		inviter.Send(nil, inviter.server.name, ERR_NOTONCHANNEL, channel.name, "You're not on that channel")
774
+		inviter.Send(nil, inviter.server.name, ERR_NOTONCHANNEL, channel.name, inviter.t("You're not on that channel"))
775 775
 		return
776 776
 	}
777 777
 

+ 8
- 8
irc/chanserv.go Visa fil

@@ -35,7 +35,7 @@ func (server *Server) chanservReceivePrivmsg(client *Client, message string) {
35 35
 		}
36 36
 	}
37 37
 	if len(params) < 1 {
38
-		client.ChanServNotice("You need to run a command")
38
+		client.ChanServNotice(client.t("You need to run a command"))
39 39
 		//TODO(dan): dump CS help here
40 40
 		return
41 41
 	}
@@ -45,30 +45,30 @@ func (server *Server) chanservReceivePrivmsg(client *Client, message string) {
45 45
 
46 46
 	if command == "register" {
47 47
 		if len(params) < 2 {
48
-			client.ChanServNotice("Syntax: REGISTER <channel>")
48
+			client.ChanServNotice(client.t("Syntax: REGISTER <channel>"))
49 49
 			return
50 50
 		}
51 51
 
52 52
 		if !server.channelRegistrationEnabled {
53
-			client.ChanServNotice("Channel registration is not enabled")
53
+			client.ChanServNotice(client.t("Channel registration is not enabled"))
54 54
 			return
55 55
 		}
56 56
 
57 57
 		channelName := params[1]
58 58
 		channelKey, err := CasefoldChannel(channelName)
59 59
 		if err != nil {
60
-			client.ChanServNotice("Channel name is not valid")
60
+			client.ChanServNotice(client.t("Channel name is not valid"))
61 61
 			return
62 62
 		}
63 63
 
64 64
 		channelInfo := server.channels.Get(channelKey)
65 65
 		if channelInfo == nil || !channelInfo.ClientIsAtLeast(client, ChannelOperator) {
66
-			client.ChanServNotice("You must be an oper on the channel to register it")
66
+			client.ChanServNotice(client.t("You must be an oper on the channel to register it"))
67 67
 			return
68 68
 		}
69 69
 
70 70
 		if client.account == &NoAccount {
71
-			client.ChanServNotice("You must be logged in to register a channel")
71
+			client.ChanServNotice(client.t("You must be logged in to register a channel"))
72 72
 			return
73 73
 		}
74 74
 
@@ -82,7 +82,7 @@ func (server *Server) chanservReceivePrivmsg(client *Client, message string) {
82 82
 		// registration was successful: make the database reflect it
83 83
 		go server.channelRegistry.StoreChannel(channelInfo, true)
84 84
 
85
-		client.ChanServNotice(fmt.Sprintf("Channel %s successfully registered", channelName))
85
+		client.ChanServNotice(fmt.Sprintf(client.t("Channel %s successfully registered"), channelName))
86 86
 
87 87
 		server.logger.Info("chanserv", fmt.Sprintf("Client %s registered channel %s", client.nick, channelName))
88 88
 		server.snomasks.Send(sno.LocalChannels, fmt.Sprintf(ircfmt.Unescape("Channel registered $c[grey][$r%s$c[grey]] by $c[grey][$r%s$c[grey]]"), channelName, client.nickMaskString))
@@ -98,6 +98,6 @@ func (server *Server) chanservReceivePrivmsg(client *Client, message string) {
98 98
 			}
99 99
 		}
100 100
 	} else {
101
-		client.ChanServNotice("Sorry, I don't know that command")
101
+		client.ChanServNotice(client.t("Sorry, I don't know that command"))
102 102
 	}
103 103
 }

+ 13
- 12
irc/client.go Visa fil

@@ -102,6 +102,7 @@ func NewClient(server *Server, conn net.Conn, isTLS bool) *Client {
102 102
 		nickCasefolded: "*",
103 103
 		nickMaskString: "*", // * is used until actual nick is given
104 104
 	}
105
+
105 106
 	client.recomputeMaxlens()
106 107
 	if isTLS {
107 108
 		client.flags[TLS] = true
@@ -121,20 +122,20 @@ func NewClient(server *Server, conn net.Conn, isTLS bool) *Client {
121 122
 			log.Fatal(err)
122 123
 		}
123 124
 
124
-		client.Notice("*** Looking up your username")
125
+		client.Notice(client.t("*** Looking up your username"))
125 126
 		resp, err := ident.Query(clientHost, serverPort, clientPort, IdentTimeoutSeconds)
126 127
 		if err == nil {
127 128
 			username := resp.Identifier
128 129
 			_, err := CasefoldName(username) // ensure it's a valid username
129 130
 			if err == nil {
130
-				client.Notice("*** Found your username")
131
+				client.Notice(client.t("*** Found your username"))
131 132
 				client.username = username
132 133
 				// we don't need to updateNickMask here since nickMask is not used for anything yet
133 134
 			} else {
134
-				client.Notice("*** Got a malformed username, ignoring")
135
+				client.Notice(client.t("*** Got a malformed username, ignoring"))
135 136
 			}
136 137
 		} else {
137
-			client.Notice("*** Could not find your username")
138
+			client.Notice(client.t("*** Could not find your username"))
138 139
 		}
139 140
 	}
140 141
 	go client.run()
@@ -236,16 +237,16 @@ func (client *Client) run() {
236 237
 		if err == ircmsg.ErrorLineIsEmpty {
237 238
 			continue
238 239
 		} else if err != nil {
239
-			client.Quit("received malformed line")
240
+			client.Quit(client.t("Received malformed line"))
240 241
 			break
241 242
 		}
242 243
 
243 244
 		cmd, exists := Commands[msg.Command]
244 245
 		if !exists {
245 246
 			if len(msg.Command) > 0 {
246
-				client.Send(nil, client.server.name, ERR_UNKNOWNCOMMAND, client.nick, msg.Command, "Unknown command")
247
+				client.Send(nil, client.server.name, ERR_UNKNOWNCOMMAND, client.nick, msg.Command, client.t("Unknown command"))
247 248
 			} else {
248
-				client.Send(nil, client.server.name, ERR_UNKNOWNCOMMAND, client.nick, "lastcmd", "No command given")
249
+				client.Send(nil, client.server.name, ERR_UNKNOWNCOMMAND, client.nick, "lastcmd", client.t("No command given"))
249 250
 			}
250 251
 			continue
251 252
 		}
@@ -328,13 +329,13 @@ func (client *Client) TryResume() {
328 329
 	// can't use server.clients.Get since we hold server.clients' tier 1 mutex
329 330
 	casefoldedName, err := CasefoldName(oldnick)
330 331
 	if err != nil {
331
-		client.Send(nil, server.name, ERR_CANNOT_RESUME, oldnick, "Cannot resume connection, old client not found")
332
+		client.Send(nil, server.name, ERR_CANNOT_RESUME, oldnick, client.t("Cannot resume connection, old client not found"))
332 333
 		return
333 334
 	}
334 335
 
335 336
 	oldClient := server.clients.byNick[casefoldedName]
336 337
 	if oldClient == nil {
337
-		client.Send(nil, server.name, ERR_CANNOT_RESUME, oldnick, "Cannot resume connection, old client not found")
338
+		client.Send(nil, server.name, ERR_CANNOT_RESUME, oldnick, client.t("Cannot resume connection, old client not found"))
338 339
 		return
339 340
 	}
340 341
 
@@ -342,12 +343,12 @@ func (client *Client) TryResume() {
342 343
 	newAccountName := client.AccountName()
343 344
 
344 345
 	if oldAccountName == "" || newAccountName == "" || oldAccountName != newAccountName {
345
-		client.Send(nil, server.name, ERR_CANNOT_RESUME, oldnick, "Cannot resume connection, old and new clients must be logged into the same account")
346
+		client.Send(nil, server.name, ERR_CANNOT_RESUME, oldnick, client.t("Cannot resume connection, old and new clients must be logged into the same account"))
346 347
 		return
347 348
 	}
348 349
 
349 350
 	if !oldClient.HasMode(TLS) || !client.HasMode(TLS) {
350
-		client.Send(nil, server.name, ERR_CANNOT_RESUME, oldnick, "Cannot resume connection, old and new clients must have TLS")
351
+		client.Send(nil, server.name, ERR_CANNOT_RESUME, oldnick, client.t("Cannot resume connection, old and new clients must have TLS"))
351 352
 		return
352 353
 	}
353 354
 
@@ -370,7 +371,7 @@ func (client *Client) TryResume() {
370 371
 				friend.Send(nil, oldClient.NickMaskString(), "RESUMED", oldClient.nick, client.username, client.Hostname(), timestampString)
371 372
 			}
372 373
 		} else {
373
-			friend.Send(nil, oldClient.NickMaskString(), "QUIT", "Client reconnected")
374
+			friend.Send(nil, oldClient.NickMaskString(), "QUIT", friend.t("Client reconnected"))
374 375
 		}
375 376
 	}
376 377
 

+ 4
- 4
irc/commands.go Visa fil

@@ -21,19 +21,19 @@ type Command struct {
21 21
 // Run runs this command with the given client/message.
22 22
 func (cmd *Command) Run(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
23 23
 	if !client.registered && !cmd.usablePreReg {
24
-		client.Send(nil, server.name, ERR_NOTREGISTERED, client.nick, "You need to register before you can use that command")
24
+		client.Send(nil, server.name, ERR_NOTREGISTERED, client.nick, client.t("You need to register before you can use that command"))
25 25
 		return false
26 26
 	}
27 27
 	if cmd.oper && !client.flags[Operator] {
28
-		client.Send(nil, server.name, ERR_NOPRIVILEGES, client.nick, "Permission Denied - You're not an IRC operator")
28
+		client.Send(nil, server.name, ERR_NOPRIVILEGES, client.nick, client.t("Permission Denied - You're not an IRC operator"))
29 29
 		return false
30 30
 	}
31 31
 	if len(cmd.capabs) > 0 && !client.HasRoleCapabs(cmd.capabs...) {
32
-		client.Send(nil, server.name, ERR_NOPRIVILEGES, client.nick, "Permission Denied")
32
+		client.Send(nil, server.name, ERR_NOPRIVILEGES, client.nick, client.t("Permission Denied"))
33 33
 		return false
34 34
 	}
35 35
 	if len(msg.Params) < cmd.minParams {
36
-		client.Send(nil, server.name, ERR_NEEDMOREPARAMS, client.nick, msg.Command, "Not enough parameters")
36
+		client.Send(nil, server.name, ERR_NEEDMOREPARAMS, client.nick, msg.Command, client.t("Not enough parameters"))
37 37
 		return false
38 38
 	}
39 39
 	if !cmd.leaveClientActive {

+ 14
- 14
irc/dline.go Visa fil

@@ -221,7 +221,7 @@ func (dm *DLineManager) CheckIP(addr net.IP) (isBanned bool, info *IPBanInfo) {
221 221
 func dlineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
222 222
 	// check oper permissions
223 223
 	if !client.class.Capabilities["oper:local_ban"] {
224
-		client.Send(nil, server.name, ERR_NOPRIVS, client.nick, msg.Command, "Insufficient oper privs")
224
+		client.Send(nil, server.name, ERR_NOPRIVS, client.nick, msg.Command, client.t("Insufficient oper privs"))
225 225
 		return false
226 226
 	}
227 227
 
@@ -232,11 +232,11 @@ func dlineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
232 232
 		bans := server.dlines.AllBans()
233 233
 
234 234
 		if len(bans) == 0 {
235
-			client.Notice("No DLINEs have been set!")
235
+			client.Notice(client.t("No DLINEs have been set!"))
236 236
 		}
237 237
 
238 238
 		for key, info := range bans {
239
-			client.Notice(fmt.Sprintf("Ban - %s - added by %s - %s", key, info.OperName, info.BanMessage("%s")))
239
+			client.Notice(fmt.Sprintf(client.t("Ban - %s - added by %s - %s"), key, info.OperName, info.BanMessage("%s")))
240 240
 		}
241 241
 
242 242
 		return false
@@ -266,7 +266,7 @@ func dlineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
266 266
 
267 267
 	// get host
268 268
 	if len(msg.Params) < currentArg+1 {
269
-		client.Send(nil, server.name, ERR_NEEDMOREPARAMS, client.nick, msg.Command, "Not enough parameters")
269
+		client.Send(nil, server.name, ERR_NEEDMOREPARAMS, client.nick, msg.Command, client.t("Not enough parameters"))
270 270
 		return false
271 271
 	}
272 272
 	hostString := msg.Params[currentArg]
@@ -282,27 +282,27 @@ func dlineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
282 282
 	}
283 283
 
284 284
 	if hostAddr == nil && hostNet == nil {
285
-		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, "Could not parse IP address or CIDR network")
285
+		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, client.t("Could not parse IP address or CIDR network"))
286 286
 		return false
287 287
 	}
288 288
 
289 289
 	if hostNet == nil {
290 290
 		hostString = hostAddr.String()
291 291
 		if !dlineMyself && hostAddr.Equal(client.IP()) {
292
-			client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, "This ban matches you. To DLINE yourself, you must use the command:  /DLINE MYSELF <arguments>")
292
+			client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, client.t("This ban matches you. To DLINE yourself, you must use the command:  /DLINE MYSELF <arguments>"))
293 293
 			return false
294 294
 		}
295 295
 	} else {
296 296
 		hostString = hostNet.String()
297 297
 		if !dlineMyself && hostNet.Contains(client.IP()) {
298
-			client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, "This ban matches you. To DLINE yourself, you must use the command:  /DLINE MYSELF <arguments>")
298
+			client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, client.t("This ban matches you. To DLINE yourself, you must use the command:  /DLINE MYSELF <arguments>"))
299 299
 			return false
300 300
 		}
301 301
 	}
302 302
 
303 303
 	// check remote
304 304
 	if len(msg.Params) > currentArg && msg.Params[currentArg] == "ON" {
305
-		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, "Remote servers not yet supported")
305
+		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, client.t("Remote servers not yet supported"))
306 306
 		return false
307 307
 	}
308 308
 
@@ -360,7 +360,7 @@ func dlineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
360 360
 	})
361 361
 
362 362
 	if err != nil {
363
-		client.Notice(fmt.Sprintf("Could not successfully save new D-LINE: %s", err.Error()))
363
+		client.Notice(fmt.Sprintf(client.t("Could not successfully save new D-LINE: %s"), err.Error()))
364 364
 		return false
365 365
 	}
366 366
 
@@ -401,7 +401,7 @@ func dlineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
401 401
 
402 402
 		for _, mcl := range clientsToKill {
403 403
 			mcl.exitedSnomaskSent = true
404
-			mcl.Quit(fmt.Sprintf("You have been banned from this server (%s)", reason))
404
+			mcl.Quit(fmt.Sprintf(mcl.t("You have been banned from this server (%s)"), reason))
405 405
 			if mcl == client {
406 406
 				killClient = true
407 407
 			} else {
@@ -421,7 +421,7 @@ func dlineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
421 421
 func unDLineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
422 422
 	// check oper permissions
423 423
 	if !client.class.Capabilities["oper:local_unban"] {
424
-		client.Send(nil, server.name, ERR_NOPRIVS, client.nick, msg.Command, "Insufficient oper privs")
424
+		client.Send(nil, server.name, ERR_NOPRIVS, client.nick, msg.Command, client.t("Insufficient oper privs"))
425 425
 		return false
426 426
 	}
427 427
 
@@ -438,7 +438,7 @@ func unDLineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
438 438
 	}
439 439
 
440 440
 	if hostAddr == nil && hostNet == nil {
441
-		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, "Could not parse IP address or CIDR network")
441
+		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, client.t("Could not parse IP address or CIDR network"))
442 442
 		return false
443 443
 	}
444 444
 
@@ -465,7 +465,7 @@ func unDLineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
465 465
 	})
466 466
 
467 467
 	if err != nil {
468
-		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, fmt.Sprintf("Could not remove ban [%s]", err.Error()))
468
+		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, fmt.Sprintf(client.t("Could not remove ban [%s]"), err.Error()))
469 469
 		return false
470 470
 	}
471 471
 
@@ -475,7 +475,7 @@ func unDLineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
475 475
 		server.dlines.RemoveNetwork(*hostNet)
476 476
 	}
477 477
 
478
-	client.Notice(fmt.Sprintf("Removed D-Line for %s", hostString))
478
+	client.Notice(fmt.Sprintf(client.t("Removed D-Line for %s"), hostString))
479 479
 	server.snomasks.Send(sno.LocalXline, fmt.Sprintf(ircfmt.Unescape("%s$r removed D-Line for %s"), client.nick, hostString))
480 480
 	return false
481 481
 }

+ 3
- 3
irc/gateways.go Visa fil

@@ -85,7 +85,7 @@ func webircHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
85 85
 		}
86 86
 	}
87 87
 
88
-	client.Quit("WEBIRC command is not usable from your address or incorrect password given")
88
+	client.Quit(client.t("WEBIRC command is not usable from your address or incorrect password given"))
89 89
 	return true
90 90
 }
91 91
 
@@ -107,7 +107,7 @@ func proxyHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
107 107
 			return client.ApplyProxiedIP(proxiedIP, true)
108 108
 		}
109 109
 	}
110
-	client.Quit("PROXY command is not usable from your address")
110
+	client.Quit(client.t("PROXY command is not usable from your address"))
111 111
 	return true
112 112
 }
113 113
 
@@ -116,7 +116,7 @@ func (client *Client) ApplyProxiedIP(proxiedIP string, tls bool) (exiting bool)
116 116
 	// ensure IP is sane
117 117
 	parsedProxiedIP := net.ParseIP(proxiedIP)
118 118
 	if parsedProxiedIP == nil {
119
-		client.Quit(fmt.Sprintf("Proxied IP address is not valid: [%s]", proxiedIP))
119
+		client.Quit(fmt.Sprintf(client.t("Proxied IP address is not valid: [%s]"), proxiedIP))
120 120
 		return true
121 121
 	}
122 122
 

+ 4
- 4
irc/help.go Visa fil

@@ -652,7 +652,7 @@ func (client *Client) sendHelp(name string, text string) {
652 652
 		}
653 653
 	}
654 654
 	args := splitName
655
-	args = append(args, "End of /HELPOP")
655
+	args = append(args, client.t("End of /HELPOP"))
656 656
 	client.Send(nil, client.server.name, RPL_ENDOFHELP, args...)
657 657
 }
658 658
 
@@ -661,9 +661,9 @@ func helpHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
661 661
 	argument := strings.ToLower(strings.TrimSpace(strings.Join(msg.Params, " ")))
662 662
 
663 663
 	if len(argument) < 1 {
664
-		client.sendHelp("HELPOP", `HELPOP <argument>
664
+		client.sendHelp("HELPOP", client.t(`HELPOP <argument>
665 665
 
666
-Get an explanation of <argument>, or "index" for a list of help topics.`)
666
+Get an explanation of <argument>, or "index" for a list of help topics.`))
667 667
 		return false
668 668
 	}
669 669
 
@@ -683,7 +683,7 @@ Get an explanation of <argument>, or "index" for a list of help topics.`)
683 683
 		client.sendHelp(strings.ToUpper(argument), helpHandler.text)
684 684
 	} else {
685 685
 		args := msg.Params
686
-		args = append(args, "Help not found")
686
+		args = append(args, client.t("Help not found"))
687 687
 		client.Send(nil, server.name, ERR_HELPNOTFOUND, args...)
688 688
 	}
689 689
 

+ 12
- 12
irc/kline.go Visa fil

@@ -132,7 +132,7 @@ func (km *KLineManager) CheckMasks(masks ...string) (isBanned bool, info *IPBanI
132 132
 func klineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
133 133
 	// check oper permissions
134 134
 	if !client.class.Capabilities["oper:local_ban"] {
135
-		client.Send(nil, server.name, ERR_NOPRIVS, client.nick, msg.Command, "Insufficient oper privs")
135
+		client.Send(nil, server.name, ERR_NOPRIVS, client.nick, msg.Command, client.t("Insufficient oper privs"))
136 136
 		return false
137 137
 	}
138 138
 
@@ -147,7 +147,7 @@ func klineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
147 147
 		}
148 148
 
149 149
 		for key, info := range bans {
150
-			client.Notice(fmt.Sprintf("Ban - %s - added by %s - %s", key, info.OperName, info.BanMessage("%s")))
150
+			client.Notice(fmt.Sprintf(client.t("Ban - %s - added by %s - %s"), key, info.OperName, info.BanMessage("%s")))
151 151
 		}
152 152
 
153 153
 		return false
@@ -177,7 +177,7 @@ func klineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
177 177
 
178 178
 	// get mask
179 179
 	if len(msg.Params) < currentArg+1 {
180
-		client.Send(nil, server.name, ERR_NEEDMOREPARAMS, client.nick, msg.Command, "Not enough parameters")
180
+		client.Send(nil, server.name, ERR_NEEDMOREPARAMS, client.nick, msg.Command, client.t("Not enough parameters"))
181 181
 		return false
182 182
 	}
183 183
 	mask := strings.ToLower(msg.Params[currentArg])
@@ -194,14 +194,14 @@ func klineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
194 194
 
195 195
 	for _, clientMask := range client.AllNickmasks() {
196 196
 		if !klineMyself && matcher.Match(clientMask) {
197
-			client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, "This ban matches you. To KLINE yourself, you must use the command:  /KLINE MYSELF <arguments>")
197
+			client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, client.t("This ban matches you. To KLINE yourself, you must use the command:  /KLINE MYSELF <arguments>"))
198 198
 			return false
199 199
 		}
200 200
 	}
201 201
 
202 202
 	// check remote
203 203
 	if len(msg.Params) > currentArg && msg.Params[currentArg] == "ON" {
204
-		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, "Remote servers not yet supported")
204
+		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, client.t("Remote servers not yet supported"))
205 205
 		return false
206 206
 	}
207 207
 
@@ -261,7 +261,7 @@ func klineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
261 261
 	})
262 262
 
263 263
 	if err != nil {
264
-		client.Notice(fmt.Sprintf("Could not successfully save new K-LINE: %s", err.Error()))
264
+		client.Notice(fmt.Sprintf(client.t("Could not successfully save new K-LINE: %s"), err.Error()))
265 265
 		return false
266 266
 	}
267 267
 
@@ -269,10 +269,10 @@ func klineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
269 269
 
270 270
 	var snoDescription string
271 271
 	if durationIsUsed {
272
-		client.Notice(fmt.Sprintf("Added temporary (%s) K-Line for %s", duration.String(), mask))
272
+		client.Notice(fmt.Sprintf(client.t("Added temporary (%s) K-Line for %s"), duration.String(), mask))
273 273
 		snoDescription = fmt.Sprintf(ircfmt.Unescape("%s [%s]$r added temporary (%s) K-Line for %s"), client.nick, operName, duration.String(), mask)
274 274
 	} else {
275
-		client.Notice(fmt.Sprintf("Added K-Line for %s", mask))
275
+		client.Notice(fmt.Sprintf(client.t("Added K-Line for %s"), mask))
276 276
 		snoDescription = fmt.Sprintf(ircfmt.Unescape("%s [%s]$r added K-Line for %s"), client.nick, operName, mask)
277 277
 	}
278 278
 	server.snomasks.Send(sno.LocalXline, snoDescription)
@@ -293,7 +293,7 @@ func klineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
293 293
 
294 294
 		for _, mcl := range clientsToKill {
295 295
 			mcl.exitedSnomaskSent = true
296
-			mcl.Quit(fmt.Sprintf("You have been banned from this server (%s)", reason))
296
+			mcl.Quit(fmt.Sprintf(mcl.t("You have been banned from this server (%s)"), reason))
297 297
 			if mcl == client {
298 298
 				killClient = true
299 299
 			} else {
@@ -313,7 +313,7 @@ func klineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
313 313
 func unKLineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
314 314
 	// check oper permissions
315 315
 	if !client.class.Capabilities["oper:local_unban"] {
316
-		client.Send(nil, server.name, ERR_NOPRIVS, client.nick, msg.Command, "Insufficient oper privs")
316
+		client.Send(nil, server.name, ERR_NOPRIVS, client.nick, msg.Command, client.t("Insufficient oper privs"))
317 317
 		return false
318 318
 	}
319 319
 
@@ -343,13 +343,13 @@ func unKLineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
343 343
 	})
344 344
 
345 345
 	if err != nil {
346
-		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, fmt.Sprintf("Could not remove ban [%s]", err.Error()))
346
+		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, fmt.Sprintf(client.t("Could not remove ban [%s]"), err.Error()))
347 347
 		return false
348 348
 	}
349 349
 
350 350
 	server.klines.RemoveMask(mask)
351 351
 
352
-	client.Notice(fmt.Sprintf("Removed K-Line for %s", mask))
352
+	client.Notice(fmt.Sprintf(client.t("Removed K-Line for %s"), mask))
353 353
 	server.snomasks.Send(sno.LocalXline, fmt.Sprintf(ircfmt.Unescape("%s$r removed K-Line for %s"), client.nick, mask))
354 354
 	return false
355 355
 }

+ 9
- 9
irc/modes.go Visa fil

@@ -330,7 +330,7 @@ func umodeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
330 330
 	target := server.clients.Get(nickname)
331 331
 	if err != nil || target == nil {
332 332
 		if len(msg.Params[0]) > 0 {
333
-			client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, msg.Params[0], "No such nick")
333
+			client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, msg.Params[0], client.t("No such nick"))
334 334
 		}
335 335
 		return false
336 336
 	}
@@ -340,9 +340,9 @@ func umodeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
340 340
 
341 341
 	if !hasPrivs {
342 342
 		if len(msg.Params) > 1 {
343
-			client.Send(nil, server.name, ERR_USERSDONTMATCH, client.nick, "Can't change modes for other users")
343
+			client.Send(nil, server.name, ERR_USERSDONTMATCH, client.nick, client.t("Can't change modes for other users"))
344 344
 		} else {
345
-			client.Send(nil, server.name, ERR_USERSDONTMATCH, client.nick, "Can't view modes for other users")
345
+			client.Send(nil, server.name, ERR_USERSDONTMATCH, client.nick, client.t("Can't view modes for other users"))
346 346
 		}
347 347
 		return false
348 348
 	}
@@ -357,7 +357,7 @@ func umodeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
357 357
 
358 358
 		// alert for unknown mode changes
359 359
 		for char := range unknown {
360
-			client.Send(nil, server.name, ERR_UNKNOWNMODE, client.nick, string(char), "is an unknown mode character to me")
360
+			client.Send(nil, server.name, ERR_UNKNOWNMODE, client.nick, string(char), client.t("is an unknown mode character to me"))
361 361
 		}
362 362
 		if len(unknown) == 1 && len(changes) == 0 {
363 363
 			return false
@@ -374,7 +374,7 @@ func umodeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
374 374
 		if client.flags[LocalOperator] || client.flags[Operator] {
375 375
 			masks := server.snomasks.String(client)
376 376
 			if 0 < len(masks) {
377
-				client.Send(nil, target.nickMaskString, RPL_SNOMASKIS, targetNick, masks, "Server notice masks")
377
+				client.Send(nil, target.nickMaskString, RPL_SNOMASKIS, targetNick, masks, client.t("Server notice masks"))
378 378
 			}
379 379
 		}
380 380
 	}
@@ -521,7 +521,7 @@ func (channel *Channel) ApplyChannelModeChanges(client *Client, isSamode bool, c
521 521
 		if !hasPrivs(change) {
522 522
 			if !alreadySentPrivError {
523 523
 				alreadySentPrivError = true
524
-				client.Send(nil, client.server.name, ERR_CHANOPRIVSNEEDED, channel.name, "You're not a channel operator")
524
+				client.Send(nil, client.server.name, ERR_CHANOPRIVSNEEDED, channel.name, client.t("You're not a channel operator"))
525 525
 			}
526 526
 			continue
527 527
 		}
@@ -543,7 +543,7 @@ func (channel *Channel) ApplyChannelModeChanges(client *Client, isSamode bool, c
543 543
 			case Add:
544 544
 				if channel.lists[change.mode].Length() >= client.server.Limits().ChanListModes {
545 545
 					if !listFullWarned[change.mode] {
546
-						client.Send(nil, client.server.name, ERR_BANLISTFULL, client.Nick(), channel.Name(), change.mode.String(), "Channel list is full")
546
+						client.Send(nil, client.server.name, ERR_BANLISTFULL, client.Nick(), channel.Name(), change.mode.String(), client.t("Channel list is full"))
547 547
 						listFullWarned[change.mode] = true
548 548
 					}
549 549
 					continue
@@ -612,7 +612,7 @@ func cmodeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
612 612
 	channel := server.channels.Get(channelName)
613 613
 
614 614
 	if err != nil || channel == nil {
615
-		client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, msg.Params[0], "No such channel")
615
+		client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, msg.Params[0], client.t("No such channel"))
616 616
 		return false
617 617
 	}
618 618
 
@@ -626,7 +626,7 @@ func cmodeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
626 626
 
627 627
 		// alert for unknown mode changes
628 628
 		for char := range unknown {
629
-			client.Send(nil, server.name, ERR_UNKNOWNMODE, client.nick, string(char), "is an unknown mode character to me")
629
+			client.Send(nil, server.name, ERR_UNKNOWNMODE, client.nick, string(char), client.t("is an unknown mode character to me"))
630 630
 		}
631 631
 		if len(unknown) == 1 && len(changes) == 0 {
632 632
 			return false

+ 3
- 3
irc/monitor.go Visa fil

@@ -123,7 +123,7 @@ func monitorHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
123 123
 	handler, exists := metadataSubcommands[strings.ToLower(msg.Params[0])]
124 124
 
125 125
 	if !exists {
126
-		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.Nick(), "MONITOR", msg.Params[0], "Unknown subcommand")
126
+		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.Nick(), "MONITOR", msg.Params[0], client.t("Unknown subcommand"))
127 127
 		return false
128 128
 	}
129 129
 
@@ -132,7 +132,7 @@ func monitorHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
132 132
 
133 133
 func monitorRemoveHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
134 134
 	if len(msg.Params) < 2 {
135
-		client.Send(nil, server.name, ERR_NEEDMOREPARAMS, client.Nick(), msg.Command, "Not enough parameters")
135
+		client.Send(nil, server.name, ERR_NEEDMOREPARAMS, client.Nick(), msg.Command, client.t("Not enough parameters"))
136 136
 		return false
137 137
 	}
138 138
 
@@ -150,7 +150,7 @@ func monitorRemoveHandler(server *Server, client *Client, msg ircmsg.IrcMessage)
150 150
 
151 151
 func monitorAddHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
152 152
 	if len(msg.Params) < 2 {
153
-		client.Send(nil, server.name, ERR_NEEDMOREPARAMS, client.Nick(), msg.Command, "Not enough parameters")
153
+		client.Send(nil, server.name, ERR_NEEDMOREPARAMS, client.Nick(), msg.Command, client.t("Not enough parameters"))
154 154
 		return false
155 155
 	}
156 156
 

+ 5
- 5
irc/nickname.go Visa fil

@@ -36,12 +36,12 @@ func performNickChange(server *Server, client *Client, target *Client, newnick s
36 36
 	cfnick, err := CasefoldName(nickname)
37 37
 
38 38
 	if len(nickname) < 1 {
39
-		client.Send(nil, server.name, ERR_NONICKNAMEGIVEN, client.nick, "No nickname given")
39
+		client.Send(nil, server.name, ERR_NONICKNAMEGIVEN, client.nick, client.t("No nickname given"))
40 40
 		return false
41 41
 	}
42 42
 
43 43
 	if err != nil || len(nickname) > server.Limits().NickLen || restrictedNicknames[cfnick] {
44
-		client.Send(nil, server.name, ERR_ERRONEUSNICKNAME, client.nick, nickname, "Erroneous nickname")
44
+		client.Send(nil, server.name, ERR_ERRONEUSNICKNAME, client.nick, nickname, client.t("Erroneous nickname"))
45 45
 		return false
46 46
 	}
47 47
 
@@ -54,10 +54,10 @@ func performNickChange(server *Server, client *Client, target *Client, newnick s
54 54
 	origNickMask := target.NickMaskString()
55 55
 	err = client.server.clients.SetNick(target, nickname)
56 56
 	if err == ErrNicknameInUse {
57
-		client.Send(nil, server.name, ERR_NICKNAMEINUSE, client.nick, nickname, "Nickname is already in use")
57
+		client.Send(nil, server.name, ERR_NICKNAMEINUSE, client.nick, nickname, client.t("Nickname is already in use"))
58 58
 		return false
59 59
 	} else if err != nil {
60
-		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, "NICK", fmt.Sprintf("Could not set or change nickname: %s", err.Error()))
60
+		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, "NICK", fmt.Sprintf(client.t("Could not set or change nickname: %s"), err.Error()))
61 61
 		return false
62 62
 	}
63 63
 
@@ -83,7 +83,7 @@ func sanickHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
83 83
 	targetNick := strings.TrimSpace(msg.Params[0])
84 84
 	target := server.clients.Get(targetNick)
85 85
 	if target == nil {
86
-		client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, msg.Params[0], "No such nick")
86
+		client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, msg.Params[0], client.t("No such nick"))
87 87
 		return false
88 88
 	}
89 89
 	return performNickChange(server, client, target, msg.Params[1])

+ 1
- 1
irc/nickserv.go Visa fil

@@ -20,5 +20,5 @@ func (server *Server) nickservReceiveNotice(client *Client, message string) {
20 20
 }
21 21
 
22 22
 func (server *Server) nickservReceivePrivmsg(client *Client, message string) {
23
-	client.Notice("NickServ is not yet implemented, sorry! To register an account, check /HELPOP REG")
23
+	client.Notice(client.t("NickServ is not yet implemented, sorry! To register an account, check /HELPOP REG"))
24 24
 }

+ 7
- 7
irc/roleplay.go Visa fil

@@ -34,7 +34,7 @@ func npcHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
34 34
 
35 35
 	_, err := CasefoldName(fakeSource)
36 36
 	if err != nil {
37
-		client.Send(nil, client.server.name, ERR_CANNOTSENDRP, target, "Fake source must be a valid nickname")
37
+		client.Send(nil, client.server.name, ERR_CANNOTSENDRP, target, client.t("Fake source must be a valid nickname"))
38 38
 		return false
39 39
 	}
40 40
 
@@ -54,7 +54,7 @@ func npcaHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
54 54
 
55 55
 	_, err := CasefoldName(fakeSource)
56 56
 	if err != nil {
57
-		client.Send(nil, client.server.name, ERR_CANNOTSENDRP, target, "Fake source must be a valid nickname")
57
+		client.Send(nil, client.server.name, ERR_CANNOTSENDRP, target, client.t("Fake source must be a valid nickname"))
58 58
 		return false
59 59
 	}
60 60
 
@@ -74,17 +74,17 @@ func sendRoleplayMessage(server *Server, client *Client, source string, targetSt
74 74
 	if cerr == nil {
75 75
 		channel := server.channels.Get(target)
76 76
 		if channel == nil {
77
-			client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, targetString, "No such channel")
77
+			client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, targetString, client.t("No such channel"))
78 78
 			return
79 79
 		}
80 80
 
81 81
 		if !channel.CanSpeak(client) {
82
-			client.Send(nil, client.server.name, ERR_CANNOTSENDTOCHAN, channel.name, "Cannot send to channel")
82
+			client.Send(nil, client.server.name, ERR_CANNOTSENDTOCHAN, channel.name, client.t("Cannot send to channel"))
83 83
 			return
84 84
 		}
85 85
 
86 86
 		if !channel.flags[ChanRoleplaying] {
87
-			client.Send(nil, client.server.name, ERR_CANNOTSENDRP, channel.name, "Channel doesn't have roleplaying mode available")
87
+			client.Send(nil, client.server.name, ERR_CANNOTSENDRP, channel.name, client.t("Channel doesn't have roleplaying mode available"))
88 88
 			return
89 89
 		}
90 90
 
@@ -98,12 +98,12 @@ func sendRoleplayMessage(server *Server, client *Client, source string, targetSt
98 98
 		target, err := CasefoldName(targetString)
99 99
 		user := server.clients.Get(target)
100 100
 		if err != nil || user == nil {
101
-			client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, target, "No such nick")
101
+			client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, target, client.t("No such nick"))
102 102
 			return
103 103
 		}
104 104
 
105 105
 		if !user.flags[UserRoleplaying] {
106
-			client.Send(nil, client.server.name, ERR_CANNOTSENDRP, user.nick, "User doesn't have roleplaying mode enabled")
106
+			client.Send(nil, client.server.name, ERR_CANNOTSENDRP, user.nick, client.t("User doesn't have roleplaying mode enabled"))
107 107
 			return
108 108
 		}
109 109
 

+ 70
- 74
irc/server.go Visa fil

@@ -44,10 +44,6 @@ var (
44 44
 	RenamePrivsNeeded = errors.New("Only chanops can rename channels")
45 45
 )
46 46
 
47
-const (
48
-	rawIONotice = "This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect."
49
-)
50
-
51 47
 // Limits holds the maximum limits for various things such as topic lengths.
52 48
 type Limits struct {
53 49
 	AwayLen        int
@@ -423,7 +419,7 @@ func (server *Server) tryRegister(c *Client) {
423 419
 		if info.Time != nil {
424 420
 			reason += fmt.Sprintf(" [%s]", info.Time.Duration.String())
425 421
 		}
426
-		c.Quit(fmt.Sprintf("You are banned from this server (%s)", reason))
422
+		c.Quit(fmt.Sprintf(c.t("You are banned from this server (%s)"), reason))
427 423
 		c.destroy(false)
428 424
 		return
429 425
 	}
@@ -437,15 +433,15 @@ func (server *Server) tryRegister(c *Client) {
437 433
 	//NOTE(dan): we specifically use the NICK here instead of the nickmask
438 434
 	// see http://modern.ircdocs.horse/#rplwelcome-001 for details on why we avoid using the nickmask
439 435
 	c.Send(nil, server.name, RPL_WELCOME, c.nick, fmt.Sprintf(c.t("Welcome to the Internet Relay Network %s"), c.nick))
440
-	c.Send(nil, server.name, RPL_YOURHOST, c.nick, fmt.Sprintf("Your host is %s, running version %s", server.name, Ver))
441
-	c.Send(nil, server.name, RPL_CREATED, c.nick, fmt.Sprintf("This server was created %s", server.ctime.Format(time.RFC1123)))
436
+	c.Send(nil, server.name, RPL_YOURHOST, c.nick, fmt.Sprintf(c.t("Your host is %s, running version %s"), server.name, Ver))
437
+	c.Send(nil, server.name, RPL_CREATED, c.nick, fmt.Sprintf(c.t("This server was created %s"), server.ctime.Format(time.RFC1123)))
442 438
 	//TODO(dan): Look at adding last optional [<channel modes with a parameter>] parameter
443 439
 	c.Send(nil, server.name, RPL_MYINFO, c.nick, server.name, Ver, supportedUserModesString, supportedChannelModesString)
444 440
 	c.RplISupport()
445 441
 	server.MOTD(c)
446 442
 	c.Send(nil, c.nickMaskString, RPL_UMODEIS, c.nick, c.ModeString())
447 443
 	if server.logger.IsLoggingRawIO() {
448
-		c.Notice(rawIONotice)
444
+		c.Notice(c.t("This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect."))
449 445
 	}
450 446
 
451 447
 	// if resumed, send fake channel joins
@@ -500,15 +496,15 @@ func (server *Server) MOTD(client *Client) {
500 496
 	server.configurableStateMutex.RUnlock()
501 497
 
502 498
 	if len(motdLines) < 1 {
503
-		client.Send(nil, server.name, ERR_NOMOTD, client.nick, "MOTD File is missing")
499
+		client.Send(nil, server.name, ERR_NOMOTD, client.nick, client.t("MOTD File is missing"))
504 500
 		return
505 501
 	}
506 502
 
507
-	client.Send(nil, server.name, RPL_MOTDSTART, client.nick, fmt.Sprintf("- %s Message of the day - ", server.name))
503
+	client.Send(nil, server.name, RPL_MOTDSTART, client.nick, fmt.Sprintf(client.t("- %s Message of the day - "), server.name))
508 504
 	for _, line := range motdLines {
509 505
 		client.Send(nil, server.name, RPL_MOTD, client.nick, line)
510 506
 	}
511
-	client.Send(nil, server.name, RPL_ENDOFMOTD, client.nick, "End of MOTD command")
507
+	client.Send(nil, server.name, RPL_ENDOFMOTD, client.nick, client.t("End of MOTD command"))
512 508
 }
513 509
 
514 510
 //
@@ -518,7 +514,7 @@ func (server *Server) MOTD(client *Client) {
518 514
 // PASS <password>
519 515
 func passHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
520 516
 	if client.registered {
521
-		client.Send(nil, server.name, ERR_ALREADYREGISTRED, client.nick, "You may not reregister")
517
+		client.Send(nil, server.name, ERR_ALREADYREGISTRED, client.nick, client.t("You may not reregister"))
522 518
 		return false
523 519
 	}
524 520
 
@@ -531,8 +527,8 @@ func passHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
531 527
 	// check the provided password
532 528
 	password := []byte(msg.Params[0])
533 529
 	if passwd.ComparePassword(server.password, password) != nil {
534
-		client.Send(nil, server.name, ERR_PASSWDMISMATCH, client.nick, "Password incorrect")
535
-		client.Send(nil, server.name, "ERROR", "Password incorrect")
530
+		client.Send(nil, server.name, ERR_PASSWDMISMATCH, client.nick, client.t("Password incorrect"))
531
+		client.Send(nil, server.name, "ERROR", client.t("Password incorrect"))
536 532
 		return true
537 533
 	}
538 534
 
@@ -543,7 +539,7 @@ func passHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
543 539
 // USER <username> * 0 <realname>
544 540
 func userHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
545 541
 	if client.registered {
546
-		client.Send(nil, server.name, ERR_ALREADYREGISTRED, client.nick, "You may not reregister")
542
+		client.Send(nil, server.name, ERR_ALREADYREGISTRED, client.nick, client.t("You may not reregister"))
547 543
 		return false
548 544
 	}
549 545
 
@@ -560,7 +556,7 @@ func userHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
560 556
 	//
561 557
 	_, err := CasefoldName(msg.Params[0])
562 558
 	if err != nil {
563
-		client.Send(nil, "", "ERROR", "Malformed username")
559
+		client.Send(nil, "", "ERROR", client.t("Malformed username"))
564 560
 		return true
565 561
 	}
566 562
 
@@ -656,7 +652,7 @@ func renameHandler(server *Server, client *Client, msg ircmsg.IrcMessage) (resul
656 652
 	founder := channel.Founder()
657 653
 	if founder != "" && founder != client.AccountName() {
658 654
 		//TODO(dan): Change this to ERR_CANNOTRENAME
659
-		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, "RENAME", oldName, "Only channel founders can change registered channels")
655
+		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, "RENAME", oldName, client.t("Only channel founders can change registered channels"))
660 656
 		return false
661 657
 	}
662 658
 
@@ -675,7 +671,7 @@ func renameHandler(server *Server, client *Client, msg ircmsg.IrcMessage) (resul
675 671
 		if mcl.capabilities.Has(caps.Rename) {
676 672
 			mcl.Send(nil, client.nickMaskString, "RENAME", oldName, newName, reason)
677 673
 		} else {
678
-			mcl.Send(nil, mcl.nickMaskString, "PART", oldName, fmt.Sprintf("Channel renamed: %s", reason))
674
+			mcl.Send(nil, mcl.nickMaskString, "PART", oldName, fmt.Sprintf(mcl.t("Channel renamed: %s"), reason))
679 675
 			if mcl.capabilities.Has(caps.ExtendedJoin) {
680 676
 				accountName := "*"
681 677
 				if mcl.account != nil {
@@ -695,7 +691,7 @@ func renameHandler(server *Server, client *Client, msg ircmsg.IrcMessage) (resul
695 691
 func joinHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
696 692
 	// kill JOIN 0 requests
697 693
 	if msg.Params[0] == "0" {
698
-		client.Notice("JOIN 0 is not allowed")
694
+		client.Notice(client.t("JOIN 0 is not allowed"))
699 695
 		return false
700 696
 	}
701 697
 
@@ -713,7 +709,7 @@ func joinHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
713 709
 		}
714 710
 		err := server.channels.Join(client, name, key)
715 711
 		if err == NoSuchChannel {
716
-			client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.Nick(), name, "No such channel")
712
+			client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.Nick(), name, client.t("No such channel"))
717 713
 		}
718 714
 	}
719 715
 	return false
@@ -730,7 +726,7 @@ func partHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
730 726
 	for _, chname := range channels {
731 727
 		err := server.channels.Part(client, chname, reason)
732 728
 		if err == NoSuchChannel {
733
-			client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, chname, "No such channel")
729
+			client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, chname, client.t("No such channel"))
734 730
 		}
735 731
 	}
736 732
 	return false
@@ -742,7 +738,7 @@ func topicHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
742 738
 	channel := server.channels.Get(name)
743 739
 	if err != nil || channel == nil {
744 740
 		if len(msg.Params[0]) > 0 {
745
-			client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, msg.Params[0], "No such channel")
741
+			client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, msg.Params[0], client.t("No such channel"))
746 742
 		}
747 743
 		return false
748 744
 	}
@@ -844,11 +840,11 @@ func privmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
844 840
 		if err == nil {
845 841
 			channel := server.channels.Get(target)
846 842
 			if channel == nil {
847
-				client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, targetString, "No such channel")
843
+				client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, targetString, client.t("No such channel"))
848 844
 				continue
849 845
 			}
850 846
 			if !channel.CanSpeak(client) {
851
-				client.Send(nil, client.server.name, ERR_CANNOTSENDTOCHAN, channel.name, "Cannot send to channel")
847
+				client.Send(nil, client.server.name, ERR_CANNOTSENDTOCHAN, channel.name, client.t("Cannot send to channel"))
852 848
 				continue
853 849
 			}
854 850
 			msgid := server.generateMessageID()
@@ -917,11 +913,11 @@ func tagmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
917 913
 		if err == nil {
918 914
 			channel := server.channels.Get(target)
919 915
 			if channel == nil {
920
-				client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, targetString, "No such channel")
916
+				client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, targetString, client.t("No such channel"))
921 917
 				continue
922 918
 			}
923 919
 			if !channel.CanSpeak(client) {
924
-				client.Send(nil, client.server.name, ERR_CANNOTSENDTOCHAN, channel.name, "Cannot send to channel")
920
+				client.Send(nil, client.server.name, ERR_CANNOTSENDTOCHAN, channel.name, client.t("Cannot send to channel"))
925 921
 				continue
926 922
 			}
927 923
 			msgid := server.generateMessageID()
@@ -932,7 +928,7 @@ func tagmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
932 928
 			user := server.clients.Get(target)
933 929
 			if err != nil || user == nil {
934 930
 				if len(target) > 0 {
935
-					client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, target, "No such nick")
931
+					client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, target, client.t("No such nick"))
936 932
 				}
937 933
 				continue
938 934
 			}
@@ -982,7 +978,7 @@ func whoisHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
982 978
 	}
983 979
 
984 980
 	if len(strings.TrimSpace(masksString)) < 1 {
985
-		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, "No masks given")
981
+		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, msg.Command, client.t("No masks given"))
986 982
 		return false
987 983
 	}
988 984
 
@@ -991,12 +987,12 @@ func whoisHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
991 987
 		for _, mask := range masks {
992 988
 			casefoldedMask, err := Casefold(mask)
993 989
 			if err != nil {
994
-				client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, mask, "No such nick")
990
+				client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, mask, client.t("No such nick"))
995 991
 				continue
996 992
 			}
997 993
 			matches := server.clients.FindAll(casefoldedMask)
998 994
 			if len(matches) == 0 {
999
-				client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, mask, "No such nick")
995
+				client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, mask, client.t("No such nick"))
1000 996
 				continue
1001 997
 			}
1002 998
 			for mclient := range matches {
@@ -1008,13 +1004,13 @@ func whoisHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1008 1004
 		casefoldedMask, err := Casefold(strings.Split(masksString, ",")[0])
1009 1005
 		mclient := server.clients.Get(casefoldedMask)
1010 1006
 		if err != nil || mclient == nil {
1011
-			client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, masksString, "No such nick")
1007
+			client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, masksString, client.t("No such nick"))
1012 1008
 			// fall through, ENDOFWHOIS is always sent
1013 1009
 		} else {
1014 1010
 			client.getWhoisOf(mclient)
1015 1011
 		}
1016 1012
 	}
1017
-	client.Send(nil, server.name, RPL_ENDOFWHOIS, client.nick, masksString, "End of /WHOIS list")
1013
+	client.Send(nil, server.name, RPL_ENDOFWHOIS, client.nick, masksString, client.t("End of /WHOIS list"))
1018 1014
 	return false
1019 1015
 }
1020 1016
 
@@ -1032,17 +1028,17 @@ func (client *Client) getWhoisOf(target *Client) {
1032 1028
 		client.Send(nil, client.server.name, RPL_WHOISOPERATOR, client.nick, target.nick, target.whoisLine)
1033 1029
 	}
1034 1030
 	if client.flags[Operator] || client == target {
1035
-		client.Send(nil, client.server.name, RPL_WHOISACTUALLY, client.nick, target.nick, fmt.Sprintf("%s@%s", target.username, utils.LookupHostname(target.IPString())), target.IPString(), "Actual user@host, Actual IP")
1031
+		client.Send(nil, client.server.name, RPL_WHOISACTUALLY, client.nick, target.nick, fmt.Sprintf("%s@%s", target.username, utils.LookupHostname(target.IPString())), target.IPString(), client.t("Actual user@host, Actual IP"))
1036 1032
 	}
1037 1033
 	if target.flags[TLS] {
1038
-		client.Send(nil, client.server.name, RPL_WHOISSECURE, client.nick, target.nick, "is using a secure connection")
1034
+		client.Send(nil, client.server.name, RPL_WHOISSECURE, client.nick, target.nick, client.t("is using a secure connection"))
1039 1035
 	}
1040 1036
 	accountName := target.AccountName()
1041 1037
 	if accountName != "" {
1042
-		client.Send(nil, client.server.name, RPL_WHOISACCOUNT, client.nick, accountName, "is logged in as")
1038
+		client.Send(nil, client.server.name, RPL_WHOISACCOUNT, client.nick, accountName, client.t("is logged in as"))
1043 1039
 	}
1044 1040
 	if target.flags[Bot] {
1045
-		client.Send(nil, client.server.name, RPL_WHOISBOT, client.nick, target.nick, ircfmt.Unescape("is a $bBot$b on ")+client.server.networkName)
1041
+		client.Send(nil, client.server.name, RPL_WHOISBOT, client.nick, target.nick, ircfmt.Unescape(fmt.Sprintf(client.t("is a $bBot$b on %s"), client.server.networkName)))
1046 1042
 	}
1047 1043
 
1048 1044
 	if 0 < len(target.languages) {
@@ -1050,14 +1046,14 @@ func (client *Client) getWhoisOf(target *Client) {
1050 1046
 		for _, str := range client.server.languages.Codes(target.languages) {
1051 1047
 			params = append(params, str)
1052 1048
 		}
1053
-		params = append(params, "can speak these languages")
1049
+		params = append(params, client.t("can speak these languages"))
1054 1050
 		client.Send(nil, client.server.name, RPL_WHOISLANGUAGE, params...)
1055 1051
 	}
1056 1052
 
1057 1053
 	if target.certfp != "" && (client.flags[Operator] || client == target) {
1058
-		client.Send(nil, client.server.name, RPL_WHOISCERTFP, client.nick, target.nick, fmt.Sprintf("has client certificate fingerprint %s", target.certfp))
1054
+		client.Send(nil, client.server.name, RPL_WHOISCERTFP, client.nick, target.nick, fmt.Sprintf(client.t("has client certificate fingerprint %s"), target.certfp))
1059 1055
 	}
1060
-	client.Send(nil, client.server.name, RPL_WHOISIDLE, client.nick, target.nick, strconv.FormatUint(target.IdleSeconds(), 10), strconv.FormatInt(target.SignonTime(), 10), "seconds idle, signon time")
1056
+	client.Send(nil, client.server.name, RPL_WHOISIDLE, client.nick, target.nick, strconv.FormatUint(target.IdleSeconds(), 10), strconv.FormatInt(target.SignonTime(), 10), client.t("seconds idle, signon time"))
1061 1057
 }
1062 1058
 
1063 1059
 // rplWhoReply returns the WHO reply between one user and another channel/user.
@@ -1094,7 +1090,7 @@ func whoChannel(client *Client, channel *Channel, friends ClientSet) {
1094 1090
 // WHO [ <mask> [ "o" ] ]
1095 1091
 func whoHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1096 1092
 	if msg.Params[0] == "" {
1097
-		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, "WHO", "First param must be a mask or channel")
1093
+		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, "WHO", client.t("First param must be a mask or channel"))
1098 1094
 		return false
1099 1095
 	}
1100 1096
 
@@ -1102,7 +1098,7 @@ func whoHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1102 1098
 	if len(msg.Params) > 0 {
1103 1099
 		casefoldedMask, err := Casefold(msg.Params[0])
1104 1100
 		if err != nil {
1105
-			client.Send(nil, server.name, ERR_UNKNOWNERROR, "WHO", "Mask isn't valid")
1101
+			client.Send(nil, server.name, ERR_UNKNOWNERROR, "WHO", client.t("Mask isn't valid"))
1106 1102
 			return false
1107 1103
 		}
1108 1104
 		mask = casefoldedMask
@@ -1130,7 +1126,7 @@ func whoHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1130 1126
 		}
1131 1127
 	}
1132 1128
 
1133
-	client.Send(nil, server.name, RPL_ENDOFWHO, client.nick, mask, "End of WHO list")
1129
+	client.Send(nil, server.name, RPL_ENDOFWHO, client.nick, mask, client.t("End of WHO list"))
1134 1130
 	return false
1135 1131
 }
1136 1132
 
@@ -1138,11 +1134,11 @@ func whoHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1138 1134
 func operHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1139 1135
 	name, err := CasefoldName(msg.Params[0])
1140 1136
 	if err != nil {
1141
-		client.Send(nil, server.name, ERR_PASSWDMISMATCH, client.nick, "Password incorrect")
1137
+		client.Send(nil, server.name, ERR_PASSWDMISMATCH, client.nick, client.t("Password incorrect"))
1142 1138
 		return true
1143 1139
 	}
1144 1140
 	if client.flags[Operator] == true {
1145
-		client.Send(nil, server.name, ERR_UNKNOWNERROR, "OPER", "You're already opered-up!")
1141
+		client.Send(nil, server.name, ERR_UNKNOWNERROR, "OPER", client.t("You're already opered-up!"))
1146 1142
 		return false
1147 1143
 	}
1148 1144
 	server.configurableStateMutex.RLock()
@@ -1152,7 +1148,7 @@ func operHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1152 1148
 	password := []byte(msg.Params[1])
1153 1149
 	err = passwd.ComparePassword(oper.Pass, password)
1154 1150
 	if (oper.Pass == nil) || (err != nil) {
1155
-		client.Send(nil, server.name, ERR_PASSWDMISMATCH, client.nick, "Password incorrect")
1151
+		client.Send(nil, server.name, ERR_PASSWDMISMATCH, client.nick, client.t("Password incorrect"))
1156 1152
 		return true
1157 1153
 	}
1158 1154
 
@@ -1181,11 +1177,11 @@ func operHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1181 1177
 			for r := range unknownChanges {
1182 1178
 				runes += string(r)
1183 1179
 			}
1184
-			client.Notice(fmt.Sprintf("Could not apply mode changes: +%s", runes))
1180
+			client.Notice(fmt.Sprintf(client.t("Could not apply mode changes: +%s"), runes))
1185 1181
 		}
1186 1182
 	}
1187 1183
 
1188
-	client.Send(nil, server.name, RPL_YOUREOPER, client.nick, "You are now an IRC operator")
1184
+	client.Send(nil, server.name, RPL_YOUREOPER, client.nick, client.t("You are now an IRC operator"))
1189 1185
 
1190 1186
 	applied = append(applied, ModeChange{
1191 1187
 		mode: Operator,
@@ -1464,7 +1460,7 @@ func (server *Server) applyConfig(config *Config, initial bool) error {
1464 1460
 			}
1465 1461
 
1466 1462
 			if sendRawOutputNotice {
1467
-				sClient.Notice(rawIONotice)
1463
+				sClient.Notice(sClient.t("This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect."))
1468 1464
 			}
1469 1465
 		}
1470 1466
 	}
@@ -1626,7 +1622,7 @@ func rehashHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1626 1622
 	err := server.rehash()
1627 1623
 
1628 1624
 	if err == nil {
1629
-		client.Send(nil, server.name, RPL_REHASHING, client.nick, "ircd.yaml", "Rehashing")
1625
+		client.Send(nil, server.name, RPL_REHASHING, client.nick, "ircd.yaml", client.t("Rehashing"))
1630 1626
 	} else {
1631 1627
 		server.logger.Error("rehash", fmt.Sprintln("Failed to rehash:", err.Error()))
1632 1628
 		client.Send(nil, server.name, ERR_UNKNOWNERROR, client.nick, "REHASH", err.Error())
@@ -1657,10 +1653,10 @@ func awayHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1657 1653
 	var op ModeOp
1658 1654
 	if client.flags[Away] {
1659 1655
 		op = Add
1660
-		client.Send(nil, server.name, RPL_NOWAWAY, client.nick, "You have been marked as being away")
1656
+		client.Send(nil, server.name, RPL_NOWAWAY, client.nick, client.t("You have been marked as being away"))
1661 1657
 	} else {
1662 1658
 		op = Remove
1663
-		client.Send(nil, server.name, RPL_UNAWAY, client.nick, "You are no longer marked as being away")
1659
+		client.Send(nil, server.name, RPL_UNAWAY, client.nick, client.t("You are no longer marked as being away"))
1664 1660
 	}
1665 1661
 	//TODO(dan): Should this be sent automagically as part of setting the flag/mode?
1666 1662
 	modech := ModeChanges{ModeChange{
@@ -1784,7 +1780,7 @@ func kickHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1784 1780
 	channels := strings.Split(msg.Params[0], ",")
1785 1781
 	users := strings.Split(msg.Params[1], ",")
1786 1782
 	if (len(channels) != len(users)) && (len(users) != 1) {
1787
-		client.Send(nil, server.name, ERR_NEEDMOREPARAMS, client.nick, "KICK", "Not enough parameters")
1783
+		client.Send(nil, server.name, ERR_NEEDMOREPARAMS, client.nick, "KICK", client.t("Not enough parameters"))
1788 1784
 		return false
1789 1785
 	}
1790 1786
 
@@ -1807,14 +1803,14 @@ func kickHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1807 1803
 		casefoldedChname, err := CasefoldChannel(chname)
1808 1804
 		channel := server.channels.Get(casefoldedChname)
1809 1805
 		if err != nil || channel == nil {
1810
-			client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, chname, "No such channel")
1806
+			client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, chname, client.t("No such channel"))
1811 1807
 			continue
1812 1808
 		}
1813 1809
 
1814 1810
 		casefoldedNickname, err := CasefoldName(nickname)
1815 1811
 		target := server.clients.Get(casefoldedNickname)
1816 1812
 		if err != nil || target == nil {
1817
-			client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, nickname, "No such nick")
1813
+			client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, nickname, client.t("No such nick"))
1818 1814
 			continue
1819 1815
 		}
1820 1816
 
@@ -1912,7 +1908,7 @@ func listHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1912 1908
 			channel := server.channels.Get(casefoldedChname)
1913 1909
 			if err != nil || channel == nil || (!client.flags[Operator] && channel.flags[Secret]) {
1914 1910
 				if len(chname) > 0 {
1915
-					client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, chname, "No such channel")
1911
+					client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, chname, client.t("No such channel"))
1916 1912
 				}
1917 1913
 				continue
1918 1914
 			}
@@ -1921,7 +1917,7 @@ func listHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1921 1917
 			}
1922 1918
 		}
1923 1919
 	}
1924
-	client.Send(nil, server.name, RPL_LISTEND, client.nick, "End of LIST")
1920
+	client.Send(nil, server.name, RPL_LISTEND, client.nick, client.t("End of LIST"))
1925 1921
 	return false
1926 1922
 }
1927 1923
 
@@ -1970,7 +1966,7 @@ func namesHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1970 1966
 		channel := server.channels.Get(casefoldedChname)
1971 1967
 		if err != nil || channel == nil {
1972 1968
 			if len(chname) > 0 {
1973
-				client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, chname, "No such channel")
1969
+				client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, chname, client.t("No such channel"))
1974 1970
 			}
1975 1971
 			continue
1976 1972
 		}
@@ -1987,7 +1983,7 @@ func versionHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
1987 1983
 	}
1988 1984
 	casefoldedTarget, err := Casefold(target)
1989 1985
 	if target != "" && (err != nil || casefoldedTarget != server.nameCasefolded) {
1990
-		client.Send(nil, server.name, ERR_NOSUCHSERVER, client.nick, target, "No such server")
1986
+		client.Send(nil, server.name, ERR_NOSUCHSERVER, client.nick, target, client.t("No such server"))
1991 1987
 		return false
1992 1988
 	}
1993 1989
 
@@ -2004,14 +2000,14 @@ func inviteHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
2004 2000
 	casefoldedNickname, err := CasefoldName(nickname)
2005 2001
 	target := server.clients.Get(casefoldedNickname)
2006 2002
 	if err != nil || target == nil {
2007
-		client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, nickname, "No such nick")
2003
+		client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, nickname, client.t("No such nick"))
2008 2004
 		return false
2009 2005
 	}
2010 2006
 
2011 2007
 	casefoldedChannelName, err := CasefoldChannel(channelName)
2012 2008
 	channel := server.channels.Get(casefoldedChannelName)
2013 2009
 	if err != nil || channel == nil {
2014
-		client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, channelName, "No such channel")
2010
+		client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, channelName, client.t("No such channel"))
2015 2011
 		return false
2016 2012
 	}
2017 2013
 
@@ -2027,7 +2023,7 @@ func timeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
2027 2023
 	}
2028 2024
 	casefoldedTarget, err := Casefold(target)
2029 2025
 	if (target != "") && err != nil || (casefoldedTarget != server.nameCasefolded) {
2030
-		client.Send(nil, server.name, ERR_NOSUCHSERVER, client.nick, target, "No such server")
2026
+		client.Send(nil, server.name, ERR_NOSUCHSERVER, client.nick, target, client.t("No such server"))
2031 2027
 		return false
2032 2028
 	}
2033 2029
 	client.Send(nil, server.name, RPL_TIME, client.nick, server.name, time.Now().Format(time.RFC1123))
@@ -2045,7 +2041,7 @@ func killHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
2045 2041
 	casefoldedNickname, err := CasefoldName(nickname)
2046 2042
 	target := server.clients.Get(casefoldedNickname)
2047 2043
 	if err != nil || target == nil {
2048
-		client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, nickname, "No such nick")
2044
+		client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, nickname, client.t("No such nick"))
2049 2045
 		return false
2050 2046
 	}
2051 2047
 
@@ -2075,7 +2071,7 @@ func whowasHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
2075 2071
 		results := server.whoWas.Find(nickname, count)
2076 2072
 		if len(results) == 0 {
2077 2073
 			if len(nickname) > 0 {
2078
-				client.Send(nil, server.name, ERR_WASNOSUCHNICK, client.nick, nickname, "There was no such nickname")
2074
+				client.Send(nil, server.name, ERR_WASNOSUCHNICK, client.nick, nickname, client.t("There was no such nickname"))
2079 2075
 			}
2080 2076
 		} else {
2081 2077
 			for _, whoWas := range results {
@@ -2083,7 +2079,7 @@ func whowasHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
2083 2079
 			}
2084 2080
 		}
2085 2081
 		if len(nickname) > 0 {
2086
-			client.Send(nil, server.name, RPL_ENDOFWHOWAS, client.nick, nickname, "End of WHOWAS")
2082
+			client.Send(nil, server.name, RPL_ENDOFWHOWAS, client.nick, nickname, client.t("End of WHOWAS"))
2087 2083
 		}
2088 2084
 	}
2089 2085
 	return false
@@ -2103,10 +2099,10 @@ func lusersHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
2103 2099
 			opercount++
2104 2100
 		}
2105 2101
 	}
2106
-	client.Send(nil, server.name, RPL_LUSERCLIENT, client.nick, fmt.Sprintf("There are %d users and %d invisible on %d server(s)", totalcount, invisiblecount, 1))
2107
-	client.Send(nil, server.name, RPL_LUSEROP, client.nick, fmt.Sprintf("%d IRC Operators online", opercount))
2108
-	client.Send(nil, server.name, RPL_LUSERCHANNELS, client.nick, fmt.Sprintf("%d channels formed", server.channels.Len()))
2109
-	client.Send(nil, server.name, RPL_LUSERME, client.nick, fmt.Sprintf("I have %d clients and %d servers", totalcount, 1))
2102
+	client.Send(nil, server.name, RPL_LUSERCLIENT, client.nick, fmt.Sprintf(client.t("There are %d users and %d invisible on %d server(s)"), totalcount, invisiblecount, 1))
2103
+	client.Send(nil, server.name, RPL_LUSEROP, client.nick, fmt.Sprintf(client.t("%d IRC Operators online"), opercount))
2104
+	client.Send(nil, server.name, RPL_LUSERCHANNELS, client.nick, fmt.Sprintf(client.t("%d channels formed"), server.channels.Len()))
2105
+	client.Send(nil, server.name, RPL_LUSERME, client.nick, fmt.Sprintf(client.t("I have %d clients and %d servers"), totalcount, 1))
2110 2106
 	return false
2111 2107
 }
2112 2108
 
@@ -2122,12 +2118,12 @@ func resumeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
2122 2118
 	oldnick := msg.Params[0]
2123 2119
 
2124 2120
 	if strings.Contains(oldnick, " ") {
2125
-		client.Send(nil, server.name, ERR_CANNOT_RESUME, "*", "Cannot resume connection, old nickname contains spaces")
2121
+		client.Send(nil, server.name, ERR_CANNOT_RESUME, "*", client.t("Cannot resume connection, old nickname contains spaces"))
2126 2122
 		return false
2127 2123
 	}
2128 2124
 
2129 2125
 	if client.Registered() {
2130
-		client.Send(nil, server.name, ERR_CANNOT_RESUME, oldnick, "Cannot resume connection, connection registration has already been completed")
2126
+		client.Send(nil, server.name, ERR_CANNOT_RESUME, oldnick, client.t("Cannot resume connection, connection registration has already been completed"))
2131 2127
 		return false
2132 2128
 	}
2133 2129
 
@@ -2137,7 +2133,7 @@ func resumeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
2137 2133
 		if err == nil {
2138 2134
 			timestamp = &ts
2139 2135
 		} else {
2140
-			client.Send(nil, server.name, ERR_CANNOT_RESUME, oldnick, "Timestamp is not in 2006-01-02T15:04:05.999Z format, ignoring it")
2136
+			client.Send(nil, server.name, ERR_CANNOT_RESUME, oldnick, client.t("Timestamp is not in 2006-01-02T15:04:05.999Z format, ignoring it"))
2141 2137
 		}
2142 2138
 	}
2143 2139
 
@@ -2161,7 +2157,7 @@ func userhostHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
2161 2157
 		casefoldedNickname, err := CasefoldName(nickname)
2162 2158
 		target := server.clients.Get(casefoldedNickname)
2163 2159
 		if err != nil || target == nil {
2164
-			client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, nickname, "No such nick")
2160
+			client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, nickname, client.t("No such nick"))
2165 2161
 			return false
2166 2162
 		}
2167 2163
 		if returnedNicks[casefoldedNickname] {
@@ -2194,7 +2190,7 @@ func languageHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
2194 2190
 
2195 2191
 	supportedLanguagesCount := server.languages.Count()
2196 2192
 	if supportedLanguagesCount < len(msg.Params) {
2197
-		client.Send(nil, client.server.name, ERR_TOOMANYLANGUAGES, client.nick, strconv.Itoa(supportedLanguagesCount), "You specified too many languages")
2193
+		client.Send(nil, client.server.name, ERR_TOOMANYLANGUAGES, client.nick, strconv.Itoa(supportedLanguagesCount), client.t("You specified too many languages"))
2198 2194
 		return false
2199 2195
 	}
2200 2196
 
@@ -2210,7 +2206,7 @@ func languageHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
2210 2206
 
2211 2207
 		_, exists := server.languages.Info[value]
2212 2208
 		if !exists {
2213
-			client.Send(nil, client.server.name, ERR_NOLANGUAGE, client.nick, "Languages are not supported by this server")
2209
+			client.Send(nil, client.server.name, ERR_NOLANGUAGE, client.nick, client.t("Languages are not supported by this server"))
2214 2210
 			return false
2215 2211
 		}
2216 2212
 

Laddar…
Avbryt
Spara