X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_delayjoin.cpp;h=677f5e728cbbd62cf70c5deb8a344a4556f366a6;hb=3151d60c1ecc9462e4c335282ee6c31672f45111;hp=8b06f060ae3c6600bf1401120fbd0532e16b3d6a;hpb=84ed051be7344e97784b94018622c7d7d4d44023;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 8b06f060a..677f5e728 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -1,10 +1,14 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2013, 2017-2019 Sadie Powell + * Copyright (C) 2012-2015, 2017-2018 Attila Molnar + * Copyright (C) 2012, 2019 Robby * Copyright (C) 2010 Jens Voss + * Copyright (C) 2009 Matt Smith * Copyright (C) 2009 Daniel De Graaf * Copyright (C) 2008 Robin Burchell - * Copyright (C) 2007-2008 Craig Edwards + * Copyright (C) 2007-2008, 2010 Craig Edwards * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -21,6 +25,8 @@ #include "inspircd.h" +#include "modules/ctctags.h" +#include "modules/names.h" class DelayJoinMode : public ModeHandler { @@ -72,7 +78,10 @@ class JoinHook : public ClientProtocol::EventHook } -class ModuleDelayJoin : public Module +class ModuleDelayJoin + : public Module + , public CTCTags::EventListener + , public Names::EventListener { public: LocalIntExt unjoined; @@ -80,20 +89,23 @@ class ModuleDelayJoin : public Module DelayJoinMode djm; ModuleDelayJoin() - : unjoined("delayjoin", ExtensionItem::EXT_MEMBERSHIP, this) + : CTCTags::EventListener(this) + , Names::EventListener(this) + , unjoined("delayjoin", ExtensionItem::EXT_MEMBERSHIP, this) , joinhook(this, unjoined) , djm(this, unjoined) { } Version GetVersion() CXX11_OVERRIDE; - ModResult OnNamesListItem(User* issuer, Membership*, std::string& prefixes, std::string& nick) CXX11_OVERRIDE; + ModResult OnNamesListItem(LocalUser* issuer, Membership*, std::string& prefixes, std::string& nick) CXX11_OVERRIDE; void OnUserJoin(Membership*, bool, bool, CUList&) CXX11_OVERRIDE; void CleanUser(User* user); void OnUserPart(Membership*, std::string &partmessage, CUList&) CXX11_OVERRIDE; void OnUserKick(User* source, Membership*, const std::string &reason, CUList&) CXX11_OVERRIDE; void OnBuildNeighborList(User* source, IncludeChanList& include, std::map& exception) CXX11_OVERRIDE; void OnUserMessage(User* user, const MessageTarget& target, const MessageDetails& details) CXX11_OVERRIDE; + void OnUserTagMessage(User* user, const MessageTarget& target, const CTCTags::TagMessageDetails& details) CXX11_OVERRIDE; ModResult OnRawMode(User* user, Channel* channel, ModeHandler* mh, const std::string& param, bool adding) CXX11_OVERRIDE; }; @@ -119,10 +131,10 @@ ModeAction DelayJoinMode::OnModeChange(User* source, User* dest, Channel* channe Version ModuleDelayJoin::GetVersion() { - return Version("Allows for delay-join channels (+D) where users don't appear to join until they speak", VF_VENDOR); + return Version("Adds channel mode D (delayjoin) which hides JOIN messages from users until they speak.", VF_VENDOR); } -ModResult ModuleDelayJoin::OnNamesListItem(User* issuer, Membership* memb, std::string& prefixes, std::string& nick) +ModResult ModuleDelayJoin::OnNamesListItem(LocalUser* issuer, Membership* memb, std::string& prefixes, std::string& nick) { /* don't prevent the user from seeing themself */ if (issuer == memb->user) @@ -176,6 +188,15 @@ void ModuleDelayJoin::OnBuildNeighborList(User* source, IncludeChanList& include } } +void ModuleDelayJoin::OnUserTagMessage(User* user, const MessageTarget& target, const CTCTags::TagMessageDetails& details) +{ + if (target.type != MessageTarget::TYPE_CHANNEL) + return; + + Channel* channel = target.Get(); + djm.RevealUser(user, channel); +} + void ModuleDelayJoin::OnUserMessage(User* user, const MessageTarget& target, const MessageDetails& details) { if (target.type != MessageTarget::TYPE_CHANNEL) @@ -198,7 +219,7 @@ void DelayJoinMode::RevealUser(User* user, Channel* chan) chan->Write(joinevent, 0, except_list); } -/* make the user visible if he receives any mode change */ +/* make the user visible if they receive any mode change */ ModResult ModuleDelayJoin::OnRawMode(User* user, Channel* channel, ModeHandler* mh, const std::string& param, bool adding) { if (!channel || param.empty())