1
0
Fork 0
forked from External/ergo

adding theater-mode, fixes #15

This commit is contained in:
Edmund Huber 2014-03-13 09:55:46 +01:00
parent a3df727c47
commit d5bdc78d55
10 changed files with 212 additions and 31 deletions

View file

@ -49,6 +49,7 @@ var (
PRIVMSG: NewPrivMsgCommand,
PROXY: NewProxyCommand,
QUIT: NewQuitCommand,
THEATER: NewTheaterCommand, // nonstandard
TIME: NewTimeCommand,
TOPIC: NewTopicCommand,
USER: NewUserCommand,
@ -947,6 +948,31 @@ func NewInviteCommand(args []string) (Command, error) {
}, nil
}
func NewTheaterCommand(args []string) (Command, error) {
if len(args) < 1 {
return nil, NotEnoughArgsError
} else if upperSubCmd := strings.ToUpper(args[0]); upperSubCmd == "IDENTIFY" && len(args) == 3 {
return &TheaterIdentifyCommand{
channel: NewName(args[1]),
PassCommand: PassCommand{password: []byte(args[2])},
}, nil
} else if upperSubCmd == "PRIVMSG" && len(args) == 4 {
return &TheaterPrivMsgCommand{
channel: NewName(args[1]),
asNick: NewName(args[2]),
message: NewText(args[3]),
}, nil
} else if upperSubCmd == "ACTION" && len(args) == 4 {
return &TheaterActionCommand{
channel: NewName(args[1]),
asNick: NewName(args[2]),
action: NewText(args[3]),
}, nil
} else {
return nil, ErrParseCommand
}
}
type TimeCommand struct {
BaseCommand
target Name