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 * ---------------------------------------------------
26 /* $ModDesc: Provides support for unreal-style channel mode +Q */
30 class NoKicks : public ModeHandler
33 NoKicks(InspIRCd* Instance) : ModeHandler(Instance, 'Q', 0, 0, false, MODETYPE_CHANNEL, false) { }
35 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
39 if (!channel->IsModeSet('Q'))
41 channel->SetMode('Q',true);
42 return MODEACTION_ALLOW;
47 if (channel->IsModeSet('Q'))
49 channel->SetMode('Q',false);
50 return MODEACTION_ALLOW;
54 return MODEACTION_DENY;
58 class ModuleNoKicks : public Module
65 ModuleNoKicks(InspIRCd* Me)
69 nk = new NoKicks(ServerInstance);
70 ServerInstance->AddMode(nk, 'Q');
73 void Implements(char* List)
75 List[I_On005Numeric] = List[I_OnAccessCheck] = 1;
78 virtual void On005Numeric(std::string &output)
80 ServerInstance->Modes->InsertMode(output,"Q",4);
83 virtual int OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type)
85 if (access_type == AC_KICK)
87 if (channel->IsModeSet('Q'))
89 if ((ServerInstance->ULine(source->nick)) || (ServerInstance->ULine(source->server)) || (!*source->server))
91 // ulines can still kick with +Q in place
96 // nobody else can (not even opers with override, and founders)
97 source->WriteServ("484 %s %s :Can't kick user %s from channel (+Q set)",source->nick, channel->name,dest->nick);
105 virtual ~ModuleNoKicks()
110 virtual Version GetVersion()
112 return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
117 class ModuleNoKicksFactory : public ModuleFactory
120 ModuleNoKicksFactory()
124 ~ModuleNoKicksFactory()
128 virtual Module * CreateModule(InspIRCd* Me)
130 return new ModuleNoKicks(Me);
136 extern "C" void * init_module( void )
138 return new ModuleNoKicksFactory;