diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_safelist.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_securelist.cpp | 6 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp index f718fbc88..10b8cc270 100644 --- a/src/modules/m_safelist.cpp +++ b/src/modules/m_safelist.cpp @@ -152,10 +152,12 @@ class ListTimer : public InspTimer class ModuleSafeList : public Module { + unsigned int ThrottleSecs; public: ModuleSafeList(InspIRCd* Me) : Module::Module(Me) { timer = NULL; + OnRehash(NULL, ""); } virtual ~ModuleSafeList() @@ -163,6 +165,12 @@ class ModuleSafeList : public Module if (timer) ServerInstance->Timers->DelTimer(timer); } + + virtual void OnRehash(userrec* user, const std::string ¶meter) + { + ConfigReader MyConf(ServerInstance); + ThrottleSecs = MyConf.ReadInteger("safelist", "throttle", "60", 0, true); + } virtual Version GetVersion() { @@ -171,7 +179,7 @@ class ModuleSafeList : public Module void Implements(char* List) { - List[I_OnPreCommand] = List[I_OnCleanup] = List[I_OnUserQuit] = List[I_On005Numeric] = 1; + List[I_OnPreCommand] = List[I_OnCleanup] = List[I_OnUserQuit] = List[I_On005Numeric] = List[I_OnRehash] = 1; } /* @@ -215,7 +223,7 @@ class ModuleSafeList : public Module user->GetExt("safelist_last", last_list_time); if (last_list_time) { - if (ServerInstance->Time() < (*last_list_time)+60) + if (ServerInstance->Time() < (*last_list_time)+ThrottleSecs) { user->WriteServ("NOTICE %s :*** Woah there, slow down a little, you can't /LIST so often!",user->nick); user->WriteServ("321 %s Channel :Users Name",user->nick); diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index efa448290..bfed8f46e 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -24,6 +24,7 @@ class ModuleSecureList : public Module { private: std::vector<std::string> allowlist; + unsigned int WaitTime; public: ModuleSecureList(InspIRCd* Me) : Module::Module(Me) { @@ -45,6 +46,7 @@ class ModuleSecureList : public Module allowlist.clear(); for (int i = 0; i < MyConf->Enumerate("securelist"); i++) allowlist.push_back(MyConf->ReadValue("securelist", "exception", i)); + WaitTime = MyConf->ReadInteger("securelist", "waittime", "60", 0, true); DELETE(MyConf); } @@ -63,7 +65,7 @@ class ModuleSecureList : public Module if (!validated) return 0; - if ((command == "LIST") && (ServerInstance->Time() < (user->signon+60)) && (!*user->oper)) + if ((command == "LIST") && (ServerInstance->Time() < (user->signon+WaitTime)) && (!*user->oper)) { /* Normally wouldnt be allowed here, are they exempt? */ for (std::vector<std::string>::iterator x = allowlist.begin(); x != allowlist.end(); x++) @@ -71,7 +73,7 @@ class ModuleSecureList : public Module return 0; /* Not exempt, BOOK EM DANNO! */ - user->WriteServ("NOTICE %s :*** You cannot list within the first minute of connecting. Please try again later.",user->nick); + user->WriteServ("NOTICE %s :*** You cannot list within the first %d seconds of connecting. Please try again later.",user->nick, WaitTime); /* Some crap clients (read: mIRC, various java chat applets) muck up if they don't * receive these numerics whenever they send LIST, so give them an empty LIST to mull over. */ |