1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 /* $ModDesc: Provides support for unreal-style channel mode +Q */
18 class NoKicks : public SimpleChannelModeHandler
21 NoKicks(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'Q') { }
24 class ModuleNoKicks : public Module
29 ModuleNoKicks(InspIRCd* Me)
30 : Module(Me), nk(Me, this)
32 if (!ServerInstance->Modes->AddMode(&nk))
33 throw ModuleException("Could not add new modes!");
34 Implementation eventlist[] = { I_OnAccessCheck, I_On005Numeric };
35 ServerInstance->Modules->Attach(eventlist, this, 2);
38 virtual void On005Numeric(std::string &output)
40 ServerInstance->AddExtBanChar('Q');
43 virtual int OnAccessCheck(User* source,User* dest,Channel* channel,int access_type)
45 if (access_type == AC_KICK)
47 if (channel->IsModeSet('Q') || channel->GetExtBanStatus(source, 'Q') < 0)
49 if ((ServerInstance->ULine(source->nick.c_str())) || (ServerInstance->ULine(source->server)) || (!*source->server))
51 // ulines can still kick with +Q in place
56 // nobody else can (not even opers with override, and founders)
57 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());
65 virtual ~ModuleNoKicks()
67 ServerInstance->Modes->DelMode(&nk);
70 virtual Version GetVersion()
72 return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
77 MODULE_INIT(ModuleNoKicks)