summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp21
-rw-r--r--src/configreader.cpp10
-rw-r--r--src/users.cpp5
3 files changed, 26 insertions, 10 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 6ba5aaa5f..bd8a9719c 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -219,9 +219,9 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo
*/
if (IS_LOCAL(user) && !override)
{
- if (IS_OPER(user))
+ 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;
@@ -229,10 +229,21 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo
}
else
{
- if (user->chans.size() >= Instance->Config->MaxChans)
+ if (IS_OPER(user))
{
- 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;
+ }
}
}
}
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 189fbb59b..b3258eb2e 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -407,6 +407,7 @@ bool DoConnect(ServerConfig* conf, const char* tag, char** entries, ValueList &v
int port = values[11].GetInteger();
const char* name = values[12].GetString();
const char* parent = values[13].GetString();
+ int maxchans = values[14].GetInteger();
if (*parent)
{
@@ -418,8 +419,7 @@ bool DoConnect(ServerConfig* conf, const char* tag, char** entries, ValueList &v
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);
}
}
@@ -429,7 +429,7 @@ bool DoConnect(ServerConfig* conf, const char* tag, char** entries, ValueList &v
{
if (*allow)
{
- 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);
}
@@ -672,7 +672,7 @@ void ServerConfig::Read(bool bail, userrec* user)
{"connect",
{"allow", "deny", "password", "timeout", "pingfreq", "flood",
"threshold", "sendq", "recvq", "localmax", "globalmax", "port",
- "name", "parent",
+ "name", "parent", "maxchans",
NULL},
{"", "", "", "", "120", "",
"", "", "", "3", "3", "0",
@@ -680,7 +680,7 @@ void ServerConfig::Read(bool bail, userrec* user)
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",
diff --git a/src/users.cpp b/src/users.cpp
index eb676b06a..4854849ad 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1040,6 +1040,7 @@ void userrec::CheckClass(const std::string &explicit_class)
this->threshold = a->GetThreshold();
this->sendqmax = a->GetSendqMax();
this->recvqmax = a->GetRecvqMax();
+ this->MaxChans = a->GetMaxChans();
}
void userrec::FullConnect()
@@ -1853,6 +1854,10 @@ void userrec::SplitChanList(userrec* dest, const std::string &cl)
}
}
+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,