summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-02-19 19:57:41 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-02-19 19:57:41 +0000
commitc1f88cfa9c653c0df9574edb6995a7385543be83 (patch)
treef7a63f36b05e72de2a76913b93e61d990eebfd84
parent5d03b5379f474a70f40f165707dde93161fb3d59 (diff)
Addition of feature request outlined in bug #195, suggested by Bricker
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6602 e03df62e-2008-0410-955e-edbf42e46eb7
-rwxr-xr-xconfigure16
-rw-r--r--docs/inspircd.conf.example11
-rw-r--r--include/configreader.h8
-rw-r--r--make/configure.pm6
-rw-r--r--src/channels.cpp12
-rw-r--r--src/configreader.cpp4
-rw-r--r--src/inspircd.cpp2
7 files changed, 30 insertions, 29 deletions
diff --git a/configure b/configure
index 7b0678c1d..b189c2695 100755
--- a/configure
+++ b/configure
@@ -29,8 +29,6 @@ GetOptions (
'disable-interactive' => \$opt_nointeractive,
'with-nick-length=i' => \$opt_nick_length,
'with-channel-length=i' => \$opt_chan_length,
- 'with-max-channels=i' => \$opt_maxchans,
- 'with-max-oper-channels=i' => \$opt_opermaxchans,
'with-max-clients=i' => \$opt_maxclients,
'enable-epoll' => \$opt_epoll,
'enable-kqueue' => \$opt_kqueue,
@@ -162,16 +160,6 @@ if (defined $opt_chan_length)
{
$config{CHAN_LENGT} = $opt_chan_length;
}
-$config{MAX_CHANNE} = "20"; # Default Max. Channels per user
-if (defined $opt_maxchans)
-{
- $config{MAX_CHANNE} = $opt_maxchans;
-}
-$config{MAX_OPERCH} = "60"; # Default Max. Channels per oper
-if (defined $opt_opermaxchans)
-{
- $config{MAX_OPERCH} = $opt_opermaxchans;
-}
$config{MAXI_MODES} = "20"; # Default Max. Number of Modes set at once.
if (defined $opt_modes)
{
@@ -624,8 +612,6 @@ should NOT be used. You should probably specify a newer compiler.\n\n";
promptnumeric("length of nicknames", "NICK_LENGT");
promptnumeric("length of channel names", "CHAN_LENGT");
- promptnumeric("number of channels a normal user may join at any one time", "MAX_CHANNE");
- promptnumeric("number of channels an oper may join at any one time", "MAX_OPERCH");
promptnumeric("number of mode changes in one line", "MAXI_MODES");
promptnumeric("length of an ident (username)", "MAX_IDENT");
promptnumeric("length of a quit message", "MAX_QUIT");
@@ -942,8 +928,6 @@ sub writefiles {
#define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS}
#define NICKMAX $NL
#define CHANMAX $CL
-#define MAXCHANS $config{MAX_CHANNE}
-#define OPERMAXCHANS $config{MAX_OPERCH}
#define MAXMODES $config{MAXI_MODES}
#define IDENTMAX $config{MAX_IDENT}
#define MAXQUIT $config{MAX_QUIT}
diff --git a/docs/inspircd.conf.example b/docs/inspircd.conf.example
index 9dacf10a8..06f447d3a 100644
--- a/docs/inspircd.conf.example
+++ b/docs/inspircd.conf.example
@@ -549,6 +549,17 @@
<files motd="inspircd.motd"
rules="inspircd.rules">
+#-#-#-#-#-#-#-#-#-#-#-# MAXIMUM CHANNELS -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
+# #
+# This optional configuration tag lets you define the maximum number #
+# of channels that both opers and users may be on at any one time. #
+# the default is 20 for user and 60 for opers if this tag is not #
+# defined. Remote users are not restricted in any manner. #
+# #
+
+<channels users="20"
+ opers="60">
+
#-#-#-#-#-#-#-#-#-#-#-#-#-#-# DNS SERVER -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# #
# Define your DNS server address here. InspIRCd has its own resolver. #
diff --git a/include/configreader.h b/include/configreader.h
index 61cf887fa..0de57c4e4 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -524,6 +524,14 @@ class ServerConfig : public Extensible
*/
int argc;
+ /** Max channels per user
+ */
+ unsigned int MaxChans;
+
+ /** Oper max channels per user
+ */
+ unsigned int OperMaxChans;
+
/** Construct a new ServerConfig
*/
ServerConfig(InspIRCd* Instance);
diff --git a/make/configure.pm b/make/configure.pm
index bc1be31ca..a08249223 100644
--- a/make/configure.pm
+++ b/make/configure.pm
@@ -147,8 +147,6 @@ sub dumphash()
print "\033[0mModule path:\033[1;32m\t\t\t$main::config{MODULE_DIR}\033[0m\n";
print "\033[0mLibrary path:\033[1;32m\t\t\t$main::config{LIBRARY_DIR}\033[0m\n";
print "\033[0mMax connections:\033[1;32m\t\t$main::config{MAX_CLIENT}\033[0m\n";
- print "\033[0mMax User Channels:\033[1;32m\t\t$main::config{MAX_CHANNE}\033[0m\n";
- print "\033[0mMax Oper Channels:\033[1;32m\t\t$main::config{MAX_OPERCH}\033[0m\n";
print "\033[0mMax nickname length:\033[1;32m\t\t$main::config{NICK_LENGT}\033[0m\n";
print "\033[0mMax channel length:\033[1;32m\t\t$main::config{CHAN_LENGT}\033[0m\n";
print "\033[0mMax mode length:\033[1;32m\t\t$main::config{MAXI_MODES}\033[0m\n";
@@ -215,10 +213,6 @@ InspIRCd 1.0.x, are also allowed.
--enable-openssl Enable OpenSSL module [no]
--with-nick-length=[n] Specify max. nick length [32]
--with-channel-length=[n] Specify max. channel length [64]
- --with-max-channels=[n] Specify max. number of channels
- a normal user may join [20]
- --with-max-oper-channels=[n] Specify max. number of channels
- an irc operator may join [60]
--with-max-clients=[n] Specify maximum number of users
which may connect locally
--enable-optimization=[n] Optimize using -O[n] gcc flag
diff --git a/src/channels.cpp b/src/channels.cpp
index 5383f4aba..366169dd6 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -296,22 +296,22 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo
}
/* NOTE: If the user is an oper here, we can extend their user->chans by up to
- * OPERMAXCHANS. For remote users which are not bound by the channel limits,
- * we can extend infinitely. Otherwise, nope, youre restricted to MAXCHANS.
+ * OperMaxchans. For remote users which are not bound by the channel limits,
+ * we can extend infinitely. Otherwise, nope, youre restricted to MaxChans.
*/
- if (!IS_LOCAL(user) || override == true) /* was a check on fd < 0 */
+ if (!IS_LOCAL(user) || override == true)
{
return chanrec::ForceChan(Instance, Ptr, user, privs);
}
else if (*user->oper)
{
- /* Oper allows extension up to the OPERMAXCHANS value */
- if (user->chans.size() < OPERMAXCHANS)
+ /* Oper allows extension up to the OperMaxchans value */
+ if (user->chans.size() < Instance->Config->OperMaxChans)
{
return chanrec::ForceChan(Instance, Ptr, user, privs);
}
}
- else if (user->chans.size() < MAXCHANS)
+ else if (user->chans.size() < Instance->Config->MaxChans)
{
return chanrec::ForceChan(Instance, Ptr, user, privs);
}
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 90719afa7..9d920dc8c 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -39,6 +39,8 @@ ServerConfig::ServerConfig(InspIRCd* Instance) : ServerInstance(Instance)
MaxConn = SOMAXCONN;
MaxWhoResults = 100;
debugging = 0;
+ MaxChans = 20;
+ OperMaxChans = 30;
LogLevel = DEFAULT;
maxbans.clear();
}
@@ -594,6 +596,8 @@ void ServerConfig::Read(bool bail, userrec* user)
{"whowas", "maxgroups", "10240", new ValueContainerInt (&this->WhoWasMaxGroups), DT_INTEGER, NoValidation},
{"whowas", "maxkeep", "3600", new ValueContainerChar (maxkeep), DT_CHARPTR, ValidateWhoWas},
{"die", "value", "", new ValueContainerChar (this->DieValue), DT_CHARPTR, NoValidation},
+ {"channels", "users", "20", new ValueContainerUInt (&this->MaxChans), DT_INTEGER, NoValidation},
+ {"channels", "opers", "60", new ValueContainerUInt (&this->OperMaxChans), DT_INTEGER, NoValidation},
{NULL}
};
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 354befcb3..a259bf349 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -577,7 +577,7 @@ void InspIRCd::BuildISupport()
{
// the neatest way to construct the initial 005 numeric, considering the number of configure constants to go in it...
std::stringstream v;
- v << "WALLCHOPS WALLVOICES MODES=" << MAXMODES << " CHANTYPES=# PREFIX=" << this->Modes->BuildPrefixes() << " MAP MAXCHANNELS=" << MAXCHANS << " MAXBANS=60 VBANLIST NICKLEN=" << NICKMAX-1;
+ v << "WALLCHOPS WALLVOICES MODES=" << MAXMODES << " CHANTYPES=# PREFIX=" << this->Modes->BuildPrefixes() << " MAP MAXCHANNELS=" << Config->MaxChans << " MAXBANS=60 VBANLIST NICKLEN=" << NICKMAX-1;
v << " CASEMAPPING=rfc1459 STATUSMSG=@%+ CHARSET=ascii TOPICLEN=" << MAXTOPIC << " KICKLEN=" << MAXKICK << " MAXTARGETS=" << Config->MaxTargets << " AWAYLEN=";
v << MAXAWAY << " CHANMODES=" << this->Modes->ChanModes() << " FNC NETWORK=" << Config->Network << " MAXPARA=32";
Config->data005 = v.str();