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)
37 if (!dest->IsModeSet('B'))
39 dest->SetMode('B',true);
40 return MODEACTION_ALLOW;
45 if (dest->IsModeSet('B'))
47 dest->SetMode('B',false);
48 return MODEACTION_ALLOW;
52 return MODEACTION_DENY;
56 class ModuleBotMode : public Module
61 ModuleBotMode(Server* Me)
66 Srv->AddMode(bm, 'B');
69 void Implements(char* List)
74 virtual ~ModuleBotMode()
79 virtual Version GetVersion()
81 return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
84 virtual void OnWhois(userrec* src, userrec* dst)
86 if (dst->IsModeSet('B'))
88 Srv->SendTo(NULL,src,"335 "+std::string(src->nick)+" "+std::string(dst->nick)+" :is a \2bot\2 on "+Srv->GetNetworkName());
94 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
96 class ModuleBotModeFactory : public ModuleFactory
99 ModuleBotModeFactory()
103 ~ModuleBotModeFactory()
107 virtual Module * CreateModule(Server* Me)
109 return new ModuleBotMode(Me);
115 extern "C" void * init_module( void )
117 return new ModuleBotModeFactory;