summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-02-10 15:18:49 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-02-10 15:18:49 +0000
commit50d65268f4af9caf5e990e6323607b30217d7c60 (patch)
tree247749606b0faa11ba13e6b11063de8ad888c499 /src/modules
parentd1f78ff1605f22ae2d0ead990b37424a3897e0bc (diff)
Make some stuff configurable that hasnt been and should be.
<securelist waittime="n">: number of seconds a user must wait before LIST <safelist throttle="n">: Number of seconds a user must wait between each LIST command git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6563 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_safelist.cpp12
-rw-r--r--src/modules/m_securelist.cpp6
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 &parameter)
+ {
+ 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.
*/