Reply to PING commands with PONG

This commit is contained in:
Harry Jeffery 2013-10-21 13:34:12 +01:00
parent 860073fbf3
commit 6b011ef8c3
3 changed files with 5 additions and 0 deletions

View File

@ -186,6 +186,8 @@ func (c *Client) reply(code replyCode, args ...string) {
motd = motd[80:] motd = motd[80:]
} }
c.outputChan <- fmt.Sprintf(":%s 376 %s :End of MOTD Command", c.server.name, c.nick) c.outputChan <- fmt.Sprintf(":%s 376 %s :End of MOTD Command", c.server.name, c.nick)
case rplPong:
c.outputChan <- fmt.Sprintf(":%s PONG %s %s", c.server.name, c.nick, c.server.name)
case errMoreArgs: case errMoreArgs:
c.outputChan <- fmt.Sprintf(":%s 461 %s :Not enough params", c.server.name, c.nick) c.outputChan <- fmt.Sprintf(":%s 461 %s :Not enough params", c.server.name, c.nick)
case errNoNick: case errNoNick:

View File

@ -126,6 +126,7 @@ const (
rplInfo rplInfo
rplVersion rplVersion
rplMOTD rplMOTD
rplPong
errMoreArgs errMoreArgs
errNoNick errNoNick
errInvalidNick errInvalidNick

View File

@ -76,6 +76,8 @@ func (s *Server) handleEvent(e Event) {
func (s *Server) handleCommand(client *Client, command string, args []string) { func (s *Server) handleCommand(client *Client, command string, args []string) {
switch command { switch command {
case "PING":
client.reply(rplPong)
case "INFO": case "INFO":
client.reply(rplInfo, "Rosella IRCD github.com/eXeC64/Rosella") client.reply(rplInfo, "Rosella IRCD github.com/eXeC64/Rosella")
case "VERSION": case "VERSION":