+ /*
+ * 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->GetMaxChans())
+ {
+ if (user->chans.size() >= user->GetMaxChans())
+ {
+ user->WriteNumeric(405, "%s %s :You are on too many channels",user->nick, cn);
+ return NULL;
+ }
+ }
+ else
+ {
+ if (IS_OPER(user))
+ {
+ if (user->chans.size() >= Instance->Config->OperMaxChans)
+ {
+ user->WriteNumeric(405, "%s %s :You are on too many channels",user->nick, cn);
+ return NULL;
+ }
+ }
+ else
+ {
+ if (user->chans.size() >= Instance->Config->MaxChans)
+ {
+ user->WriteNumeric(405, "%s %s :You are on too many channels",user->nick, cn);
+ return NULL;
+ }
+ }
+ }
+ }
+
+ strlcpy(cname, cn, CHANMAX);
+ Ptr = Instance->FindChan(cname);