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 * ---------------------------------------------------
25 /* $ModDesc: Provides support for unreal-style umode +B */
27 class BotMode : public ModeHandler
30 BotMode() : ModeHandler('B', 0, 0, false, MODETYPE_USER, false) { }
32 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
36 if (!dest->IsModeSet('B'))
38 dest->SetMode('B',true);
39 return MODEACTION_ALLOW;
44 if (dest->IsModeSet('B'))
46 dest->SetMode('B',false);
47 return MODEACTION_ALLOW;
53 class ModuleBotMode : public Module
58 ModuleBotMode(Server* Me)
63 Srv->AddMode(bm, 'B');
66 void Implements(char* List)
71 virtual ~ModuleBotMode()
75 virtual Version GetVersion()
77 return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
80 virtual void OnWhois(userrec* src, userrec* dst)
82 if (dst->IsModeSet('B'))
84 Srv->SendTo(NULL,src,"335 "+std::string(src->nick)+" "+std::string(dst->nick)+" :is a \2bot\2 on "+Srv->GetNetworkName());
90 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
92 class ModuleBotModeFactory : public ModuleFactory
95 ModuleBotModeFactory()
99 ~ModuleBotModeFactory()
103 virtual Module * CreateModule(Server* Me)
105 return new ModuleBotMode(Me);
111 extern "C" void * init_module( void )
113 return new ModuleBotModeFactory;