|
@@ -41,8 +41,6 @@ func accHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Respo
|
41
|
41
|
return accRegisterHandler(server, client, msg, rb)
|
42
|
42
|
} else if subcommand == "verify" {
|
43
|
43
|
rb.Notice(client.t("VERIFY is not yet implemented"))
|
44
|
|
- } else if subcommand == "unregister" {
|
45
|
|
- return accUnregisterHandler(server, client, msg, rb)
|
46
|
44
|
} else {
|
47
|
45
|
rb.Add(nil, server.name, ERR_UNKNOWNERROR, client.nick, "ACC", msg.Params[0], client.t("Unknown subcommand"))
|
48
|
46
|
}
|
|
@@ -50,33 +48,6 @@ func accHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Respo
|
50
|
48
|
return false
|
51
|
49
|
}
|
52
|
50
|
|
53
|
|
-// ACC UNREGISTER <accountname>
|
54
|
|
-func accUnregisterHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
|
55
|
|
- // get and sanitise account name
|
56
|
|
- account := strings.TrimSpace(msg.Params[1])
|
57
|
|
- casefoldedAccount, err := CasefoldName(account)
|
58
|
|
- // probably don't need explicit check for "*" here... but let's do it anyway just to make sure
|
59
|
|
- if err != nil || msg.Params[1] == "*" {
|
60
|
|
- rb.Add(nil, server.name, ERR_REG_UNSPECIFIED_ERROR, client.nick, account, client.t("Account name is not valid"))
|
61
|
|
- return false
|
62
|
|
- }
|
63
|
|
-
|
64
|
|
- if !(account == client.Account() || client.HasRoleCapabs("unregister")) {
|
65
|
|
- rb.Add(nil, server.name, ERR_NOPRIVS, client.Nick(), account, client.t("Insufficient oper privs"))
|
66
|
|
- return false
|
67
|
|
- }
|
68
|
|
-
|
69
|
|
- err = server.accounts.Unregister(account)
|
70
|
|
- // TODO better responses all around here
|
71
|
|
- if err != nil {
|
72
|
|
- errorMsg := fmt.Sprintf("Unknown error while unregistering account %s", casefoldedAccount)
|
73
|
|
- rb.Add(nil, server.name, ERR_UNKNOWNERROR, client.Nick(), msg.Command, errorMsg)
|
74
|
|
- return false
|
75
|
|
- }
|
76
|
|
- rb.Notice(fmt.Sprintf("Successfully unregistered account %s", casefoldedAccount))
|
77
|
|
- return false
|
78
|
|
-}
|
79
|
|
-
|
80
|
51
|
// ACC REGISTER <accountname> [callback_namespace:]<callback> [cred_type] :<credential>
|
81
|
52
|
func accRegisterHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
|
82
|
53
|
// make sure reg is enabled
|