Added unknown command reply
This commit is contained in:
parent
ee6dcc8b37
commit
dcb3071126
@ -59,6 +59,7 @@ const (
|
|||||||
errNickInUse
|
errNickInUse
|
||||||
errAlreadyReg
|
errAlreadyReg
|
||||||
errNoSuchNick
|
errNoSuchNick
|
||||||
|
errUnknownCommand
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -235,7 +236,7 @@ func (s *Server) handleEvent(e Event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log.Printf("Unknown command: %q", command)
|
e.client.reply(errUnknownCommand, command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,7 +406,9 @@ func (c *Client) reply(code int, args ...string) {
|
|||||||
case errAlreadyReg:
|
case errAlreadyReg:
|
||||||
c.outputChan <- fmt.Sprintf(":%s 462 :You need a valid nick first", c.server.name)
|
c.outputChan <- fmt.Sprintf(":%s 462 :You need a valid nick first", c.server.name)
|
||||||
case errNoSuchNick:
|
case errNoSuchNick:
|
||||||
c.outputChan <- fmt.Sprintf("%s 401 :No such nick/channel", c.server.name)
|
c.outputChan <- fmt.Sprintf(":%s 401 :No such nick/channel", c.server.name)
|
||||||
|
case errUnknownCommand:
|
||||||
|
c.outputChan <- fmt.Sprintf(":%s 421 %s :Unknown command", c.server.name, args[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user