registration: Move REG CREATE to its' own function

This commit is contained in:
Daniel Oaks 2016-09-04 21:42:19 +10:00
parent 6e9722dee5
commit d3d88cfa0c
1 changed files with 108 additions and 102 deletions

View File

@ -50,6 +50,18 @@ func regHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
subcommand := strings.ToLower(msg.Params[0])
if subcommand == "create" {
return regCreateHandler(server, client, msg)
} else if subcommand == "verify" {
client.Notice("Parsing VERIFY")
} else {
client.Send(nil, server.nameString, ERR_UNKNOWNERROR, client.nickString, "REG", msg.Params[0], "Unknown subcommand")
}
return false
}
// regCreateHandler parses the REG CREATE command.
func regCreateHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
client.Notice("Parsing CREATE")
// get and sanitise account name
@ -152,11 +164,5 @@ func regHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
client.Notice(fmt.Sprintf("We should dispatch an actual callback here to %s:%s", callbackNamespace, callbackValue))
client.Notice(fmt.Sprintf("Primary account credential is with %s:%s", credentialType, credentialValue))
} else if subcommand == "verify" {
client.Notice("Parsing VERIFY")
} else {
client.Send(nil, server.nameString, ERR_UNKNOWNERROR, client.nickString, "REG", msg.Params[0], "Unknown subcommand")
}
return false
}