+ if (!ServerInstance->IsChannel(mask[CHAN]))
+ {
+ source->WriteNumeric(ERR_NOSUCHCHANNEL, "%s :Invalid channel name in redirection (%s)", channel->name.c_str(), mask[CHAN].c_str());
+ return false;
+ }
+
+ Channel *c = ServerInstance->FindChan(mask[CHAN]);
+ if (!c)
+ {
+ source->WriteNumeric(690, ":Target channel %s must exist to be set as a redirect.", mask[CHAN].c_str());
+ return false;
+ }
+ else if (adding && c->GetPrefixValue(source) < OP_VALUE)
+ {
+ source->WriteNumeric(690, ":You must be opped on %s to set it as a redirect.", mask[CHAN].c_str());
+ return false;
+ }
+