organize server command into phases

This commit is contained in:
Jeremy Latt 2014-02-14 18:28:36 -08:00
parent 29df88fb7a
commit 4d9742d033
5 changed files with 132 additions and 68 deletions

View file

@ -18,6 +18,8 @@ type ModeOp rune
// user mode flags
type UserMode rune
type Phase uint
func (mode UserMode) String() string {
return fmt.Sprintf("%c", mode)
}
@ -125,15 +127,28 @@ type Reply interface {
Source() Identifier
}
// commands the server understands
// TODO rename ServerCommand
type Command interface {
Name() string
Client() *Client
Source() Identifier
Reply(Reply)
}
type ServerCommand interface {
Command
HandleServer(*Server)
}
type AuthServerCommand interface {
Command
HandleAuthServer(*Server)
}
type RegServerCommand interface {
Command
HandleRegServer(*Server)
}
type ChannelCommand interface {
Command
HandleChannel(channel *Channel)