|
@@ -15,6 +15,7 @@ type Command struct {
|
15
|
15
|
leaveClientActive bool // if true, leaves the client active time alone. reversed because we can't default a struct element to True
|
16
|
16
|
leaveClientIdle bool
|
17
|
17
|
minParams int
|
|
18
|
+ capabs []string
|
18
|
19
|
}
|
19
|
20
|
|
20
|
21
|
// Run runs this command with the given client/message.
|
|
@@ -27,6 +28,10 @@ func (cmd *Command) Run(server *Server, client *Client, msg ircmsg.IrcMessage) b
|
27
|
28
|
client.Send(nil, server.name, ERR_NOPRIVILEGES, client.nick, "Permission Denied - You're not an IRC operator")
|
28
|
29
|
return false
|
29
|
30
|
}
|
|
31
|
+ if len(cmd.capabs) > 0 && !client.HasCapabs(cmd.capabs...) {
|
|
32
|
+ client.Send(nil, server.name, ERR_NOPRIVILEGES, client.nick, "Permission Denied")
|
|
33
|
+ return false
|
|
34
|
+ }
|
30
|
35
|
if len(msg.Params) < cmd.minParams {
|
31
|
36
|
client.Send(nil, server.name, ERR_NEEDMOREPARAMS, client.nick, msg.Command, "Not enough parameters")
|
32
|
37
|
return false
|
|
@@ -91,6 +96,7 @@ var Commands = map[string]Command{
|
91
|
96
|
handler: killHandler,
|
92
|
97
|
minParams: 1,
|
93
|
98
|
oper: true,
|
|
99
|
+ capabs: []string{"oper:local_kill"}, //TODO(dan): when we have S2S, this will be checked in the command handler itself
|
94
|
100
|
},
|
95
|
101
|
"LIST": {
|
96
|
102
|
handler: listHandler,
|
|
@@ -168,6 +174,7 @@ var Commands = map[string]Command{
|
168
|
174
|
handler: rehashHandler,
|
169
|
175
|
minParams: 0,
|
170
|
176
|
oper: true,
|
|
177
|
+ capabs: []string{"oper:rehash"},
|
171
|
178
|
},
|
172
|
179
|
"TIME": {
|
173
|
180
|
handler: timeHandler,
|