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
This commit is contained in:
brain 2007-02-19 19:57:41 +00:00
parent 5d03b5379f
commit c1f88cfa9c
7 changed files with 30 additions and 29 deletions

16
configure vendored
View File

@ -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}

View File

@ -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. #

View File

@ -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);

View File

@ -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

View File

@ -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);
}

View File

@ -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}
};

View File

@ -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();