forked from lesderid/salty-ircd
Fix parsing messages with no parameters
This commit is contained in:
parent
6c0f6aa72d
commit
c157a1e7a6
|
@ -120,7 +120,7 @@ class Connection
|
|||
break;
|
||||
default:
|
||||
writeln("unknown command '", message.command, "'");
|
||||
send(Message(_server.name, "421", [nick, "Unknown command"]));
|
||||
send(Message(_server.name, "421", [nick, message.command, "Unknown command"]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,11 @@ struct Message
|
|||
line = line[prefix.length + 1 .. $];
|
||||
}
|
||||
|
||||
if(!line.canFind(' '))
|
||||
{
|
||||
return Message(prefix, line, [], false);
|
||||
}
|
||||
|
||||
auto command = line[0 .. line.indexOf(' ')];
|
||||
line = line[command.length + 1 .. $];
|
||||
string[] params = [];
|
||||
|
@ -60,6 +65,11 @@ struct Message
|
|||
message = ":" ~ prefix ~ " ";
|
||||
}
|
||||
|
||||
if(parameters.length == 0)
|
||||
{
|
||||
return message ~ command;
|
||||
}
|
||||
|
||||
message ~= command ~ " ";
|
||||
if(parameters.length > 1)
|
||||
{
|
||||
|
|
|
@ -127,7 +127,7 @@ class Server
|
|||
}
|
||||
else
|
||||
{
|
||||
peer.send(Message(connection.mask, "QUIT"));
|
||||
peer.send(Message(connection.mask, "QUIT", [connection.nick], true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue