1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
20 /* $ModDesc: Provides support for unreal-style channel mode +Q */
24 class NoKicks : public ModeHandler
27 NoKicks(InspIRCd* Instance) : ModeHandler(Instance, 'Q', 0, 0, false, MODETYPE_CHANNEL, false) { }
29 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
33 if (!channel->IsModeSet('Q'))
35 channel->SetMode('Q',true);
36 return MODEACTION_ALLOW;
41 if (channel->IsModeSet('Q'))
43 channel->SetMode('Q',false);
44 return MODEACTION_ALLOW;
48 return MODEACTION_DENY;
52 class ModuleNoKicks : public Module
59 ModuleNoKicks(InspIRCd* Me)
63 nk = new NoKicks(ServerInstance);
64 if (!ServerInstance->AddMode(nk, 'Q'))
65 throw ModuleException("Could not add new modes!");
68 void Implements(char* List)
70 List[I_OnAccessCheck] = 1;
73 virtual int OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type)
75 if (access_type == AC_KICK)
77 if (channel->IsModeSet('Q'))
79 if ((ServerInstance->ULine(source->nick)) || (ServerInstance->ULine(source->server)) || (!*source->server))
81 // ulines can still kick with +Q in place
86 // nobody else can (not even opers with override, and founders)
87 source->WriteServ("484 %s %s :Can't kick user %s from channel (+Q set)",source->nick, channel->name,dest->nick);
95 virtual ~ModuleNoKicks()
97 ServerInstance->Modes->DelMode(nk);
101 virtual Version GetVersion()
103 return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
108 class ModuleNoKicksFactory : public ModuleFactory
111 ModuleNoKicksFactory()
115 ~ModuleNoKicksFactory()
119 virtual Module * CreateModule(InspIRCd* Me)
121 return new ModuleNoKicks(Me);
127 extern "C" void * init_module( void )
129 return new ModuleNoKicksFactory;