Allow querying mask list modes with consistent syntax (non-strict)

This commit is contained in:
Les De Ridder 2020-10-15 17:26:52 +02:00
parent cd7613ed70
commit 3f5f1f9ada
1 changed files with 12 additions and 2 deletions

View File

@ -1105,12 +1105,22 @@ class Connection
} }
auto channel = channelRange[0]; auto channel = channelRange[0];
//NOTE: The RFCs are inconsistent on channel mode query syntax for mask list modes
// ('MODE #chan +b', but 'MODE #chan e' and 'MODE #chan I')
version (BasicFixes)
{
enum listQueryModes = ["+b", "+e", "+I", "e", "I"];
}
else
{
enum listQueryModes = ["+b", "e", "I"];
}
if (message.parameters.length == 1) if (message.parameters.length == 1)
{ {
channel.sendModes(this); channel.sendModes(this);
} }
//TODO: If RFC-strictness is off, also allow '+e' and '+I' (?) else if (message.parameters.length == 2 && listQueryModes.canFind(message.parameters[1]))
else if (message.parameters.length == 2 && ["+b", "e", "I"].canFind(message.parameters[1]))
{ {
auto listChar = message.parameters[1][$ - 1]; auto listChar = message.parameters[1][$ - 1];
final switch (listChar) final switch (listChar)