Send error on invalid MODE operation (non-strict)
This commit is contained in:
parent
f6eece74bf
commit
a3f306b9ba
|
@ -1041,7 +1041,11 @@ class Connection
|
|||
auto add = modeString[0] == '+';
|
||||
if (!add && modeString[0] != '-')
|
||||
{
|
||||
//TODO: If RFC-strictness is off, send a malformed message error
|
||||
//NOTE: The RFCs don't specify what should happen on malformed mode operations
|
||||
version (BasicFixes)
|
||||
{
|
||||
sendMalformedMessageError(message.command, "Invalid mode operation: " ~ modeString[0]);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1053,7 +1057,7 @@ class Connection
|
|||
auto changedModes = modeString[1 .. $];
|
||||
foreach (mode; changedModes)
|
||||
{
|
||||
//when RFC-strictness is off, maybe send an error when trying to do an illegal change
|
||||
//TODO: If RFC-strictness is off, maybe send an error when trying to do an illegal change
|
||||
switch (mode)
|
||||
{
|
||||
case 'i':
|
||||
|
@ -1132,7 +1136,11 @@ class Connection
|
|||
auto add = modeString[0] == '+';
|
||||
if (!add && modeString[0] != '-')
|
||||
{
|
||||
//TODO: If RFC-strictness is off, send a malformed message error
|
||||
//NOTE: The RFCs don't specify what should happen on malformed mode operations
|
||||
version (BasicFixes)
|
||||
{
|
||||
sendMalformedMessageError(message.command, "Invalid mode operation: " ~ modeString[0]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1443,6 +1451,11 @@ class Connection
|
|||
], true));
|
||||
}
|
||||
|
||||
void sendMalformedMessageError(string command, string description)
|
||||
{
|
||||
send(Message(_server.name, "ERROR", [command, "Malformed message: " ~ description], true));
|
||||
}
|
||||
|
||||
void sendWelcome()
|
||||
{
|
||||
send(Message(_server.name, "001", [
|
||||
|
|
Loading…
Reference in New Issue