Ignore JOIN if user is already on channel
This commit is contained in:
parent
f80070aa92
commit
786a3f17e8
|
@ -389,4 +389,9 @@ class Channel
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasMember(Connection connection)
|
||||||
|
{
|
||||||
|
return members.canFind(connection);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -398,7 +398,6 @@ class Connection
|
||||||
auto channelList = message.parameters[0].split(',');
|
auto channelList = message.parameters[0].split(',');
|
||||||
foreach (channelName; channelList)
|
foreach (channelName; channelList)
|
||||||
{
|
{
|
||||||
//TODO: Check if the user isn't already on the channel
|
|
||||||
if (!Server.isValidChannelName(channelName))
|
if (!Server.isValidChannelName(channelName))
|
||||||
{
|
{
|
||||||
sendErrNoSuchChannel(channelName);
|
sendErrNoSuchChannel(channelName);
|
||||||
|
@ -413,6 +412,15 @@ class Connection
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto channel = channelRange[0];
|
auto channel = channelRange[0];
|
||||||
|
|
||||||
|
if (channel.hasMember(this))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: Implement channel limit
|
||||||
|
//TODO: Implement channel key
|
||||||
|
|
||||||
if (channel.maskLists['b'].any!(m => matchesMask(m)))
|
if (channel.maskLists['b'].any!(m => matchesMask(m)))
|
||||||
{
|
{
|
||||||
send(Message(_server.name, "474", [
|
send(Message(_server.name, "474", [
|
||||||
|
@ -427,9 +435,7 @@ class Connection
|
||||||
nick, channelName, "Cannot join channel (+i)"
|
nick, channelName, "Cannot join channel (+i)"
|
||||||
], true));
|
], true));
|
||||||
}
|
}
|
||||||
//TODO: Implement channel limit
|
else
|
||||||
//TODO: Implement channel key
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
_server.join(this, channelName);
|
_server.join(this, channelName);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue