3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-14 07:59:31 +01:00

organization + docs

This commit is contained in:
Jeremy Latt 2012-12-09 14:59:28 -08:00
parent d7d6263e35
commit ae2444c423
2 changed files with 15 additions and 15 deletions

View File

@ -15,19 +15,6 @@ type Message interface {
var ( var (
ErrNotEnoughArgs = errors.New("not enough arguments") ErrNotEnoughArgs = errors.New("not enough arguments")
ErrUModeUnknownFlag = errors.New("unknown umode flag") ErrUModeUnknownFlag = errors.New("unknown umode flag")
parseCommandFuncs = map[string]ParseFunc{
"INVITE": NewInviteMessage,
"JOIN": NewJoinMessage,
"MODE": NewModeMessage,
"NICK": NewNickMessage,
"PART": NewPartMessage,
"PING": NewPingMessage,
"PONG": NewPongMessage,
"PRIVMSG": NewPrivMsgMessage,
"QUIT": NewQuitMessage,
"TOPIC": NewTopicMessage,
"USER": NewUserMessage,
}
) )
// unknown // unknown
@ -302,7 +289,7 @@ func (m *PrivMsgMessage) Handle(s *Server, c *Client) {
} }
} }
// TOPIC // TOPIC [newtopic]
type TopicMessage struct { type TopicMessage struct {
channel string channel string

View File

@ -8,7 +8,20 @@ import (
type ParseFunc func([]string) (Message, error) type ParseFunc func([]string) (Message, error)
var ( var (
ErrParseMessage = errors.New("failed to parse message") ErrParseMessage = errors.New("failed to parse message")
parseCommandFuncs = map[string]ParseFunc{
"INVITE": NewInviteMessage,
"JOIN": NewJoinMessage,
"MODE": NewModeMessage,
"NICK": NewNickMessage,
"PART": NewPartMessage,
"PING": NewPingMessage,
"PONG": NewPongMessage,
"PRIVMSG": NewPrivMsgMessage,
"QUIT": NewQuitMessage,
"TOPIC": NewTopicMessage,
"USER": NewUserMessage,
}
) )
func ParseMessage(line string) (msg Message, err error) { func ParseMessage(line string) (msg Message, err error) {