From ae2444c4237a46cac2841a01166eb51911f48201 Mon Sep 17 00:00:00 2001 From: Jeremy Latt Date: Sun, 9 Dec 2012 14:59:28 -0800 Subject: [PATCH] organization + docs --- src/irc/commands.go | 15 +-------------- src/irc/parse.go | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/irc/commands.go b/src/irc/commands.go index 0dbfe244..9eabc031 100644 --- a/src/irc/commands.go +++ b/src/irc/commands.go @@ -15,19 +15,6 @@ type Message interface { var ( ErrNotEnoughArgs = errors.New("not enough arguments") 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 @@ -302,7 +289,7 @@ func (m *PrivMsgMessage) Handle(s *Server, c *Client) { } } -// TOPIC +// TOPIC [newtopic] type TopicMessage struct { channel string diff --git a/src/irc/parse.go b/src/irc/parse.go index 15520bfa..131e0f56 100644 --- a/src/irc/parse.go +++ b/src/irc/parse.go @@ -8,7 +8,20 @@ import ( type ParseFunc func([]string) (Message, error) 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) {