Format code with dfmt
This commit is contained in:
parent
f70b9196c9
commit
be963dcf29
|
@ -170,7 +170,9 @@ class Connection
|
||||||
//NOTE: The RFCs don't specify whether commands are case-sensitive
|
//NOTE: The RFCs don't specify whether commands are case-sensitive
|
||||||
version (BasicFixes)
|
version (BasicFixes)
|
||||||
{
|
{
|
||||||
message.command = message.command.map!toUpper.to!string;
|
message.command = message.command
|
||||||
|
.map!toUpper
|
||||||
|
.to!string;
|
||||||
}
|
}
|
||||||
|
|
||||||
//NOTE: The RFCs don't specify what 'being idle' means
|
//NOTE: The RFCs don't specify what 'being idle' means
|
||||||
|
@ -1017,16 +1019,22 @@ class Connection
|
||||||
{
|
{
|
||||||
if (message.parameters.length > 1)
|
if (message.parameters.length > 1)
|
||||||
{
|
{
|
||||||
send(Message(_server.name, "502", [nick, "Cannot change mode for other users"], true));
|
send(Message(_server.name, "502", [
|
||||||
|
nick, "Cannot change mode for other users"
|
||||||
|
], true));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
send(Message(_server.name, "502", [nick, "Cannot view mode of other users"], true));
|
send(Message(_server.name, "502", [
|
||||||
|
nick, "Cannot view mode of other users"
|
||||||
|
], true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
send(Message(_server.name, "502", [nick, "Cannot change mode for other users"], true));
|
send(Message(_server.name, "502", [
|
||||||
|
nick, "Cannot change mode for other users"
|
||||||
|
], true));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1045,7 +1053,8 @@ class Connection
|
||||||
//NOTE: The RFCs don't specify what should happen on malformed mode operations
|
//NOTE: The RFCs don't specify what should happen on malformed mode operations
|
||||||
version (BasicFixes)
|
version (BasicFixes)
|
||||||
{
|
{
|
||||||
sendMalformedMessageError(message.command, "Invalid mode operation: " ~ modeString[0]);
|
sendMalformedMessageError(message.command,
|
||||||
|
"Invalid mode operation: " ~ modeString[0]);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1153,7 +1162,8 @@ class Connection
|
||||||
//NOTE: The RFCs don't specify what should happen on malformed mode operations
|
//NOTE: The RFCs don't specify what should happen on malformed mode operations
|
||||||
version (BasicFixes)
|
version (BasicFixes)
|
||||||
{
|
{
|
||||||
sendMalformedMessageError(message.command, "Invalid mode operation: " ~ modeString[0]);
|
sendMalformedMessageError(message.command,
|
||||||
|
"Invalid mode operation: " ~ modeString[0]);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1174,7 +1184,7 @@ class Connection
|
||||||
//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
|
||||||
|
|
||||||
case 'o':
|
case 'o':
|
||||||
case 'v':
|
case 'v':
|
||||||
if (i + 1 == message.parameters.length)
|
if (i + 1 == message.parameters.length)
|
||||||
{
|
{
|
||||||
break Lforeach;
|
break Lforeach;
|
||||||
|
@ -1226,7 +1236,8 @@ class Connection
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sendMalformedMessageError(message.command, "Invalid user mask: " ~ mask);
|
sendMalformedMessageError(message.command,
|
||||||
|
"Invalid user mask: " ~ mask);
|
||||||
break Lforeach;
|
break Lforeach;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1298,11 +1309,11 @@ class Connection
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
case 'm':
|
case 'm':
|
||||||
case 'n':
|
case 'n':
|
||||||
case 'p':
|
case 'p':
|
||||||
case 's':
|
case 's':
|
||||||
case 't':
|
case 't':
|
||||||
bool success;
|
bool success;
|
||||||
if (add)
|
if (add)
|
||||||
success = channel.setMode(mode);
|
success = channel.setMode(mode);
|
||||||
|
@ -1477,7 +1488,9 @@ class Connection
|
||||||
|
|
||||||
void sendMalformedMessageError(string command, string description)
|
void sendMalformedMessageError(string command, string description)
|
||||||
{
|
{
|
||||||
send(Message(_server.name, "ERROR", [command, "Malformed message: " ~ description], true));
|
send(Message(_server.name, "ERROR", [
|
||||||
|
command, "Malformed message: " ~ description
|
||||||
|
], true));
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendWelcome()
|
void sendWelcome()
|
||||||
|
@ -1487,17 +1500,20 @@ class Connection
|
||||||
enum availableUserModes = "aiwroOs";
|
enum availableUserModes = "aiwroOs";
|
||||||
enum availableChannelModes = "OovaimnqpsrtklbeI";
|
enum availableChannelModes = "OovaimnqpsrtklbeI";
|
||||||
|
|
||||||
send(Message(_server.name, "001", [nick,
|
send(Message(_server.name, "001", [
|
||||||
"Welcome", "to", "the", "Internet", "Relay", "Network", prefix
|
nick, "Welcome", "to", "the", "Internet", "Relay", "Network",
|
||||||
|
prefix
|
||||||
], false));
|
], false));
|
||||||
send(Message(_server.name, "002", [nick,
|
send(Message(_server.name, "002", [
|
||||||
"Your", "host", "is", _server.name ~ ",", "running", "version", _server.versionString
|
nick, "Your", "host", "is", _server.name ~ ",", "running",
|
||||||
|
"version", _server.versionString
|
||||||
], false));
|
], false));
|
||||||
send(Message(_server.name, "003", [nick,
|
send(Message(_server.name, "003", [
|
||||||
"This", "server", "was", "created", buildDate
|
nick, "This", "server", "was", "created", buildDate
|
||||||
], false));
|
], false));
|
||||||
send(Message(_server.name, "004", [nick,
|
send(Message(_server.name, "004", [
|
||||||
_server.name, _server.versionString, availableUserModes, availableChannelModes
|
nick, _server.name, _server.versionString,
|
||||||
|
availableUserModes, availableChannelModes
|
||||||
], false));
|
], false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -229,8 +229,8 @@ class Server
|
||||||
{
|
{
|
||||||
foreach (c; connections.filter!(c => c.visibleTo(origin))
|
foreach (c; connections.filter!(c => c.visibleTo(origin))
|
||||||
.filter!(c => !operatorsOnly || c.isOperator)
|
.filter!(c => !operatorsOnly || c.isOperator)
|
||||||
.filter!(c => [c.hostname, c.servername, c.realname, c.nick]
|
.filter!(c => [c.hostname, c.servername, c.realname,
|
||||||
.any!(n => wildcardMatch(n, mask))))
|
c.nick].any!(n => wildcardMatch(n, mask))))
|
||||||
{
|
{
|
||||||
//TODO: Don't leak secret/private channels if RFC-strictness is off (the RFCs don't seem to say anything about it?)
|
//TODO: Don't leak secret/private channels if RFC-strictness is off (the RFCs don't seem to say anything about it?)
|
||||||
auto channelName = c.channels.empty ? "*" : c.channels.array[0].name;
|
auto channelName = c.channels.empty ? "*" : c.channels.array[0].name;
|
||||||
|
|
|
@ -27,7 +27,9 @@ version (MaxNickLengthConfigurable) version = NotStrict;
|
||||||
|
|
||||||
version (NotStrict)
|
version (NotStrict)
|
||||||
{
|
{
|
||||||
version (SupportTLS) {}
|
version (SupportTLS)
|
||||||
|
{
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static assert(false, "TLS support must be enabled if any non-strict versions are enabled.");
|
static assert(false, "TLS support must be enabled if any non-strict versions are enabled.");
|
||||||
|
|
Loading…
Reference in New Issue