1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * Inspire is copyright (C) 2002-2004 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 * ---------------------------------------------------
23 #include "helperfuncs.h"
25 /* $ModDesc: Provides support for unreal-style channel mode +Q */
27 class ModuleNoKicks : public Module
33 ModuleNoKicks(Server* Me)
37 Srv->AddExtendedMode('Q',MT_CHANNEL,false,0,0);
40 virtual void On005Numeric(std::string &output)
42 std::stringstream line(output);
43 std::string temp1, temp2;
47 if (temp1.substr(0,10) == "CHANMODES=")
49 // append the chanmode to the end
50 temp1 = temp1.substr(10,temp1.length());
51 temp1 = "CHANMODES=" + temp1 + "Q";
53 temp2 = temp2 + temp1 + " ";
56 output = temp2.substr(0,temp2.length()-1);
59 virtual int OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type)
61 if (access_type == AC_KICK)
63 if (channel->IsCustomModeSet('Q'))
65 if ((Srv->IsUlined(source->nick)) || (Srv->IsUlined(source->server)) || (!strcmp(source->server,"")))
67 // ulines can still kick with +Q in place
72 // nobody else can (not even opers with override, and founders)
73 WriteServ(source->fd,"484 %s %s :Can't kick user %s from channel (+Q set)",source->nick, channel->name,dest->nick);
81 virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms)
83 // check if this is our mode character...
84 if ((modechar == 'Q') && (type == MT_CHANNEL))
94 virtual ~ModuleNoKicks()
98 virtual Version GetVersion()
100 return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
105 class ModuleNoKicksFactory : public ModuleFactory
108 ModuleNoKicksFactory()
112 ~ModuleNoKicksFactory()
116 virtual Module * CreateModule(Server* Me)
118 return new ModuleNoKicks(Me);
124 extern "C" void * init_module( void )
126 return new ModuleNoKicksFactory;