summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_ircv3_servertime.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/modules/m_ircv3_servertime.cpp b/src/modules/m_ircv3_servertime.cpp
index ec6e48daa..3e059719d 100644
--- a/src/modules/m_ircv3_servertime.cpp
+++ b/src/modules/m_ircv3_servertime.cpp
@@ -20,8 +20,12 @@
#include "inspircd.h"
#include "modules/ircv3.h"
#include "modules/ircv3_servertime.h"
+#include "modules/server.h"
-class ServerTimeTag : public IRCv3::ServerTime::Manager, public IRCv3::CapTag<ServerTimeTag>
+class ServerTimeTag
+ : public IRCv3::ServerTime::Manager
+ , public IRCv3::CapTag<ServerTimeTag>
+ , public ServerProtocol::MessageEventListener
{
time_t lasttime;
long lasttimens;
@@ -45,6 +49,7 @@ class ServerTimeTag : public IRCv3::ServerTime::Manager, public IRCv3::CapTag<Se
ServerTimeTag(Module* mod)
: IRCv3::ServerTime::Manager(mod)
, IRCv3::CapTag<ServerTimeTag>(mod, "server-time", "time")
+ , ServerProtocol::MessageEventListener(mod)
, lasttime(0)
, lasttimens(0)
{
@@ -53,9 +58,18 @@ class ServerTimeTag : public IRCv3::ServerTime::Manager, public IRCv3::CapTag<Se
const std::string* GetValue(const ClientProtocol::Message& msg)
{
+ // Client protocol.
RefreshTimeString();
return &lasttimestring;
}
+
+ void OnBuildMessage(User* source, const char* command, ClientProtocol::TagMap& tags) CXX11_OVERRIDE
+ {
+ // Server protocol.
+ RefreshTimeString();
+ tags.insert(std::make_pair(tagname, ClientProtocol::MessageTagData(this, lasttimestring)));
+ }
+
};
class ModuleIRCv3ServerTime : public Module