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 * ---------------------------------------------------
16 /* $ModDesc: Provides support for unreal-style channel mode +Q */
18 class NoKicks : public ModeHandler
21 NoKicks(InspIRCd* Instance) : ModeHandler(Instance, 'Q', 0, 0, false, MODETYPE_CHANNEL, false) { }
23 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
27 if (!channel->IsModeSet('Q'))
29 channel->SetMode('Q',true);
30 return MODEACTION_ALLOW;
35 if (channel->IsModeSet('Q'))
37 channel->SetMode('Q',false);
38 return MODEACTION_ALLOW;
42 return MODEACTION_DENY;
46 class ModuleNoKicks : public Module
53 ModuleNoKicks(InspIRCd* Me)
57 nk = new NoKicks(ServerInstance);
58 if (!ServerInstance->AddMode(nk, 'Q'))
59 throw ModuleException("Could not add new modes!");
62 void Implements(char* List)
64 List[I_OnAccessCheck] = 1;
67 virtual int OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type)
69 if (access_type == AC_KICK)
71 if (channel->IsModeSet('Q'))
73 if ((ServerInstance->ULine(source->nick)) || (ServerInstance->ULine(source->server)) || (!*source->server))
75 // ulines can still kick with +Q in place
80 // nobody else can (not even opers with override, and founders)
81 source->WriteServ("484 %s %s :Can't kick user %s from channel (+Q set)",source->nick, channel->name,dest->nick);
89 virtual ~ModuleNoKicks()
91 ServerInstance->Modes->DelMode(nk);
95 virtual Version GetVersion()
97 return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
102 MODULE_INIT(ModuleNoKicks)