summaryrefslogtreecommitdiff
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
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
-rw-r--r--docs/inspircd.conf.example19
-rw-r--r--src/modules/m_safelist.cpp12
-rw-r--r--src/modules/m_securelist.cpp6
3 files changed, 31 insertions, 6 deletions
diff --git a/docs/inspircd.conf.example b/docs/inspircd.conf.example
index 7c4b46e2f..c0ad163d5 100644
--- a/docs/inspircd.conf.example
+++ b/docs/inspircd.conf.example
@@ -1495,6 +1495,16 @@
# Provide /LIST throttling (to prevent flooding) and /LIST safety to
# prevent excess flood when the list is large.
#<module name="m_safelist.so">
+#
+#-#-#-#-#-#-#-#-#-#-# SAFELIST CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#-#
+#
+# When using Safelist, you may set the following value, which sets the
+# amount of time in seconds a user must wait between LIST commands.
+# For example, if this is set to 60 (the default) then the user may not
+# /LIST more than once a minute. If not defined, the default value is
+# 60 seconds.
+#
+#<safelist throttle="60">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# SAJOIN module: Adds the /SAJOIN command
@@ -1526,8 +1536,13 @@
# Securelist can be harmful to some irc search engines such as #
# netsplit.de and searchirc.com. To prevent securelist blocking these #
# sites from listing, define exception tags as shown below: #
-<securelist exception="*@*.searchirc.org">
-<securelist exception="*@*.netsplit.de">
+<securelist exception="*@*.searchirc.org"> #
+<securelist exception="*@*.netsplit.de"> #
+# #
+# Define the following variable to change how long a user must wait #
+# before issuing a LIST. If not defined, defaults to 60 seconds. #
+# #
+#<securelist waittime="60"> #
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Set Idle module: Adds a command for opers to change their
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.
*/