diff options
author | Sadie Powell <sadie@witchery.services> | 2021-05-22 04:58:41 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2021-05-22 04:58:41 +0100 |
commit | 061d54f38e2ea9044935dfd6b8c208e7f4a3a958 (patch) | |
tree | 0f316c5e0d2cd9d9d8fd8199c7d07b25f4768879 | |
parent | 59c9b9dba44f451f9e3f03021a9b77510e190507 (diff) |
Send the correct join timestamp on a delayed join message.
-rw-r--r-- | src/modules/m_delayjoin.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index d1c69069b..55398710c 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -26,17 +26,20 @@ #include "inspircd.h" #include "modules/ctctags.h" +#include "modules/ircv3_servertime.h" #include "modules/names.h" class DelayJoinMode : public ModeHandler { private: LocalIntExt& unjoined; + IRCv3::ServerTime::API servertime; public: DelayJoinMode(Module* Parent, LocalIntExt& ext) : ModeHandler(Parent, "delayjoin", 'D', PARAM_NONE, MODETYPE_CHANNEL) , unjoined(ext) + , servertime(Parent) { ranktoset = ranktounset = OP_VALUE; } @@ -56,6 +59,7 @@ namespace */ class JoinHook : public ClientProtocol::EventHook { + private: const LocalIntExt& unjoined; public: @@ -161,7 +165,7 @@ static void populate(CUList& except, Membership* memb) void ModuleDelayJoin::OnUserJoin(Membership* memb, bool sync, bool created, CUList& except) { if (memb->chan->IsModeSet(djm)) - unjoined.set(memb, 1); + unjoined.set(memb, ServerInstance->Time()); } void ModuleDelayJoin::OnUserPart(Membership* memb, std::string &partmessage, CUList& except) @@ -209,13 +213,16 @@ void ModuleDelayJoin::OnUserMessage(User* user, const MessageTarget& target, con void DelayJoinMode::RevealUser(User* user, Channel* chan) { Membership* memb = chan->GetUser(user); - if (!memb || !unjoined.set(memb, 0)) + time_t jointime = unjoined.set(memb, 0); + if (!memb || !jointime) return; /* Display the join to everyone else (the user who joined got it earlier) */ CUList except_list; except_list.insert(user); ClientProtocol::Events::Join joinevent(memb); + if (servertime) + servertime->Set(joinevent, jointime); chan->Write(joinevent, 0, except_list); } |