summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-04 03:04:44 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-04 03:04:44 +0000
commit9225720d96ceec2cf7c74e1470cd3ad8e250eaa7 (patch)
tree24520decb70005bc2720605496b785dbe7d52d9b /src
parent67cd9cff246d66c5a4b3faa4f55c139560bf6a84 (diff)
Added new <banlist> tags, allows dynamic banlist sizes on a per channel basis
rather than hard coded or network wide git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@973 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/inspircd.cpp16
-rw-r--r--src/mode.cpp8
2 files changed, 24 insertions, 0 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index af5200ef1..d979750b5 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -1081,6 +1081,22 @@ chanrec* FindChan(const char* chan)
}
+long GetMaxBans(char* name)
+{
+ char CM[MAXBUF];
+ for (int count = 0; count < ConfValueEnum("banlist",&config_f); count++)
+ {
+ ConfValue("banlist","chan",count,CM,&config_f);
+ if (match(name,CM))
+ {
+ ConfValue("banlist","limit",count,CM,&config_f);
+ return atoi(CM);
+ }
+ }
+ return 64;
+}
+
+
void purge_empty_chans(void)
{
int go_again = 1, purge = 0;
diff --git a/src/mode.cpp b/src/mode.cpp
index 21817f283..12c6b2b92 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -464,6 +464,14 @@ char* add_ban(userrec *user,char *dest,chanrec *chan,int status)
c++;
if (c>1)
return NULL;
+
+ long maxbans = GetMaxBans(chan->name);
+ if (chan->bans.size() > maxbans)
+ {
+ WriteServ(user->fd,"478 %s %s :Channel ban list for %s is full (maximum entries for this channel is %d)",user->nick, chan->name,chan->name,maxbans);
+ return NULL;
+ }
+
log(DEBUG,"add_ban: %s %s",chan->name,user->nick);
TidyBan(dest);