+ /*
+ * 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.
+ * This is a lot more logical than how it was formerly. -- w00t
+ */
+ if (IS_LOCAL(user) && !override)
+ {
+ if (user->HasPrivPermission("channels/high-join-limit"))
+ {
+ if (user->chans.size() >= ServerInstance->Config->OperMaxChans)
+ {
+ user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :You are on too many channels",user->nick.c_str(), cn);
+ return NULL;
+ }
+ }
+ else
+ {
+ unsigned int maxchans = user->GetClass()->maxchans;
+ if (!maxchans)
+ maxchans = ServerInstance->Config->MaxChans;
+ if (user->chans.size() >= maxchans)
+ {
+ user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :You are on too many channels",user->nick.c_str(), cn);
+ return NULL;
+ }
+ }
+ }
+
+ strlcpy(cname, cn, ServerInstance->Config->Limits.ChanMax);
+ Ptr = ServerInstance->FindChan(cname);
+ bool created_by_local = false;