X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_cloaking.cpp;h=8422abd43792d519fc70623427c6181b6268a3c2;hb=f51d9ad5ab7015f78a29039ca7ed169b281ff6bb;hp=753c8be4b64b4c55239707e85c0f805508b055b5;hpb=7240c926c8e9aeacf95c2bd4803c8879963cca3f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 753c8be4b..8422abd43 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * InspIRCd: (C) 2002-2008 InspIRCd Development Team * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see @@ -78,6 +78,9 @@ class CloakUser : public ModeHandler if (!IS_LOCAL(dest)) return MODEACTION_ALLOW; + /* don't allow this user to spam modechanges */ + dest->IncreasePenalty(5); + if (adding) { if(!dest->IsModeSet('x')) @@ -106,7 +109,7 @@ class CloakUser : public ModeHandler * 'real' hostname which you shouldnt write to. */ - /* 2007/08/18: add which always cloaks + /* 2008/08/18: add which always cloaks * the IP, for anonymity. --nenolod */ if (!ipalways) @@ -316,27 +319,40 @@ class ModuleCloaking : public Module ModuleCloaking(InspIRCd* Me) : Module(Me) { - ServerInstance->Modules->UseInterface("HashRequest"); - /* Attempt to locate the md5 service provider, bail if we can't find it */ HashModule = ServerInstance->Modules->Find("m_md5.so"); if (!HashModule) throw ModuleException("Can't find m_md5.so. Please load m_md5.so before m_cloaking.so."); - /* Create new mode handler object */ cu = new CloakUser(ServerInstance, this, HashModule); - /* Register it with the core */ - if (!ServerInstance->AddMode(cu)) + try + { + OnRehash(NULL,""); + } + catch (CoreException &e) + { + delete cu; + throw e; + } + + /* Register it with the core */ + if (!ServerInstance->Modes->AddMode(cu)) + { + delete cu; throw ModuleException("Could not add new modes!"); + } - OnRehash(NULL,""); + ServerInstance->Modules->UseInterface("HashRequest"); + + Implementation eventlist[] = { I_OnRehash }; + ServerInstance->Modules->Attach(eventlist, this, 1); } virtual ~ModuleCloaking() { ServerInstance->Modes->DelMode(cu); - DELETE(cu); + delete cu; ServerInstance->Modules->DoneWithInterface("HashRequest"); } @@ -352,10 +368,6 @@ class ModuleCloaking : public Module cu->DoRehash(); } - void Implements(char* List) - { - List[I_OnRehash] = 1; - } }; MODULE_INIT(ModuleCloaking)