Fix some ban/exemption/invite semantics
This commit is contained in:
parent
3f5f1f9ada
commit
5bb99c2a8c
|
@ -356,6 +356,9 @@ class Channel
|
||||||
|
|
||||||
string nickPrefix(Connection member)
|
string nickPrefix(Connection member)
|
||||||
{
|
{
|
||||||
|
if (!members.canFind(member))
|
||||||
|
return null;
|
||||||
|
|
||||||
if (memberModes[member].canFind('o'))
|
if (memberModes[member].canFind('o'))
|
||||||
{
|
{
|
||||||
return "@";
|
return "@";
|
||||||
|
@ -389,7 +392,8 @@ class Channel
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (maskLists['b'].any!(m => connection.matchesMask(m))
|
else if (maskLists['b'].any!(m => connection.matchesMask(m))
|
||||||
&& !maskLists['e'].any!(m => connection.matchesMask(m)))
|
&& !maskLists['e'].any!(m => connection.matchesMask(m))
|
||||||
|
&& nickPrefix(connection).length == 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -366,8 +366,6 @@ class Connection
|
||||||
|
|
||||||
void onPass(Message message)
|
void onPass(Message message)
|
||||||
{
|
{
|
||||||
//TODO: Make sure PASS is sent before the NICK/USER combination
|
|
||||||
|
|
||||||
if (message.parameters.length < 1)
|
if (message.parameters.length < 1)
|
||||||
{
|
{
|
||||||
sendErrNeedMoreParams(message.command);
|
sendErrNeedMoreParams(message.command);
|
||||||
|
@ -456,7 +454,9 @@ class Connection
|
||||||
nick, channelName, "Cannot join channel (+i)"
|
nick, channelName, "Cannot join channel (+i)"
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
else if (channel.maskLists['b'].any!(m => matchesMask(m)))
|
else if (channel.maskLists['b'].any!(m => matchesMask(m))
|
||||||
|
&& !channel.maskLists['e'].any!(m => matchesMask(m))
|
||||||
|
&& !channel.inviteHolders.canFind(this))
|
||||||
{
|
{
|
||||||
send(Message(_server.name, "474", [
|
send(Message(_server.name, "474", [
|
||||||
nick, channelName, "Cannot join channel (+b)"
|
nick, channelName, "Cannot join channel (+b)"
|
||||||
|
@ -938,7 +938,6 @@ class Connection
|
||||||
|
|
||||||
if (channelList.length != 1 && channelList.length != userList.length)
|
if (channelList.length != 1 && channelList.length != userList.length)
|
||||||
{
|
{
|
||||||
//TODO: Figure out what the right error is here
|
|
||||||
sendErrNeedMoreParams(message.command);
|
sendErrNeedMoreParams(message.command);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1057,7 +1056,6 @@ class Connection
|
||||||
auto changedModes = modeString[1 .. $];
|
auto changedModes = modeString[1 .. $];
|
||||||
foreach (mode; changedModes)
|
foreach (mode; changedModes)
|
||||||
{
|
{
|
||||||
//TODO: If RFC-strictness is off, maybe send an error when trying to do an illegal change
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case 'i':
|
case 'i':
|
||||||
|
@ -1169,7 +1167,6 @@ class Connection
|
||||||
auto changedModes = modeString[1 .. $];
|
auto changedModes = modeString[1 .. $];
|
||||||
Lforeach: foreach (mode; changedModes)
|
Lforeach: foreach (mode; changedModes)
|
||||||
{
|
{
|
||||||
//when RFC-strictness is off, maybe send an error when trying to do an illegal change
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
//TODO: If RFC-strictness is on, limit mode changes with parameter to 3 per command
|
//TODO: If RFC-strictness is on, limit mode changes with parameter to 3 per command
|
||||||
|
@ -1178,7 +1175,6 @@ class Connection
|
||||||
case 'v':
|
case 'v':
|
||||||
if (i + 1 == message.parameters.length)
|
if (i + 1 == message.parameters.length)
|
||||||
{
|
{
|
||||||
//TODO: Figure out what to do when we need more mode parameters
|
|
||||||
break Lforeach;
|
break Lforeach;
|
||||||
}
|
}
|
||||||
auto memberNick = message.parameters[++i];
|
auto memberNick = message.parameters[++i];
|
||||||
|
@ -1209,11 +1205,10 @@ class Connection
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
case 'e': //TODO: Implement ban exceptions
|
case 'e':
|
||||||
case 'I': //TODO: Implement invite lists
|
case 'I':
|
||||||
if (i + 1 == message.parameters.length)
|
if (i + 1 == message.parameters.length)
|
||||||
{
|
{
|
||||||
//TODO: Figure out what to do when we need more mode parameters
|
|
||||||
break Lforeach;
|
break Lforeach;
|
||||||
}
|
}
|
||||||
auto mask = message.parameters[++i];
|
auto mask = message.parameters[++i];
|
||||||
|
@ -1253,7 +1248,6 @@ class Connection
|
||||||
case 'k':
|
case 'k':
|
||||||
if (i + 1 == message.parameters.length)
|
if (i + 1 == message.parameters.length)
|
||||||
{
|
{
|
||||||
//TODO: Figure out what to do when we need more mode parameters
|
|
||||||
break Lforeach;
|
break Lforeach;
|
||||||
}
|
}
|
||||||
auto key = message.parameters[++i];
|
auto key = message.parameters[++i];
|
||||||
|
@ -1274,7 +1268,6 @@ class Connection
|
||||||
{
|
{
|
||||||
if (i + 1 == message.parameters.length)
|
if (i + 1 == message.parameters.length)
|
||||||
{
|
{
|
||||||
//TODO: Figure out what to do when we need more mode parameters
|
|
||||||
break Lforeach;
|
break Lforeach;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1302,9 +1295,9 @@ class Connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'i': //TODO: Implement invite-only channels
|
case 'i':
|
||||||
case 'm': //TODO: Implement channel moderation
|
case 'm':
|
||||||
case 'n': //TODO: Implement the no messages from clients on the outside flag
|
case 'n':
|
||||||
case 'p':
|
case 'p':
|
||||||
case 's':
|
case 's':
|
||||||
case 't':
|
case 't':
|
||||||
|
|
Loading…
Reference in New Issue