summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2014-03-19 20:52:56 +0000
committerAttila Molnar <attilamolnar@hush.com>2014-04-11 16:14:10 +0200
commitc511bb56f5ceff1e395d82c4bfd78e5c23aabab6 (patch)
tree389364fc0772775199d4e716da414571086d090e /src
parent12df291dc76879e79bfa94f788e7f8a4ce2455df (diff)
Kill <channels> in favour of <connect:maxchans> and <oper:maxchans>.
Remove channels/high-join-limit privilege
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp30
-rw-r--r--src/configreader.cpp2
-rw-r--r--src/users.cpp2
3 files changed, 15 insertions, 19 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 089b6927e..46f9cfe89 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -161,30 +161,26 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co
/*
* We don't restrict the number of channels that remote users or users that are override-joining may be in.
- * We restrict local users to MaxChans channels.
- * We restrict local operators to OperMaxChans channels.
+ * We restrict local users to <connect:maxchans> channels.
+ * We restrict local operators to <oper:maxchans> channels.
* This is a lot more logical than how it was formerly. -- w00t
*/
if (!override)
{
- if (user->HasPrivPermission("channels/high-join-limit"))
+ unsigned int maxchans = user->GetClass()->maxchans;
+ if (user->IsOper())
{
- if (user->chans.size() >= ServerInstance->Config->OperMaxChans)
- {
- user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s :You are on too many channels", cname.c_str());
- return NULL;
- }
+ unsigned int opermaxchans = ConvToInt(user->oper->getConfig("maxchans"));
+ // If not set, use 2.0's <channels:opers>, if that's not set either, use limit from CC
+ if (!opermaxchans)
+ opermaxchans = ServerInstance->Config->OperMaxChans;
+ if (opermaxchans)
+ maxchans = opermaxchans;
}
- else
+ if (user->chans.size() >= maxchans)
{
- unsigned int maxchans = user->GetClass()->maxchans;
- if (!maxchans)
- maxchans = ServerInstance->Config->MaxChans;
- if (user->chans.size() >= maxchans)
- {
- user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s :You are on too many channels", cname.c_str());
- return NULL;
- }
+ user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s :You are on too many channels", cname.c_str());
+ return NULL;
}
}
diff --git a/src/configreader.cpp b/src/configreader.cpp
index cda5e03e0..c82bda479 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -392,7 +392,7 @@ void ServerConfig::Fill()
DefaultModes = options->getString("defaultmodes", "not");
PID = ConfValue("pid")->getString("file");
MaxChans = ConfValue("channels")->getInt("users", 20);
- OperMaxChans = ConfValue("channels")->getInt("opers", 60);
+ OperMaxChans = ConfValue("channels")->getInt("opers");
c_ipv4_range = ConfValue("cidr")->getInt("ipv4clone", 32);
c_ipv6_range = ConfValue("cidr")->getInt("ipv6clone", 128);
Limits.NickMax = ConfValue("limits")->getInt("maxnick", 32);
diff --git a/src/users.cpp b/src/users.cpp
index a15c31727..249f87850 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1252,7 +1252,7 @@ const std::string& FakeUser::GetFullRealHost()
ConnectClass::ConnectClass(ConfigTag* tag, char t, const std::string& mask)
: config(tag), type(t), fakelag(true), name("unnamed"), registration_timeout(0), host(mask),
pingtime(0), softsendqmax(0), hardsendqmax(0), recvqmax(0),
- penaltythreshold(0), commandrate(0), maxlocal(0), maxglobal(0), maxconnwarn(true), maxchans(0),
+ penaltythreshold(0), commandrate(0), maxlocal(0), maxglobal(0), maxconnwarn(true), maxchans(ServerInstance->Config->MaxChans),
limit(0), resolvehostnames(true)
{
}