X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_chanprotect.cpp;h=caef4961f2dec09a33735aa0fbe9b078af9a4b80;hb=1bfa48143c04504181d1b194af151fae2dac1eb1;hp=61ffa3ad2616b4a53be66e3fec171ae2c07800a6;hpb=f8ccaed31d68661d16eae1a412b337af09de111b;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 61ffa3ad2..caef4961f 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -162,7 +162,7 @@ class ChanProtect : public ModeHandler, public FounderProtectBase { public: ChanProtect(Module* Creator) - : ModeHandler(Creator, "protected", 'a', PARAM_ALWAYS, MODETYPE_CHANNEL), + : ModeHandler(Creator, "admin", 'a', PARAM_ALWAYS, MODETYPE_CHANNEL), FounderProtectBase('a',"protected user", 388, 389) { ModeHandler::list = true; @@ -230,15 +230,17 @@ class ModuleChanProtect : public Module ChanFounder cf; public: ModuleChanProtect() : cp(this), cf(this) + { + } + + void init() { /* Load config stuff */ LoadSettings(); settings.booting = false; - if (!ServerInstance->Modes->AddMode(&cp) || !ServerInstance->Modes->AddMode(&cf)) - { - throw ModuleException("Could not add new modes!"); - } + ServerInstance->Modules->AddService(cf); + ServerInstance->Modules->AddService(cp); Implementation eventlist[] = { I_OnUserPreJoin }; ServerInstance->Modules->Attach(eventlist, this, 1); @@ -259,14 +261,14 @@ class ModuleChanProtect : public Module if ((APrefix && QPrefix) && APrefix == QPrefix) throw ModuleException("What the smeg, why are both your +q and +a prefixes the same character?"); - if (ServerInstance->Modes->FindPrefix(APrefix) && ServerInstance->Modes->FindPrefix(APrefix) != &cp) - throw ModuleException("Looks like the +a prefix you picked for m_chanprotect is already in use. Pick another."); - - if (ServerInstance->Modes->FindPrefix(QPrefix) && ServerInstance->Modes->FindPrefix(QPrefix) != &cf) - throw ModuleException("Looks like the +q prefix you picked for m_chanprotect is already in use. Pick another."); - if (settings.booting) { + if (APrefix && ServerInstance->Modes->FindPrefix(APrefix) && ServerInstance->Modes->FindPrefix(APrefix) != &cp) + throw ModuleException("Looks like the +a prefix you picked for m_chanprotect is already in use. Pick another."); + + if (QPrefix && ServerInstance->Modes->FindPrefix(QPrefix) && ServerInstance->Modes->FindPrefix(QPrefix) != &cf) + throw ModuleException("Looks like the +q prefix you picked for m_chanprotect is already in use. Pick another."); + cp.setPrefix(APrefix); cf.setPrefix(QPrefix); }