forked from lesderid/salty-ircd
Rename Connection.mask to Connection.prefix
This commit is contained in:
parent
e507a38e0d
commit
7df8c916b7
|
@ -45,11 +45,11 @@ class Channel
|
|||
{
|
||||
if(partMessage !is null)
|
||||
{
|
||||
member.send(Message(connection.mask, "PART", [name, partMessage], true));
|
||||
member.send(Message(connection.prefix, "PART", [name, partMessage], true));
|
||||
}
|
||||
else
|
||||
{
|
||||
member.send(Message(connection.mask, "PART", [name]));
|
||||
member.send(Message(connection.prefix, "PART", [name]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ class Channel
|
|||
{
|
||||
foreach(member; members.filter!(m => m.nick != sender.nick))
|
||||
{
|
||||
member.send(Message(sender.mask, "PRIVMSG", [name, text], true));
|
||||
member.send(Message(sender.prefix, "PRIVMSG", [name, text], true));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ class Channel
|
|||
{
|
||||
foreach(member; members.filter!(m => m.nick != sender.nick))
|
||||
{
|
||||
member.send(Message(sender.mask, "NOTICE", [name, text], true));
|
||||
member.send(Message(sender.prefix, "NOTICE", [name, text], true));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ class Channel
|
|||
|
||||
foreach(member; members)
|
||||
{
|
||||
member.send(Message(connection.mask, "TOPIC", [name, newTopic], true));
|
||||
member.send(Message(connection.prefix, "TOPIC", [name, newTopic], true));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ class Channel
|
|||
{
|
||||
foreach(member; members)
|
||||
{
|
||||
member.send(Message(kicker.mask, "KICK", [name, user.nick, comment], true));
|
||||
member.send(Message(kicker.prefix, "KICK", [name, user.nick, comment], true));
|
||||
}
|
||||
|
||||
members = members.remove!(m => m == user);
|
||||
|
|
|
@ -22,7 +22,6 @@ class Connection
|
|||
private TCPConnection _connection;
|
||||
private Server _server;
|
||||
|
||||
//TODO: Make into auto-properties (via template)
|
||||
string nick;
|
||||
string user;
|
||||
string realname;
|
||||
|
@ -37,7 +36,7 @@ class Connection
|
|||
|
||||
@property auto channels() { return _server.channels.filter!(c => c.members.canFind(this)); }
|
||||
|
||||
@property string mask() { return nick ~ "!" ~ user ~ "@" ~ hostname; }
|
||||
@property string prefix() { return nick ~ "!" ~ user ~ "@" ~ hostname; }
|
||||
@property bool registered() { return nick !is null && user !is null; }
|
||||
@property bool isOperator() { return modes.canFind('o') || modes.canFind('O'); }
|
||||
@property string servername() { return _server.name; } //TODO: Support server linking
|
||||
|
@ -933,6 +932,8 @@ Lforeach:
|
|||
//when RFC-strictness is off, maybe send an error when trying to do an illegal change
|
||||
switch(mode)
|
||||
{
|
||||
//TODO: When RFC-strictness is on, limit mode changes with parameter to 3 per command
|
||||
|
||||
case 'o':
|
||||
case 'v':
|
||||
if(i + 1 == message.parameters.length)
|
||||
|
@ -989,7 +990,7 @@ Lforeach:
|
|||
{
|
||||
foreach(member; channel.members)
|
||||
{
|
||||
member.send(Message(mask, "MODE", [channel.name, (add ? '+' : '-') ~ processedModes.idup] ~ processedParameters, false));
|
||||
member.send(Message(prefix, "MODE", [channel.name, (add ? '+' : '-') ~ processedModes.idup] ~ processedParameters, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1083,7 +1084,7 @@ Lforeach:
|
|||
|
||||
void sendWelcome()
|
||||
{
|
||||
send(Message(_server.name, "001", [nick, "Welcome to the Internet Relay Network " ~ mask], true));
|
||||
send(Message(_server.name, "001", [nick, "Welcome to the Internet Relay Network " ~ prefix], true));
|
||||
send(Message(_server.name, "002", [nick, "Your host is " ~ _server.name ~ ", running version " ~ _server.versionString], true));
|
||||
send(Message(_server.name, "003", [nick, "This server was created " ~ _server.creationDate], true));
|
||||
send(Message(_server.name, "004", [nick, _server.name, _server.versionString, "w", "snt"]));
|
||||
|
|
|
@ -141,7 +141,7 @@ class Server
|
|||
|
||||
foreach(member; channel.members)
|
||||
{
|
||||
member.send(Message(connection.mask, "JOIN", [channelName]));
|
||||
member.send(Message(connection.prefix, "JOIN", [channelName]));
|
||||
}
|
||||
|
||||
channel.sendNames(connection);
|
||||
|
@ -182,11 +182,11 @@ class Server
|
|||
{
|
||||
if(quitMessage !is null)
|
||||
{
|
||||
peer.send(Message(connection.mask, "QUIT", [quitMessage], true));
|
||||
peer.send(Message(connection.prefix, "QUIT", [quitMessage], true));
|
||||
}
|
||||
else
|
||||
{
|
||||
peer.send(Message(connection.mask, "QUIT", [connection.nick], true));
|
||||
peer.send(Message(connection.prefix, "QUIT", [connection.nick], true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ class Server
|
|||
void privmsgToUser(Connection sender, string target, string text)
|
||||
{
|
||||
auto user = findConnectionByNick(target)[0];
|
||||
user.send(Message(sender.mask, "PRIVMSG", [target, text], true));
|
||||
user.send(Message(sender.prefix, "PRIVMSG", [target, text], true));
|
||||
}
|
||||
|
||||
void noticeToChannel(Connection sender, string target, string text)
|
||||
|
@ -238,7 +238,7 @@ class Server
|
|||
void noticeToUser(Connection sender, string target, string text)
|
||||
{
|
||||
auto user = findConnectionByNick(target)[0];
|
||||
user.send(Message(sender.mask, "NOTICE", [target, text], true));
|
||||
user.send(Message(sender.prefix, "NOTICE", [target, text], true));
|
||||
}
|
||||
|
||||
void sendChannelTopic(Connection origin, string channelName)
|
||||
|
@ -307,7 +307,7 @@ class Server
|
|||
void invite(Connection inviter, string target, string channelName)
|
||||
{
|
||||
auto user = findConnectionByNick(target)[0];
|
||||
user.send(Message(inviter.mask, "INVITE", [user.nick, channelName]));
|
||||
user.send(Message(inviter.prefix, "INVITE", [user.nick, channelName]));
|
||||
}
|
||||
|
||||
void sendMotd(Connection connection)
|
||||
|
@ -375,7 +375,7 @@ class Server
|
|||
{
|
||||
auto user = findConnectionByNick(nick)[0];
|
||||
|
||||
user.send(Message(killer.mask, "KILL", [nick, comment], true));
|
||||
user.send(Message(killer.prefix, "KILL", [nick, comment], true));
|
||||
|
||||
//TODO: Find out if any RFC specifies a QUIT message
|
||||
quit(user, "Killed by " ~ killer.nick ~ " (" ~ comment ~ ")");
|
||||
|
|
Loading…
Reference in New Issue