コード例 #1
0
ファイル: infocmds.go プロジェクト: jbeshir/OddComm
func init() {
	var c *irc.Command
	if Commands == nil {
		Commands = irc.NewCommandDispatcher()
	}

	c = new(irc.Command)
	c.Name = "VERSION"
	c.Handler = cmdVersion
	Commands.Add(c)

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

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

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

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

	c = new(irc.Command)
	c.Name = "TIME"
	c.Handler = cmdTime
	Commands.Add(c)

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

	c = new(irc.Command)
	c.Name = "OPERFLAGS"
	c.Handler = cmdOperflags
	c.Minargs = 1
	c.Maxargs = 1
	c.OperFlag = "viewflags"
	Commands.Add(c)
}
コード例 #2
0
ファイル: opercmds.go プロジェクト: jbeshir/OddComm
// Add core oper commands.
func init() {
	var c *irc.Command
	if Commands == nil {
		Commands = irc.NewCommandDispatcher()
	}

	c = new(irc.Command)
	c.Name = "KILL"
	c.Handler = cmdKill
	c.Minargs = 2
	c.Maxargs = 2
	c.OperFlag = "ban"
	Commands.Add(c)

	c = new(irc.Command)
	c.Name = "DIE"
	c.Handler = cmdDie
	c.OperFlag = "shutdown"
	Commands.Add(c)
}
コード例 #3
0
ファイル: main.go プロジェクト: jbeshir/OddComm
import "oddcomm/lib/irc"
import "oddcomm/src/core"

var me string = "ts6"

// An ordering is defined on mutexes in this package; only one server mutex may be held
// at once, and if the server list mutex is also held, it must be locked after the
// specific server mutex. This prevents deadlocks.

// Points to the first server.
var servers *server
var serverMutex sync.Mutex

// Commands added here will be called with either a server or a core.User.
var commands = irc.NewCommandDispatcher()

// Create a channel for sending messages to the subsystem's goroutine.
var subsysMsg chan string = make(chan string)

// Start starts up the TS6 subsystem.
func Start() (msg chan string, exit chan int) {
	msg = subsysMsg
	exit = make(chan int)

	go ts6_main(msg, exit)

	return
}

func ts6_main(msg chan string, exit chan int) {
コード例 #4
0
ファイル: usercmds.go プロジェクト: jbeshir/OddComm
// 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)
}