X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_chanprotect.cpp;h=060f81eb9add0d68962ff38b67383d78456ca091;hb=124bc04e841f9ca527b99c37563f19a85dec63fc;hp=fff16217852c5a0ae1b5913dda8d231cd77c82ec;hpb=afdf3e40768ba4c4c33b084b92cdcff335b94bbc;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index fff162178..060f81eb9 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -20,6 +20,7 @@ #include "inspircd.h" /* $ModDesc: Provides channel modes +a and +q */ +/* $ModDep: ../../include/u_listmode.h */ #define PROTECT_VALUE 40000 #define FOUNDER_VALUE 50000 @@ -277,6 +278,7 @@ class ModuleChanProtect : public Module bool FirstInGetsFounder; bool QAPrefixes; + bool booting; ChanProtect* cp; ChanFounder* cf; char* dummyptr; @@ -286,7 +288,9 @@ class ModuleChanProtect : public Module ModuleChanProtect(InspIRCd* Me) : Module::Module(Me) { /* Load config stuff */ + booting = true; OnRehash(""); + booting = false; /* Initialise module variables */ @@ -324,9 +328,28 @@ class ModuleChanProtect : public Module * stack-allocate it locally. */ ConfigReader Conf(ServerInstance); + + bool old_qa = QAPrefixes; FirstInGetsFounder = Conf.ReadFlag("options","noservices",0); QAPrefixes = Conf.ReadFlag("options","qaprefixes",0); + + /* 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_qa != QAPrefixes) && (!booting)) + { + ServerInstance->Modes->DelMode(cp); + ServerInstance->Modes->DelMode(cf); + DELETE(cp); + DELETE(cf); + cp = new ChanProtect(ServerInstance,QAPrefixes); + cf = new ChanFounder(ServerInstance,QAPrefixes); + ServerInstance->AddMode(cp, 'a'); + ServerInstance->AddMode(cf, 'q'); + ServerInstance->WriteOpers("*** WARNING: +qa prefixes were enabled or disabled via a REHASH. Clients will probably need to reconnect to pick up this change."); + } } virtual void OnUserJoin(userrec* user, chanrec* channel)