mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
organization + docs
This commit is contained in:
parent
d7d6263e35
commit
ae2444c423
@ -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
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user