forked from lesderid/salty-ircd
Implement TIME
This commit is contained in:
parent
cfc1345682
commit
ffa830cf04
|
@ -169,6 +169,10 @@ class Connection
|
||||||
if(!registered) sendErrNotRegistered();
|
if(!registered) sendErrNotRegistered();
|
||||||
else onVersion(message);
|
else onVersion(message);
|
||||||
break;
|
break;
|
||||||
|
case "TIME":
|
||||||
|
if(!registered) sendErrNotRegistered();
|
||||||
|
else onTime(message);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
writeln("unknown command '", message.command, "'");
|
writeln("unknown command '", message.command, "'");
|
||||||
send(Message(_server.name, "421", [nick, message.command, "Unknown command"]));
|
send(Message(_server.name, "421", [nick, message.command, "Unknown command"]));
|
||||||
|
@ -583,6 +587,16 @@ class Connection
|
||||||
_server.sendVersion(this);
|
_server.sendVersion(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onTime(Message message)
|
||||||
|
{
|
||||||
|
if(message.parameters.length > 0)
|
||||||
|
{
|
||||||
|
notImplemented("querying the time of another server");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_server.sendTime(this);
|
||||||
|
}
|
||||||
|
|
||||||
void sendWhoReply(string channel, Connection user, uint hopCount)
|
void sendWhoReply(string channel, Connection user, uint hopCount)
|
||||||
{
|
{
|
||||||
auto flags = user.modes.canFind('a') ? "G" : "H";
|
auto flags = user.modes.canFind('a') ? "G" : "H";
|
||||||
|
|
|
@ -6,6 +6,7 @@ import std.range;
|
||||||
import std.conv;
|
import std.conv;
|
||||||
import std.socket;
|
import std.socket;
|
||||||
import core.time;
|
import core.time;
|
||||||
|
import std.datetime;
|
||||||
|
|
||||||
import vibe.core.core;
|
import vibe.core.core;
|
||||||
|
|
||||||
|
@ -256,6 +257,12 @@ class Server
|
||||||
connection.send(Message(name, "351", [connection.nick, versionString ~ ".", name, ""], true));
|
connection.send(Message(name, "351", [connection.nick, versionString ~ ".", name, ""], true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sendTime(Connection connection)
|
||||||
|
{
|
||||||
|
auto timeString = Clock.currTime.toISOExtString;
|
||||||
|
connection.send(Message(name, "391", [connection.nick, name, timeString], true));
|
||||||
|
}
|
||||||
|
|
||||||
void invite(Connection inviter, string target, string channelName)
|
void invite(Connection inviter, string target, string channelName)
|
||||||
{
|
{
|
||||||
auto user = connections.find!(c => c.nick = target)[0];
|
auto user = connections.find!(c => c.nick = target)[0];
|
||||||
|
|
Loading…
Reference in New Issue