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 * ---------------------------------------------------
19 /* $ModDesc: Provides support for unreal-style channel mode +Q */
21 class NoKicks : public ModeHandler
24 NoKicks(InspIRCd* Instance) : ModeHandler(Instance, 'Q', 0, 0, false, MODETYPE_CHANNEL, false) { }
26 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
30 if (!channel->IsModeSet('Q'))
32 channel->SetMode('Q',true);
33 return MODEACTION_ALLOW;
38 if (channel->IsModeSet('Q'))
40 channel->SetMode('Q',false);
41 return MODEACTION_ALLOW;
45 return MODEACTION_DENY;
49 class ModuleNoKicks : public Module
56 ModuleNoKicks(InspIRCd* Me)
60 nk = new NoKicks(ServerInstance);
61 if (!ServerInstance->AddMode(nk, 'Q'))
62 throw ModuleException("Could not add new modes!");
65 void Implements(char* List)
67 List[I_OnAccessCheck] = 1;
70 virtual int OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type)
72 if (access_type == AC_KICK)
74 if (channel->IsModeSet('Q'))
76 if ((ServerInstance->ULine(source->nick)) || (ServerInstance->ULine(source->server)) || (!*source->server))
78 // ulines can still kick with +Q in place
83 // nobody else can (not even opers with override, and founders)
84 source->WriteServ("484 %s %s :Can't kick user %s from channel (+Q set)",source->nick, channel->name,dest->nick);
92 virtual ~ModuleNoKicks()
94 ServerInstance->Modes->DelMode(nk);
98 virtual Version GetVersion()
100 return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
105 MODULE_INIT(ModuleNoKicks);