1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
25 /* $ModDesc: Provides support for unreal-style channel mode +Q */
29 class NoKicks : public ModeHandler
32 NoKicks(InspIRCd* Instance) : ModeHandler(Instance, 'Q', 0, 0, false, MODETYPE_CHANNEL, false) { }
34 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
38 if (!channel->IsModeSet('Q'))
40 channel->SetMode('Q',true);
41 return MODEACTION_ALLOW;
46 if (channel->IsModeSet('Q'))
48 channel->SetMode('Q',false);
49 return MODEACTION_ALLOW;
53 return MODEACTION_DENY;
57 class ModuleNoKicks : public Module
64 ModuleNoKicks(InspIRCd* Me)
68 nk = new NoKicks(ServerInstance);
69 ServerInstance->AddMode(nk, 'Q');
72 void Implements(char* List)
74 List[I_OnAccessCheck] = 1;
77 virtual int OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type)
79 if (access_type == AC_KICK)
81 if (channel->IsModeSet('Q'))
83 if ((ServerInstance->ULine(source->nick)) || (ServerInstance->ULine(source->server)) || (!*source->server))
85 // ulines can still kick with +Q in place
90 // nobody else can (not even opers with override, and founders)
91 source->WriteServ("484 %s %s :Can't kick user %s from channel (+Q set)",source->nick, channel->name,dest->nick);
99 virtual ~ModuleNoKicks()
101 ServerInstance->Modes->DelMode(nk);
105 virtual Version GetVersion()
107 return Version(1,0,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
112 class ModuleNoKicksFactory : public ModuleFactory
115 ModuleNoKicksFactory()
119 ~ModuleNoKicksFactory()
123 virtual Module * CreateModule(InspIRCd* Me)
125 return new ModuleNoKicks(Me);
131 extern "C" void * init_module( void )
133 return new ModuleNoKicksFactory;