X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_censor.cpp;h=b4746d93660beeb2e6583c38b9f4a406cdaa82a8;hb=89fc6ca9c66198fe54cce19d59279cd454fc1bd0;hp=e29b10194a4325b52cf3302dc1492a8b71f728ca;hpb=53afaa7cadcdf222dcf761441727305f79b4c557;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index e29b10194..b4746d936 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.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 @@ -27,7 +27,7 @@ class CensorUser : public ModeHandler public: CensorUser(InspIRCd* Instance) : ModeHandler(Instance, 'G', 0, 0, false, MODETYPE_USER, false) { } - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) + ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { if (adding) { @@ -57,7 +57,7 @@ class CensorChannel : public ModeHandler public: CensorChannel(InspIRCd* Instance) : ModeHandler(Instance, 'G', 0, 0, false, MODETYPE_CHANNEL, false) { } - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) + ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { if (adding) { @@ -76,7 +76,7 @@ class CensorChannel : public ModeHandler } } - return MODEACTION_ALLOW; + return MODEACTION_DENY; } }; @@ -97,8 +97,12 @@ class ModuleCensor : public Module OnRehash(NULL,""); cu = new CensorUser(ServerInstance); cc = new CensorChannel(ServerInstance); - if (!ServerInstance->AddMode(cu) || !ServerInstance->AddMode(cc)) + if (!ServerInstance->Modes->AddMode(cu) || !ServerInstance->Modes->AddMode(cc)) + { + delete cu; + delete cc; throw ModuleException("Could not add new modes!"); + } Implementation eventlist[] = { I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice }; ServerInstance->Modules->Attach(eventlist, this, 3); } @@ -136,7 +140,14 @@ class ModuleCensor : public Module if (target_type == TYPE_USER) active = ((User*)dest)->IsModeSet('G'); else if (target_type == TYPE_CHANNEL) + { active = ((Channel*)dest)->IsModeSet('G'); + Channel* c = (Channel*)dest; + if (CHANOPS_EXEMPT(ServerInstance, 'G') && c->GetStatus(user) == STATUS_OP) + { + return 0; + } + } if (!active) return 0; @@ -148,7 +159,7 @@ class ModuleCensor : public Module { if (index->second.empty()) { - user->WriteServ("936 %s %s %s :Your message contained a censored word, and was blocked", user->nick, ((Channel*)dest)->name, index->first.c_str()); + user->WriteNumeric(936, "%s %s %s :Your message contained a censored word, and was blocked", user->nick, ((Channel*)dest)->name, index->first.c_str()); return 1; } @@ -185,7 +196,7 @@ class ModuleCensor : public Module virtual Version GetVersion() { - return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION); + return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION); } };