|
@@ -12,13 +12,12 @@ import (
|
12
|
12
|
|
13
|
13
|
// Command represents a command accepted from a client.
|
14
|
14
|
type Command struct {
|
15
|
|
- handler func(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool
|
16
|
|
- oper bool
|
17
|
|
- usablePreReg bool
|
18
|
|
- leaveClientActive bool // if true, leaves the client active time alone. reversed because we can't default a struct element to True
|
19
|
|
- leaveClientIdle bool
|
20
|
|
- minParams int
|
21
|
|
- capabs []string
|
|
15
|
+ handler func(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool
|
|
16
|
+ oper bool
|
|
17
|
+ usablePreReg bool
|
|
18
|
+ leaveClientIdle bool // if true, leaves the client active time alone
|
|
19
|
+ minParams int
|
|
20
|
+ capabs []string
|
22
|
21
|
}
|
23
|
22
|
|
24
|
23
|
// Run runs this command with the given client/message.
|
|
@@ -54,11 +53,10 @@ func (cmd *Command) Run(server *Server, client *Client, msg ircmsg.IrcMessage) b
|
54
|
53
|
server.tryRegister(client)
|
55
|
54
|
}
|
56
|
55
|
|
57
|
|
- if !cmd.leaveClientIdle {
|
58
|
|
- client.Touch()
|
59
|
|
- }
|
|
56
|
+ // most servers do this only for PING/PONG, but we'll do it for any command:
|
|
57
|
+ client.idletimer.Touch()
|
60
|
58
|
|
61
|
|
- if !cmd.leaveClientActive {
|
|
59
|
+ if !cmd.leaveClientIdle {
|
62
|
60
|
client.Active()
|
63
|
61
|
}
|
64
|
62
|
|
|
@@ -118,8 +116,9 @@ func init() {
|
118
|
116
|
minParams: 2,
|
119
|
117
|
},
|
120
|
118
|
"ISON": {
|
121
|
|
- handler: isonHandler,
|
122
|
|
- minParams: 1,
|
|
119
|
+ handler: isonHandler,
|
|
120
|
+ minParams: 1,
|
|
121
|
+ leaveClientIdle: true,
|
123
|
122
|
},
|
124
|
123
|
"JOIN": {
|
125
|
124
|
handler: joinHandler,
|
|
@@ -200,16 +199,16 @@ func init() {
|
200
|
199
|
minParams: 1,
|
201
|
200
|
},
|
202
|
201
|
"PING": {
|
203
|
|
- handler: pingHandler,
|
204
|
|
- usablePreReg: true,
|
205
|
|
- minParams: 1,
|
206
|
|
- leaveClientActive: true,
|
|
202
|
+ handler: pingHandler,
|
|
203
|
+ usablePreReg: true,
|
|
204
|
+ minParams: 1,
|
|
205
|
+ leaveClientIdle: true,
|
207
|
206
|
},
|
208
|
207
|
"PONG": {
|
209
|
|
- handler: pongHandler,
|
210
|
|
- usablePreReg: true,
|
211
|
|
- minParams: 1,
|
212
|
|
- leaveClientActive: true,
|
|
208
|
+ handler: pongHandler,
|
|
209
|
+ usablePreReg: true,
|
|
210
|
+ minParams: 1,
|
|
211
|
+ leaveClientIdle: true,
|
213
|
212
|
},
|
214
|
213
|
"PRIVMSG": {
|
215
|
214
|
handler: privmsgHandler,
|