]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_securelist.cpp
Only assign NewServices once the duplicate check is done.
[user/henk/code/inspircd.git] / src / modules / m_securelist.cpp
index b8ed384f3f72f2abaa2bbf1a95230399950fcb49..468b6845910e78e49de60bb83b000dbf01bfac59 100644 (file)
@@ -2,7 +2,7 @@
  * InspIRCd -- Internet Relay Chat Daemon
  *
  *   Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
- *   Copyright (C) 2013, 2018 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2013, 2018, 2020 Sadie Powell <sadie@witchery.services>
  *   Copyright (C) 2012-2013, 2016 Attila Molnar <attilamolnar@hush.com>
  *   Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
  *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
@@ -34,6 +34,7 @@ class ModuleSecureList : public Module
  private:
        AllowList allowlist;
        bool exemptregistered;
+       bool showmsg;
        unsigned int WaitTime;
 
  public:
@@ -57,6 +58,7 @@ class ModuleSecureList : public Module
 
                ConfigTag* tag = ServerInstance->Config->ConfValue("securelist");
                exemptregistered = tag->getBool("exemptregistered");
+               showmsg = tag->getBool("showmsg", true);
                WaitTime = tag->getDuration("waittime", 60, 1);
                allowlist.swap(newallows);
        }
@@ -79,9 +81,12 @@ class ModuleSecureList : public Module
                        if (exemptregistered && ext && ext->get(user))
                                return MOD_RES_PASSTHRU;
 
-                       user->WriteNotice(InspIRCd::Format("*** You cannot view the channel list right now. Please %stry again in %s.",
-                               (exemptregistered ? "login to an account or " : ""),
-                               InspIRCd::DurationString(waitallowed - ServerInstance->Time()).c_str()));
+                       if (showmsg)
+                       {
+                               user->WriteNotice(InspIRCd::Format("*** You cannot view the channel list right now. Please %stry again in %s.",
+                                       (exemptregistered ? "login to an account or " : ""),
+                                       InspIRCd::DurationString(waitallowed - ServerInstance->Time()).c_str()));
+                       }
 
                        // The client might be waiting on a response to do something so send them an
                        // empty list response to satisfy that.
@@ -94,7 +99,8 @@ class ModuleSecureList : public Module
 
        void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
        {
-               tokens["SECURELIST"];
+               if (showmsg)
+                       tokens["SECURELIST"] = ConvToStr(WaitTime);
        }
 };