This commit is contained in:
Daniel Oaks 2018-02-04 21:32:48 +10:00
commit 3680a3fe9a
7 changed files with 275 additions and 56 deletions

View file

@ -12,7 +12,7 @@ import (
// Command represents a command accepted from a client.
type Command struct {
handler func(server *Server, client *Client, msg ircmsg.IrcMessage) bool
handler func(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool
oper bool
usablePreReg bool
leaveClientActive bool // if true, leaves the client active time alone. reversed because we can't default a struct element to True
@ -45,7 +45,12 @@ func (cmd *Command) Run(server *Server, client *Client, msg ircmsg.IrcMessage) b
if !cmd.leaveClientIdle {
client.Touch()
}
exiting := cmd.handler(server, client, msg)
rb := NewResponseBuffer(client)
rb.Label = GetLabel(msg)
exiting := cmd.handler(server, client, msg, rb)
rb.Send()
// after each command, see if we can send registration to the client
if !client.registered {