diff options
author | Adam <Adam@anope.org> | 2013-03-31 00:20:20 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-03-31 00:43:11 -0500 |
commit | 6e0dc0e2103494d50dd4bd9920550d1653365f05 (patch) | |
tree | 10b89c24cae17069a0cc97db376d960220f7089d /modules/commands | |
parent | 7e7556f06445d4d8e607ef514c9fb5009899db73 (diff) |
Add networkinfo:modelistsize config option to set the max size of b/e/I lists
Diffstat (limited to 'modules/commands')
-rw-r--r-- | modules/commands/cs_ban.cpp | 19 | ||||
-rw-r--r-- | modules/commands/cs_mode.cpp | 7 |
2 files changed, 20 insertions, 6 deletions
diff --git a/modules/commands/cs_ban.cpp b/modules/commands/cs_ban.cpp index 52c372fb4..e46bfcecb 100644 --- a/modules/commands/cs_ban.cpp +++ b/modules/commands/cs_ban.cpp @@ -53,6 +53,18 @@ class CommandCSBan : public Command return; } + Channel *c = ci->c; + if (c == NULL) + { + source.Reply(CHAN_X_NOT_IN_USE, chan.c_str()); + return; + } + else if (IRCD->GetMaxListFor(c) && c->HasMode("BAN") >= IRCD->GetMaxListFor(c)) + { + source.Reply(_("The ban list for %s is full."), c->name.c_str()); + return; + } + Anope::string expiry, target, reason; time_t ban_time; if (params[1][0] == '+') @@ -82,15 +94,12 @@ class CommandCSBan : public Command if (reason.length() > Config->CSReasonMax) reason = reason.substr(0, Config->CSReasonMax); - Channel *c = ci->c; User *u = source.GetUser(); User *u2 = User::Find(target, true); AccessGroup u_access = source.AccessFor(ci); - if (!c) - source.Reply(CHAN_X_NOT_IN_USE, chan.c_str()); - else if (!u_access.HasPriv("BAN") && !source.HasPriv("chanserv/kick")) + if (!u_access.HasPriv("BAN") && !source.HasPriv("chanserv/kick")) source.Reply(ACCESS_DENIED); else if (u2) { @@ -102,7 +111,7 @@ class CommandCSBan : public Command * Dont ban/kick the user on channels where he is excepted * to prevent services <-> server wars. */ - else if (ci->c->MatchesList(u2, "EXCEPT")) + else if (c->MatchesList(u2, "EXCEPT")) source.Reply(CHAN_EXCEPTED, u2->nick.c_str(), ci->name.c_str()); else if (u2->IsProtected()) source.Reply(ACCESS_DENIED); diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp index d44e7e07b..823b60f8e 100644 --- a/modules/commands/cs_mode.cpp +++ b/modules/commands/cs_mode.cpp @@ -102,6 +102,8 @@ class CommandCSMode : public Command Anope::string mode_param; if (((cm->type == MODE_STATUS || cm->type == MODE_LIST) && !sep.GetToken(mode_param)) || (cm->type == MODE_PARAM && adding && !sep.GetToken(mode_param))) source.Reply(_("Missing parameter for mode %c."), cm->mchar); + else if (cm->type == MODE_LIST && ci->c && IRCD->GetMaxListFor(ci->c) && ci->c->HasMode(cm->name) >= IRCD->GetMaxListFor(ci->c)) + source.Reply(_("List for mode %c is full."), cm->mchar); else { ci->SetMLock(cm, adding, mode_param, source.GetNick()); @@ -371,7 +373,10 @@ class CommandCSMode : public Command if (!sep.GetToken(param)) break; if (adding) - ci->c->SetMode(NULL, cm, param); + { + if (IRCD->GetMaxListFor(ci->c) && ci->c->HasMode(cm->name) < IRCD->GetMaxListFor(ci->c)) + ci->c->SetMode(NULL, cm, param); + } else { std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> its = ci->c->GetModeList(cm->name); |