mirror of
https://github.com/anope/anope.git
synced 2026-07-04 01:23:12 +02:00
Add an IRCv3 time tag to entry messages.
This commit is contained in:
@@ -296,12 +296,21 @@ public:
|
||||
if (!messages)
|
||||
return;
|
||||
|
||||
const auto timestamp = Config->GetModule(this).Get<bool>("timestamp", "yes");
|
||||
for (const auto &message : *(*messages))
|
||||
{
|
||||
Anope::map<Anope::string> tags;
|
||||
if (timestamp)
|
||||
{
|
||||
char timebuf[32];
|
||||
strftime(timebuf, sizeof(timebuf), "%Y-%m-%dT%H:%M:%S.000Z", gmtime(&message->when));
|
||||
tags["time"] = timebuf;
|
||||
}
|
||||
|
||||
if (u->ShouldPrivmsg())
|
||||
IRCD->SendContextPrivmsg(c->ci->WhoSends(), u, c, message->message);
|
||||
IRCD->SendContextPrivmsg(c->ci->WhoSends(), u, c, message->message, tags);
|
||||
else
|
||||
IRCD->SendContextNotice(c->ci->WhoSends(), u, c, message->message);
|
||||
IRCD->SendContextNotice(c->ci->WhoSends(), u, c, message->message, tags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user