X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_nokicks.cpp;h=61ab868a5a08114d80202a84cc34960e90828fe0;hb=8be88f3e732e7a40f2e501c5e5b78c7f1b999f2d;hp=0692048f16c5d14c4c4d4131adf69b1c15237072;hpb=e21ee18e62aecee6d27a0f9ba497a52688cb8349;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index 0692048f1..61ab868a5 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -2,8 +2,8 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2008 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/Credits + * InspIRCd: (C) 2002-2009 InspIRCd Development Team + * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see * the file COPYING for details. @@ -15,60 +15,39 @@ /* $ModDesc: Provides support for unreal-style channel mode +Q */ -class NoKicks : public ModeHandler +class NoKicks : public SimpleChannelModeHandler { public: - NoKicks(InspIRCd* Instance) : ModeHandler(Instance, 'Q', 0, 0, false, MODETYPE_CHANNEL, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding) - { - if (!channel->IsModeSet('Q')) - { - channel->SetMode('Q',true); - return MODEACTION_ALLOW; - } - } - else - { - if (channel->IsModeSet('Q')) - { - channel->SetMode('Q',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; - } + NoKicks(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'Q') { } }; class ModuleNoKicks : public Module { - NoKicks* nk; - + public: - ModuleNoKicks(InspIRCd* Me) : Module(Me) { - nk = new NoKicks(ServerInstance); if (!ServerInstance->Modes->AddMode(nk)) throw ModuleException("Could not add new modes!"); - Implementation eventlist[] = { I_OnAccessCheck }; - ServerInstance->Modules->Attach(eventlist, this, 1); + Implementation eventlist[] = { I_OnAccessCheck, I_On005Numeric }; + ServerInstance->Modules->Attach(eventlist, this, 2); } + virtual void On005Numeric(std::string &output) + { + ServerInstance->AddExtBanChar('Q'); + } virtual int OnAccessCheck(User* source,User* dest,Channel* channel,int access_type) { if (access_type == AC_KICK) { - if (channel->IsModeSet('Q')) + if (channel->IsModeSet('Q') || channel->GetExtBanStatus(source, 'Q') < 0) { - if ((ServerInstance->ULine(source->nick)) || (ServerInstance->ULine(source->server)) || (!*source->server)) + if ((ServerInstance->ULine(source->nick.c_str())) || (ServerInstance->ULine(source->server)) || (!*source->server)) { // ulines can still kick with +Q in place return ACR_ALLOW; @@ -76,7 +55,7 @@ class ModuleNoKicks : public Module else { // nobody else can (not even opers with override, and founders) - source->WriteServ("484 %s %s :Can't kick user %s from channel (+Q set)",source->nick, channel->name,dest->nick); + source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Can't kick user %s from channel (+Q set)",source->nick.c_str(), channel->name.c_str(), dest->nick.c_str()); return ACR_DENY; } } @@ -89,10 +68,10 @@ class ModuleNoKicks : public Module ServerInstance->Modes->DelMode(nk); delete nk; } - + virtual Version GetVersion() { - return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION); + return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION); } };