- c = Srv->FindChannel(ChanToJoin);
- if (c)
- {
- /* Fix by brain: Dont let a channel be linked to *itself* either */
- if ((c == target) || (c->IsModeSet('L')))
- {
- WriteServ(user->fd,"690 %s :Circular redirection, mode +L to %s not allowed.",user->nick,params[0].c_str());
- return 0;
- }
- }
+ if (c && c->GetStatus(source) < STATUS_OP && !IS_OPER(source))
+ {
+ source->WriteNumeric(690, "%s :You must be opped on %s to set it as a redirect.",source->nick.c_str(),parameter.c_str());
+ parameter.clear();
+ return MODEACTION_DENY;
+ }
+
+ /*
+ * We used to do some checking for circular +L here, but there is no real need for this any more especially as we
+ * now catch +L looping in PreJoin. Remove it, since O(n) logic makes me sad, and we catch it anyway. :) -- w00t
+ */
+ channel->SetMode('L', true);
+ channel->SetModeParam('L', parameter.c_str(), true);
+ return MODEACTION_ALLOW;
+ }
+ else
+ {
+ if (channel->IsModeSet('L'))
+ {
+ channel->SetMode('L', false);
+ return MODEACTION_ALLOW;