mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 10:39:02 -04:00
Move RPL_TIME to the numeric header, unify TIME and ALLTIME.
This commit is contained in:
parent
af8b171ccf
commit
ec57c7545d
@ -32,6 +32,7 @@ enum
|
|||||||
RPL_VERSION = 351,
|
RPL_VERSION = 351,
|
||||||
RPL_LINKS = 364,
|
RPL_LINKS = 364,
|
||||||
RPL_ENDOFLINKS = 365,
|
RPL_ENDOFLINKS = 365,
|
||||||
|
RPL_TIME = 391,
|
||||||
ERR_NOSUCHNICK = 401,
|
ERR_NOSUCHNICK = 401,
|
||||||
ERR_NOSUCHCHANNEL = 403,
|
ERR_NOSUCHCHANNEL = 403,
|
||||||
ERR_NORECIPIENT = 411,
|
ERR_NORECIPIENT = 411,
|
||||||
|
@ -28,12 +28,6 @@
|
|||||||
|
|
||||||
#include "core_info.h"
|
#include "core_info.h"
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
// From RFC 1459.
|
|
||||||
RPL_TIME = 391,
|
|
||||||
};
|
|
||||||
|
|
||||||
CommandTime::CommandTime(Module* parent)
|
CommandTime::CommandTime(Module* parent)
|
||||||
: ServerTargetCommand(parent, "TIME")
|
: ServerTargetCommand(parent, "TIME")
|
||||||
{
|
{
|
||||||
@ -45,7 +39,9 @@ CmdResult CommandTime::Handle(User* user, const Params& parameters)
|
|||||||
if (!parameters.empty() && !irc::equals(parameters[0], ServerInstance->Config->ServerName))
|
if (!parameters.empty() && !irc::equals(parameters[0], ServerInstance->Config->ServerName))
|
||||||
return CmdResult::SUCCESS;
|
return CmdResult::SUCCESS;
|
||||||
|
|
||||||
const auto timestr = Time::ToString(ServerInstance->Time(), "%A, %d %b %Y %H:%M:%S %Z");
|
auto timestr = Time::ToString(ServerInstance->Time(), "%A, %d %B %Y @ %H:%M:%S %Z");
|
||||||
|
timestr += INSP_FORMAT(" ({})", ServerInstance->Time());
|
||||||
|
|
||||||
user->WriteRemoteNumeric(RPL_TIME, ServerInstance->Config->GetServerName(), timestr);
|
user->WriteRemoteNumeric(RPL_TIME, ServerInstance->Config->GetServerName(), timestr);
|
||||||
return CmdResult::SUCCESS;
|
return CmdResult::SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -37,13 +37,10 @@ public:
|
|||||||
|
|
||||||
CmdResult Handle(User* user, const Params& parameters) override
|
CmdResult Handle(User* user, const Params& parameters) override
|
||||||
{
|
{
|
||||||
const std::string fmtdate = Time::ToString(ServerInstance->Time(), "%Y-%m-%d %H:%M:%S", true);
|
auto timestr = Time::ToString(ServerInstance->Time(), "%A, %d %B %Y @ %H:%M:%S %Z", true);
|
||||||
|
timestr += INSP_FORMAT(" ({})", ServerInstance->Time());
|
||||||
|
|
||||||
std::string msg = "System time is " + fmtdate + " (" + ConvToStr(ServerInstance->Time()) + ") on " + ServerInstance->Config->ServerName;
|
user->WriteRemoteNumeric(RPL_TIME, ServerInstance->Config->ServerName, timestr);
|
||||||
|
|
||||||
user->WriteRemoteNotice(msg);
|
|
||||||
|
|
||||||
/* we want this routed out! */
|
|
||||||
return CmdResult::SUCCESS;
|
return CmdResult::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user