Added /VERSION command and set version to 1.0.0

This commit is contained in:
Harry Jeffery 2013-09-02 01:55:19 +01:00
parent f4deca40ea
commit 0d91cad155
4 changed files with 10 additions and 1 deletions

View File

@ -173,6 +173,8 @@ func (c *Client) reply(code replyCode, args ...string) {
c.outputChan <- fmt.Sprintf(":%s KICK %s %s %s", args[0], args[1], args[2], args[3])
case rplInfo:
c.outputChan <- fmt.Sprintf(":%s 371 %s :%s", c.server.name, c.nick, args[0])
case rplVersion:
c.outputChan <- fmt.Sprintf(":%s 351 %s %s", c.server.name, c.nick, args[0])
case errMoreArgs:
c.outputChan <- fmt.Sprintf(":%s 461 %s :Not enough params", c.server.name, c.nick)
case errNoNick:

View File

@ -20,7 +20,7 @@ func main() {
flag.Parse()
log.Printf("Rosella Initialising.")
log.Printf("Rosella v%s Initialising.", VERSION)
//Init rosella itself
server := NewServer()

View File

@ -2,6 +2,10 @@ package main
import "net"
const (
VERSION = "1.0.0"
)
type Server struct {
eventChan chan Event
running bool
@ -110,6 +114,7 @@ const (
rplChannelModeIs
rplKick
rplInfo
rplVersion
errMoreArgs
errNoNick
errInvalidNick

View File

@ -64,6 +64,8 @@ func (s *Server) handleEvent(e Event) {
switch {
case command == "INFO":
e.client.reply(rplInfo, "Rosella IRCD github.com/eXeC64/Rosella")
case command == "VERSION":
e.client.reply(rplVersion, VERSION)
case command == "NICK":
if len(args) < 1 {
e.client.reply(errNoNick)