KILL command now accepts a reason

This commit is contained in:
Harry Jeffery 2013-08-29 21:20:34 +01:00
parent 7fa58ebac1
commit e0073e55fd
2 changed files with 4 additions and 2 deletions

View File

@ -156,7 +156,7 @@ func (c *Client) reply(code replyCode, args ...string) {
case rplNickChange: case rplNickChange:
c.outputChan <- fmt.Sprintf(":%s NICK %s", args[0], args[1]) c.outputChan <- fmt.Sprintf(":%s NICK %s", args[0], args[1])
case rplKill: case rplKill:
c.outputChan <- fmt.Sprintf(":%s KILL %s A %s", c.server.name, c.nick, args[0]) c.outputChan <- fmt.Sprintf(":%s KILL %s A %s", args[0], c.nick, args[1])
case rplMsg: case rplMsg:
c.outputChan <- fmt.Sprintf(":%s PRIVMSG %s %s", args[0], args[1], args[2]) c.outputChan <- fmt.Sprintf(":%s PRIVMSG %s %s", args[0], args[1], args[2])
case rplList: case rplList:

View File

@ -319,8 +319,10 @@ func (s *Server) handleEvent(e Event) {
nick := args[0] nick := args[0]
reason := strings.Join(args[1:], " ")
if client, exists := s.clientMap[strings.ToLower(nick)]; exists { if client, exists := s.clientMap[strings.ToLower(nick)]; exists {
client.reply(rplKill, "An operator has disconnected you.") client.reply(rplKill, e.client.nick, reason)
client.disconnect() client.disconnect()
} else { } else {
e.client.reply(errNoSuchNick, nick) e.client.reply(errNoSuchNick, nick)