3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

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

View File

@ -50,6 +50,18 @@ func regHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
subcommand := strings.ToLower(msg.Params[0]) subcommand := strings.ToLower(msg.Params[0])
if subcommand == "create" { 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") client.Notice("Parsing CREATE")
// get and sanitise account name // 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("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)) 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 return false
} }