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;
|
break;
|
||||||
default:
|
default:
|
||||||
writeln("unknown command '", message.command, "'");
|
writeln("unknown command '", message.command, "'");
|
||||||
send(Message(_server.name, "421", [nick, "Unknown command"]));
|
send(Message(_server.name, "421", [nick, message.command, "Unknown command"]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,11 @@ struct Message
|
||||||
line = line[prefix.length + 1 .. $];
|
line = line[prefix.length + 1 .. $];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!line.canFind(' '))
|
||||||
|
{
|
||||||
|
return Message(prefix, line, [], false);
|
||||||
|
}
|
||||||
|
|
||||||
auto command = line[0 .. line.indexOf(' ')];
|
auto command = line[0 .. line.indexOf(' ')];
|
||||||
line = line[command.length + 1 .. $];
|
line = line[command.length + 1 .. $];
|
||||||
string[] params = [];
|
string[] params = [];
|
||||||
|
@ -60,6 +65,11 @@ struct Message
|
||||||
message = ":" ~ prefix ~ " ";
|
message = ":" ~ prefix ~ " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(parameters.length == 0)
|
||||||
|
{
|
||||||
|
return message ~ command;
|
||||||
|
}
|
||||||
|
|
||||||
message ~= command ~ " ";
|
message ~= command ~ " ";
|
||||||
if(parameters.length > 1)
|
if(parameters.length > 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -127,7 +127,7 @@ class Server
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
peer.send(Message(connection.mask, "QUIT"));
|
peer.send(Message(connection.mask, "QUIT", [connection.nick], true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue