Exemplo n.º 1
0
func init() {
	var c *irc.Command

	// Add login command.
	c = new(irc.Command)
	c.Name = "LOGIN"
	c.Handler = cmdLogin
	c.Minargs = 1
	c.Maxargs = 2
	c.Unregged = 1
	client.Commands.Add(c)

	// Add pass command, just an alias.
	c = new(irc.Command)
	c.Name = "PASS"
	c.Handler = cmdLogin
	c.Minargs = 1
	c.Maxargs = 2
	c.Unregged = 1
	client.Commands.Add(c)

	// Add identify command, just an alias.
	c = new(irc.Command)
	c.Name = "IDENTIFY"
	c.Handler = cmdLogin
	c.Minargs = 1
	c.Maxargs = 2
	c.Unregged = 1
	client.Commands.Add(c)
}
Exemplo n.º 2
0
// Add core user commands.
func init() {
	var c *irc.Command
	if Commands == nil {
		Commands = irc.NewCommandDispatcher()
	}

	c = new(irc.Command)
	c.Name = "USER"
	c.Handler = cmdUser
	c.Minargs = 4
	c.Maxargs = 4
	c.Unregged = 2
	Commands.Add(c)

	c = new(irc.Command)
	c.Name = "NICK"
	c.Handler = cmdNick
	c.Minargs = 1
	c.Maxargs = 1
	c.Unregged = 1
	Commands.Add(c)

	c = new(irc.Command)
	c.Name = "AWAY"
	c.Handler = cmdAway
	c.Maxargs = 1
	Commands.Add(c)

	c = new(irc.Command)
	c.Name = "QUIT"
	c.Handler = cmdQuit
	c.Maxargs = 1
	c.Unregged = 1
	Commands.Add(c)

	c = new(irc.Command)
	c.Name = "PING"
	c.Handler = cmdPing
	c.Minargs = 1
	c.Maxargs = 1
	Commands.Add(c)

	c = new(irc.Command)
	c.Name = "MODE"
	c.Handler = cmdMode
	c.Minargs = 1
	c.Maxargs = 3
	Commands.Add(c)

	c = new(irc.Command)
	c.Name = "PRIVMSG"
	c.Handler = cmdPrivmsg
	c.Minargs = 2
	c.Maxargs = 2
	Commands.Add(c)

	c = new(irc.Command)
	c.Name = "NOTICE"
	c.Handler = cmdNotice
	c.Minargs = 2
	c.Maxargs = 2
	Commands.Add(c)
}