- if(adding)
- {
- /* It's a properly valid redirecting ban, and we're adding it */
- if(!channel->GetExt("banredirects", redirects))
- {
- redirects = new BanRedirectList;
- channel->Extend("banredirects", redirects);
- }
-
- /* Here 'param' doesn't have the channel on it yet */
- redirects->push_back(BanRedirectEntry(mask[CHAN].c_str(), param.c_str()));
-
- /* Now it does */
- param.append(mask[CHAN]);
- }
- else
+ source->WriteNumeric(690, "%s :You must be opped on %s to set it as a redirect.",source->nick.c_str(), mask[CHAN].c_str());
+ return false;
+ }
+
+ if (assign(channel->name) == mask[CHAN])
+ {
+ source->WriteNumeric(690, "%s %s :You cannot set a ban redirection to the channel the ban is on", source->nick.c_str(), channel->name.c_str());
+ return false;
+ }
+ }
+
+ if(adding)
+ {
+ /* It's a properly valid redirecting ban, and we're adding it */
+ redirects = extItem.get(channel);
+ if (!redirects)
+ {
+ redirects = new BanRedirectList;
+ extItem.set(channel, redirects);
+ }
+
+ /* Here 'param' doesn't have the channel on it yet */
+ redirects->push_back(BanRedirectEntry(mask[CHAN], param));
+
+ /* Now it does */
+ param.append(mask[CHAN]);
+ }
+ else
+ {
+ /* Removing a ban, if there's no extensible there are no redirecting bans and we're fine. */
+ redirects = extItem.get(channel);
+ if (redirects)
+ {
+ /* But there were, so we need to remove the matching one if there is one */
+
+ for(BanRedirectList::iterator redir = redirects->begin(); redir != redirects->end(); redir++)