3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 18:52:41 +01:00

handle mode command with trailing empty arguments

This commit is contained in:
Jeremy Latt 2014-02-26 12:08:01 -08:00
parent 66f9b42125
commit 39911a812d
2 changed files with 9 additions and 3 deletions

View File

@ -104,7 +104,6 @@ func parseLine(line string) (StringCode, []string) {
parts = append(spacesExpr.Split(line, -1), lastArg)
} else {
parts = spacesExpr.Split(line, -1)
}
return StringCode(strings.ToUpper(parts[0])), parts[1:]
}
@ -477,6 +476,9 @@ func NewUserModeCommand(args []string) (editableCommand, error) {
}
for _, modeChange := range args[1:] {
if len(modeChange) == 0 {
continue
}
op := ModeOp(modeChange[0])
if (op != Add) && (op != Remove) {
return nil, ErrParseCommand
@ -552,8 +554,12 @@ func NewChannelModeCommand(args []string) (editableCommand, error) {
args = args[1:]
for len(args) > 0 {
modeArg := args[0]
if len(args[0]) == 0 {
args = args[1:]
continue
}
modeArg := args[0]
op := ModeOp(modeArg[0])
if (op == Add) || (op == Remove) {
modeArg = modeArg[1:]

View File

@ -23,7 +23,7 @@ var (
)
const (
SEM_VER = "ergonomadic-1.2.3"
SEM_VER = "ergonomadic-1.2.4"
CRLF = "\r\n"
MAX_REPLY_LEN = 512 - len(CRLF)