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(User* source, User* dest, Channel* 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))
59 throw ModuleException("Could not add new modes!");
60 Implementation eventlist[] = { I_OnAccessCheck };
61 ServerInstance->Modules->Attach(eventlist, this, 1);
64 void Implements(char* List)
66 List[I_OnAccessCheck] = 1;
69 virtual int OnAccessCheck(User* source,User* dest,Channel* channel,int access_type)
71 if (access_type == AC_KICK)
73 if (channel->IsModeSet('Q'))
75 if ((ServerInstance->ULine(source->nick)) || (ServerInstance->ULine(source->server)) || (!*source->server))
77 // ulines can still kick with +Q in place
82 // nobody else can (not even opers with override, and founders)
83 source->WriteServ("484 %s %s :Can't kick user %s from channel (+Q set)",source->nick, channel->name,dest->nick);
91 virtual ~ModuleNoKicks()
93 ServerInstance->Modes->DelMode(nk);
97 virtual Version GetVersion()
99 return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
104 MODULE_INIT(ModuleNoKicks)