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;
51 return MODEACTION_DENY;
55 class ModuleBotMode : public Module
60 ModuleBotMode(Server* Me)
65 Srv->AddMode(bm, 'B');
68 void Implements(char* List)
73 virtual ~ModuleBotMode()
78 virtual Version GetVersion()
80 return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
83 virtual void OnWhois(userrec* src, userrec* dst)
85 if (dst->IsModeSet('B'))
87 Srv->SendTo(NULL,src,"335 "+std::string(src->nick)+" "+std::string(dst->nick)+" :is a \2bot\2 on "+Srv->GetNetworkName());
93 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
95 class ModuleBotModeFactory : public ModuleFactory
98 ModuleBotModeFactory()
102 ~ModuleBotModeFactory()
106 virtual Module * CreateModule(Server* Me)
108 return new ModuleBotMode(Me);
114 extern "C" void * init_module( void )
116 return new ModuleBotModeFactory;