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 umode +B */
28 class BotMode : public ModeHandler
31 BotMode() : ModeHandler('B', 0, 0, false, MODETYPE_USER, false) { }
33 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
35 /* Only opers can change other users modes */
36 if ((source != dest) && (!*source->oper))
37 return MODEACTION_DENY;
41 if (!dest->IsModeSet('B'))
43 dest->SetMode('B',true);
44 return MODEACTION_ALLOW;
49 if (dest->IsModeSet('B'))
51 dest->SetMode('B',false);
52 return MODEACTION_ALLOW;
56 return MODEACTION_DENY;
60 class ModuleBotMode : public Module
65 ModuleBotMode(Server* Me)
70 Srv->AddMode(bm, 'B');
73 void Implements(char* List)
78 virtual ~ModuleBotMode()
83 virtual Version GetVersion()
85 return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
88 virtual void OnWhois(userrec* src, userrec* dst)
90 if (dst->IsModeSet('B'))
92 Srv->SendTo(NULL,src,"335 "+std::string(src->nick)+" "+std::string(dst->nick)+" :is a \2bot\2 on "+Srv->GetNetworkName());
98 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
100 class ModuleBotModeFactory : public ModuleFactory
103 ModuleBotModeFactory()
107 ~ModuleBotModeFactory()
111 virtual Module * CreateModule(Server* Me)
113 return new ModuleBotMode(Me);
119 extern "C" void * init_module( void )
121 return new ModuleBotModeFactory;