summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-06 10:44:42 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-06 10:44:42 +0000
commit480be29a95df6160819a31b86e6432dbf81e2499 (patch)
tree8aa1a51dcdca678b5c9e7eda5ef849dd20c3c4e0
parent814f144065e5a278fbdea6e9af5e511834be288f (diff)
Tidied GetMaxBans to leave the ConfigReader subsystem alone
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3491 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/inspircd_io.h6
-rw-r--r--src/helperfuncs.cpp17
-rw-r--r--src/inspircd_io.cpp9
3 files changed, 21 insertions, 11 deletions
diff --git a/include/inspircd_io.h b/include/inspircd_io.h
index 6d9085786..d1356954c 100644
--- a/include/inspircd_io.h
+++ b/include/inspircd_io.h
@@ -308,8 +308,14 @@ class ServerConfig : public classbase
*/
char CustomVersion[MAXBUF];
+ /** List of u-lined servers
+ */
std::vector<irc::string> ulines;
+ /** Max banlist sizes for channels (the std::string is a glob)
+ */
+ std::map<std::string,int> maxbans;
+
ServerConfig();
/** Clears the include stack in preperation for
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index c6fb806ed..431e34947 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -1098,17 +1098,12 @@ chanrec* FindChan(const char* chan)
long GetMaxBans(char* name)
{
- char CM[MAXBUF];
- for (int count = 0; count < Config->ConfValueEnum("banlist",&Config->config_f); count++)
- {
- Config->ConfValue("banlist","chan",count,CM,&Config->config_f);
- if (match(name,CM))
- {
- Config->ConfValue("banlist","limit",count,CM,&Config->config_f);
- return atoi(CM);
- }
- }
- return 64;
+ for (std::map<std::string,int>::iterator n = Config->maxbans.begin(); n != Config->MaxBans.end(); n++)
+ {
+ if (match(name,n->first->c_str()))
+ return atoi(n->second);
+ }
+ return 64;
}
void purge_empty_chans(userrec* u)
diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp
index e47cf9dda..477897b0b 100644
--- a/src/inspircd_io.cpp
+++ b/src/inspircd_io.cpp
@@ -59,6 +59,7 @@ ServerConfig::ServerConfig()
MaxWhoResults = 100;
debugging = 0;
LogLevel = DEFAULT;
+ maxbans.clear();
}
void ServerConfig::ClearStack()
@@ -417,6 +418,14 @@ void ServerConfig::Read(bool bail, userrec* user)
Config->ulines.push_back(ServName);
}
}
+ maxbans.clear();
+ char CM[MAXBUF],CM2[MAXBUF];
+ for (int count = 0; count < Config->ConfValueEnum("banlist",&Config->config_f); count++)
+ {
+ Config->ConfValue("banlist","chan",count,CM1,&Config->config_f);
+ Config->ConfValue("banlist","limit",count,CM2,&Config->config_f);
+ maxbans[CM1] = atoi(CM2);
+ }
ReadClassesAndTypes();
log(DEFAULT,"Reading K lines,Q lines and Z lines from config...");
read_xline_defaults();