This commit is contained in:
Shivaram Lingamneni 2020-06-29 04:32:39 -04:00
parent a7107bfb67
commit 70f533ee07
4 changed files with 33 additions and 30 deletions

View file

@ -12,13 +12,12 @@ import (
// Command represents a command accepted from a client.
type Command struct {
handler func(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool
oper bool
usablePreReg bool
leaveClientIdle bool // if true, leaves the client active time alone
allowedInBatch bool // allowed in client-to-server batches
minParams int
capabs []string
handler func(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool
oper bool
usablePreReg bool
allowedInBatch bool // allowed in client-to-server batches
minParams int
capabs []string
}
// Run runs this command with the given client/message.
@ -67,7 +66,7 @@ func (cmd *Command) Run(server *Server, client *Client, session *Session, msg ir
// TODO: eliminate idletimer entirely in favor of this measurement
if client.registered {
client.Touch(!cmd.leaveClientIdle, session)
client.Touch(session)
}
return exiting
@ -159,9 +158,8 @@ func init() {
minParams: 2,
},
"ISON": {
handler: isonHandler,
minParams: 1,
leaveClientIdle: true,
handler: isonHandler,
minParams: 1,
},
"JOIN": {
handler: joinHandler,
@ -243,16 +241,14 @@ func init() {
minParams: 1,
},
"PING": {
handler: pingHandler,
usablePreReg: true,
minParams: 1,
leaveClientIdle: true,
handler: pingHandler,
usablePreReg: true,
minParams: 1,
},
"PONG": {
handler: pongHandler,
usablePreReg: true,
minParams: 1,
leaveClientIdle: true,
handler: pongHandler,
usablePreReg: true,
minParams: 1,
},
"PRIVMSG": {
handler: messageHandler,
@ -349,9 +345,8 @@ func init() {
minParams: 4,
},
"WHO": {
handler: whoHandler,
minParams: 1,
leaveClientIdle: true,
handler: whoHandler,
minParams: 1,
},
"WHOIS": {
handler: whoisHandler,