git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7761
e03df62e-2008-0410-955e-
edbf42e46eb7
# password="blahblah" timeout="10" timeout="blah" #
# flood="5" threshold="8" pingfreq="120" sendq="99999" #
# revcq="696969" localmax="3" globalmax="3" #
# password="blahblah" timeout="10" timeout="blah" #
# flood="5" threshold="8" pingfreq="120" sendq="99999" #
# revcq="696969" localmax="3" globalmax="3" #
+# port="6660" maxchans="50"> #
# #
# <connect name="blocked" deny="127.0.0.1" port="6667"> #
# #
# #
# <connect name="blocked" deny="127.0.0.1" port="6667"> #
# #
# you do this, any options not explicitly specified in the tag will #
# be copied from the parent. #
# #
# you do this, any options not explicitly specified in the tag will #
# be copied from the parent. #
# #
+# If the value maxchans is included, this overrides all other max #
+# channels related settings, including the seperate oper maximum. #
+# You may set this to any (sane) value you wish and it applies to #
+# all users within this connect tag. #
+# #
# You may optionally include timeout="x" on any allow line, which #
# specifies the amount of time given before an unknown connection #
# is closed if USER/NICK/PASS are not given. This value is in secs #
# You may optionally include timeout="x" on any allow line, which #
# specifies the amount of time given before an unknown connection #
# is closed if USER/NICK/PASS are not given. This value is in secs #
/** Tag name */
const char* tag;
/** One or more items within tag */
/** Tag name */
const char* tag;
/** One or more items within tag */
/** One or more defaults for items within tags */
/** One or more defaults for items within tags */
- char* items_default[15];
+ char* items_default[17];
/** One or more data types */
/** One or more data types */
/** Initialization function */
MultiNotify init_function;
/** Validation function */
/** Initialization function */
MultiNotify init_function;
/** Validation function */
/** Global max when connecting by this connection class
*/
unsigned long maxglobal;
/** Global max when connecting by this connection class
*/
unsigned long maxglobal;
+
+ /** Max channels for this class
+ */
+ unsigned int maxchans;
+
/** Port number this connect class applies to
*/
int port;
/** Port number this connect class applies to
*/
int port;
*/
ConnectClass(const std::string &thename, unsigned int timeout, unsigned int fld, const std::string &hst, unsigned int ping,
const std::string &pas, unsigned int thres, unsigned long sendq, unsigned long recvq,
*/
ConnectClass(const std::string &thename, unsigned int timeout, unsigned int fld, const std::string &hst, unsigned int ping,
const std::string &pas, unsigned int thres, unsigned long sendq, unsigned long recvq,
- unsigned long maxl, unsigned long maxg, int p = 0) :
+ unsigned long maxl, unsigned long maxg, unsigned int maxc, int p = 0) :
type(CC_ALLOW), name(thename), registration_timeout(timeout), flood(fld), host(hst), pingtime(ping), pass(pas),
type(CC_ALLOW), name(thename), registration_timeout(timeout), flood(fld), host(hst), pingtime(ping), pass(pas),
- threshold(thres), sendqmax(sendq), recvqmax(recvq), maxlocal(maxl), maxglobal(maxg), port(p) { }
+ threshold(thres), sendqmax(sendq), recvqmax(recvq), maxlocal(maxl), maxglobal(maxg), maxchans(maxc), port(p) { }
/** Create a new connect class to DENY connections
* @param thename Name of the connect class
* @param hst The IP mask to deny
*/
ConnectClass(const std::string &thename, const std::string &hst) : type(CC_DENY), name(thename), registration_timeout(0),
/** Create a new connect class to DENY connections
* @param thename Name of the connect class
* @param hst The IP mask to deny
*/
ConnectClass(const std::string &thename, const std::string &hst) : type(CC_DENY), name(thename), registration_timeout(0),
- flood(0), host(hst), pingtime(0), pass(""), threshold(0), sendqmax(0), recvqmax(0), maxlocal(0), maxglobal(0), port(0) { }
+ flood(0), host(hst), pingtime(0), pass(""), threshold(0), sendqmax(0), recvqmax(0), maxlocal(0), maxglobal(0), maxchans(0), port(0) { }
/* Create a new connect class based on another class
* @param thename The name of the connect class
/* Create a new connect class based on another class
* @param thename The name of the connect class
ConnectClass(const std::string &thename, const ConnectClass &source) : type(source.type), name(thename),
registration_timeout(source.registration_timeout), flood(source.flood), host(source.host),
pingtime(source.pingtime), pass(source.pass), threshold(source.threshold), sendqmax(source.sendqmax),
ConnectClass(const std::string &thename, const ConnectClass &source) : type(source.type), name(thename),
registration_timeout(source.registration_timeout), flood(source.flood), host(source.host),
pingtime(source.pingtime), pass(source.pass), threshold(source.threshold), sendqmax(source.sendqmax),
- recvqmax(source.recvqmax), maxlocal(source.maxlocal), maxglobal(source.maxglobal), port(source.port)
+ recvqmax(source.recvqmax), maxlocal(source.maxlocal), maxglobal(source.maxglobal), maxchans(source.maxchans),
+ port(source.port)
*/
void Update(unsigned int timeout, unsigned int fld, const std::string &hst, unsigned int ping,
const std::string &pas, unsigned int thres, unsigned long sendq, unsigned long recvq,
*/
void Update(unsigned int timeout, unsigned int fld, const std::string &hst, unsigned int ping,
const std::string &pas, unsigned int thres, unsigned long sendq, unsigned long recvq,
- unsigned long maxl, unsigned long maxg, int p)
+ unsigned long maxl, unsigned long maxg, unsigned int maxc, int p)
{
if (timeout)
registration_timeout = timeout;
{
if (timeout)
registration_timeout = timeout;
maxlocal = maxl;
if (maxg)
maxglobal = maxg;
maxlocal = maxl;
if (maxg)
maxglobal = maxg;
+ if (maxc)
+ maxchans = maxc;
+ int GetMaxChans()
+ {
+ return maxchans;
+ }
+
/** Returns the type, CC_ALLOW or CC_DENY
*/
char GetType()
/** Returns the type, CC_ALLOW or CC_DENY
*/
char GetType()
+ /** Max channels for this user
+ */
+ unsigned int MaxChans;
+
public:
/** Resolvers for looking up this users IP address
* This will occur if and when res_reverse completes.
public:
/** Resolvers for looking up this users IP address
* This will occur if and when res_reverse completes.
*/
void StartDNSLookup();
*/
void StartDNSLookup();
+ unsigned int GetMaxChans();
+
/** The users nickname.
* An invalid nickname indicates an unregistered connection prior to the NICK command.
* Use InspIRCd::IsNick() to validate nicknames.
/** The users nickname.
* An invalid nickname indicates an unregistered connection prior to the NICK command.
* Use InspIRCd::IsNick() to validate nicknames.
*/
if (IS_LOCAL(user) && !override)
{
*/
if (IS_LOCAL(user) && !override)
{
+ if (user->GetMaxChans())
- if (user->chans.size() >= Instance->Config->OperMaxChans)
+ if (user->chans.size() >= user->GetMaxChans())
{
user->WriteServ("405 %s %s :You are on too many channels",user->nick, cn);
return NULL;
{
user->WriteServ("405 %s %s :You are on too many channels",user->nick, cn);
return NULL;
- if (user->chans.size() >= Instance->Config->MaxChans)
- user->WriteServ("405 %s %s :You are on too many channels",user->nick, cn);
- return NULL;
+ if (user->chans.size() >= Instance->Config->OperMaxChans)
+ {
+ user->WriteServ("405 %s %s :You are on too many channels",user->nick, cn);
+ return NULL;
+ }
+ }
+ else
+ {
+ if (user->chans.size() >= Instance->Config->MaxChans)
+ {
+ user->WriteServ("405 %s %s :You are on too many channels",user->nick, cn);
+ return NULL;
+ }
int port = values[11].GetInteger();
const char* name = values[12].GetString();
const char* parent = values[13].GetString();
int port = values[11].GetInteger();
const char* name = values[12].GetString();
const char* parent = values[13].GetString();
+ int maxchans = values[14].GetInteger();
if (item->GetName() == name)
{
ConnectClass c(name, *item);
if (item->GetName() == name)
{
ConnectClass c(name, *item);
- c.Update(timeout, flood, std::string(*allow ? allow : deny), pingfreq, password, threshold, sendq, recvq, localmax, globalmax, 0);
- c.SetPort(port);
+ c.Update(timeout, flood, std::string(*allow ? allow : deny), pingfreq, password, threshold, sendq, recvq, localmax, globalmax, maxchans, port);
conf->Classes.push_back(c);
}
}
conf->Classes.push_back(c);
}
}
- ConnectClass c(name, timeout, flood, allow, pingfreq, password, threshold, sendq, recvq, localmax, globalmax);
+ ConnectClass c(name, timeout, flood, allow, pingfreq, password, threshold, sendq, recvq, localmax, globalmax, maxchans);
c.SetPort(port);
conf->Classes.push_back(c);
}
c.SetPort(port);
conf->Classes.push_back(c);
}
{"connect",
{"allow", "deny", "password", "timeout", "pingfreq", "flood",
"threshold", "sendq", "recvq", "localmax", "globalmax", "port",
{"connect",
{"allow", "deny", "password", "timeout", "pingfreq", "flood",
"threshold", "sendq", "recvq", "localmax", "globalmax", "port",
+ "name", "parent", "maxchans",
NULL},
{"", "", "", "", "120", "",
"", "", "", "3", "3", "0",
NULL},
{"", "", "", "", "120", "",
"", "", "", "3", "3", "0",
NULL},
{DT_CHARPTR, DT_CHARPTR, DT_CHARPTR, DT_INTEGER, DT_INTEGER, DT_INTEGER,
DT_INTEGER, DT_INTEGER, DT_INTEGER, DT_INTEGER, DT_INTEGER, DT_INTEGER,
NULL},
{DT_CHARPTR, DT_CHARPTR, DT_CHARPTR, DT_INTEGER, DT_INTEGER, DT_INTEGER,
DT_INTEGER, DT_INTEGER, DT_INTEGER, DT_INTEGER, DT_INTEGER, DT_INTEGER,
- DT_CHARPTR, DT_CHARPTR},
+ DT_CHARPTR, DT_CHARPTR, DT_INTEGER},
InitConnect, DoConnect, DoneConnect},
{"uline",
InitConnect, DoConnect, DoneConnect},
{"uline",
this->threshold = a->GetThreshold();
this->sendqmax = a->GetSendqMax();
this->recvqmax = a->GetRecvqMax();
this->threshold = a->GetThreshold();
this->sendqmax = a->GetSendqMax();
this->recvqmax = a->GetRecvqMax();
+ this->MaxChans = a->GetMaxChans();
}
void userrec::FullConnect()
}
void userrec::FullConnect()
+unsigned int userrec::GetMaxChans()
+{
+ return this->MaxChans;
+}
/* looks up a users password for their connection class (<ALLOW>/<DENY> tags)
* NOTE: If the <ALLOW> or <DENY> tag specifies an ip, and this user resolves,
/* looks up a users password for their connection class (<ALLOW>/<DENY> tags)
* NOTE: If the <ALLOW> or <DENY> tag specifies an ip, and this user resolves,