mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-13 07:29:30 +01:00
handle mode command with trailing empty arguments
This commit is contained in:
parent
66f9b42125
commit
39911a812d
@ -104,7 +104,6 @@ func parseLine(line string) (StringCode, []string) {
|
|||||||
parts = append(spacesExpr.Split(line, -1), lastArg)
|
parts = append(spacesExpr.Split(line, -1), lastArg)
|
||||||
} else {
|
} else {
|
||||||
parts = spacesExpr.Split(line, -1)
|
parts = spacesExpr.Split(line, -1)
|
||||||
|
|
||||||
}
|
}
|
||||||
return StringCode(strings.ToUpper(parts[0])), parts[1:]
|
return StringCode(strings.ToUpper(parts[0])), parts[1:]
|
||||||
}
|
}
|
||||||
@ -477,6 +476,9 @@ func NewUserModeCommand(args []string) (editableCommand, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, modeChange := range args[1:] {
|
for _, modeChange := range args[1:] {
|
||||||
|
if len(modeChange) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
op := ModeOp(modeChange[0])
|
op := ModeOp(modeChange[0])
|
||||||
if (op != Add) && (op != Remove) {
|
if (op != Add) && (op != Remove) {
|
||||||
return nil, ErrParseCommand
|
return nil, ErrParseCommand
|
||||||
@ -552,8 +554,12 @@ func NewChannelModeCommand(args []string) (editableCommand, error) {
|
|||||||
args = args[1:]
|
args = args[1:]
|
||||||
|
|
||||||
for len(args) > 0 {
|
for len(args) > 0 {
|
||||||
modeArg := args[0]
|
if len(args[0]) == 0 {
|
||||||
|
args = args[1:]
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
modeArg := args[0]
|
||||||
op := ModeOp(modeArg[0])
|
op := ModeOp(modeArg[0])
|
||||||
if (op == Add) || (op == Remove) {
|
if (op == Add) || (op == Remove) {
|
||||||
modeArg = modeArg[1:]
|
modeArg = modeArg[1:]
|
||||||
|
@ -23,7 +23,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SEM_VER = "ergonomadic-1.2.3"
|
SEM_VER = "ergonomadic-1.2.4"
|
||||||
CRLF = "\r\n"
|
CRLF = "\r\n"
|
||||||
MAX_REPLY_LEN = 512 - len(CRLF)
|
MAX_REPLY_LEN = 512 - len(CRLF)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user