Browse Source

don't send ACC numerics in response to NickServ commands

tags/v0.11.0-beta
Shivaram Lingamneni 6 years ago
parent
commit
df41f9b3b0
1 changed files with 7 additions and 3 deletions
  1. 7
    3
      irc/handlers.go

+ 7
- 3
irc/handlers.go View File

@@ -54,6 +54,7 @@ func accHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Respo
54 54
 	return false
55 55
 }
56 56
 
57
+// helper function to parse ACC callbacks, e.g., mailto:person@example.com, tel:16505551234
57 58
 func parseCallback(spec string, config *AccountConfig) (callbackNamespace string, callbackValue string) {
58 59
 	callback := strings.ToLower(spec)
59 60
 	if callback == "*" {
@@ -181,22 +182,25 @@ func accRegisterHandler(server *Server, client *Client, msg ircmsg.IrcMessage, r
181 182
 	return false
182 183
 }
183 184
 
185
+// helper function to dispatch messages when a client successfully registers
184 186
 func sendSuccessfulRegResponse(client *Client, rb *ResponseBuffer, forNS bool) {
185 187
 	if forNS {
186 188
 		rb.Notice(client.t("Account created"))
189
+	} else {
190
+		rb.Add(nil, client.server.name, RPL_REGISTRATION_SUCCESS, client.nick, client.AccountName(), client.t("Account created"))
187 191
 	}
188
-	rb.Add(nil, client.server.name, RPL_REGISTRATION_SUCCESS, client.nick, client.AccountName(), client.t("Account created"))
189 192
 	sendSuccessfulSaslAuth(client, rb, forNS)
190 193
 }
191 194
 
192 195
 // sendSuccessfulSaslAuth means that a SASL auth attempt completed successfully, and is used to dispatch messages.
193 196
 func sendSuccessfulSaslAuth(client *Client, rb *ResponseBuffer, forNS bool) {
194 197
 	account := client.AccountName()
195
-	rb.Add(nil, client.server.name, RPL_LOGGEDIN, client.nick, client.nickMaskString, account, fmt.Sprintf("You are now logged in as %s", account))
196
-	rb.Add(nil, client.server.name, RPL_SASLSUCCESS, client.nick, client.t("SASL authentication successful"))
197 198
 
198 199
 	if forNS {
199 200
 		rb.Notice(fmt.Sprintf(client.t("You're now logged in as %s"), client.AccountName()))
201
+	} else {
202
+		rb.Add(nil, client.server.name, RPL_LOGGEDIN, client.nick, client.nickMaskString, account, fmt.Sprintf("You are now logged in as %s", account))
203
+		rb.Add(nil, client.server.name, RPL_SASLSUCCESS, client.nick, client.t("SASL authentication successful"))
200 204
 	}
201 205
 
202 206
 	// dispatch account-notify

Loading…
Cancel
Save