+ throw ModuleException("What the smeg, why are both your +q and +a prefixes the same character?");
- ServerInstance->Logs->Log("chanprotect", DEBUG, "qprefix is %c and aprefix is %c", QPrefix, APrefix);
+ if (cp && ServerInstance->Modes->FindPrefix(APrefix) == cp)
+ throw ModuleException("Looks like the +a prefix you picked for m_chanprotect is already in use. Pick another.");
- /* Did the user change the QA prefixes on the fly?
- * If so, remove all instances of the mode, and reinit
- * the module with prefixes enabled.
- */
- if ((old_q != QPrefix) && (!booting))
- {
- ServerInstance->Modes->DelMode(cf);
- delete cf;
- cf = new ChanFounder(ServerInstance, QPrefix, DeprivSelf, DeprivOthers);
- /* These wont fail, we already owned the mode characters before */
- ServerInstance->Modes->AddMode(cf);
- ServerInstance->SNO->WriteToSnoMask('A', "WARNING: +qa prefixes were enabled or disabled via a REHASH. Clients will probably need to reconnect to pick up this change.");
- }
+ if (cf && ServerInstance->Modes->FindPrefix(QPrefix) == cf)
+ throw ModuleException("Looks like the +q prefix you picked for m_chanprotect is already in use. Pick another.");
- if ((old_a != APrefix) && (!booting))
- {
- ServerInstance->Modes->DelMode(cp);
- delete cp;
- cp = new ChanProtect(ServerInstance, APrefix, DeprivSelf, DeprivOthers);
- ServerInstance->Modes->AddMode(cp);
- ServerInstance->SNO->WriteToSnoMask('A', "WARNING: +qa prefixes were enabled or disabled via a REHASH. Clients will probably need to reconnect to pick up this change.");