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 * ---------------------------------------------------
24 #include "helperfuncs.h"
25 #include "configreader.h"
28 /* $ModDesc: Provides support for unreal-style umode +B */
30 extern InspIRCd* ServerInstance;
32 class BotMode : public ModeHandler
35 BotMode() : ModeHandler('B', 0, 0, false, MODETYPE_USER, false) { }
37 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
39 /* Only opers can change other users modes */
40 if ((source != dest) && (!*source->oper))
41 return MODEACTION_DENY;
45 if (!dest->IsModeSet('B'))
47 dest->SetMode('B',true);
48 return MODEACTION_ALLOW;
53 if (dest->IsModeSet('B'))
55 dest->SetMode('B',false);
56 return MODEACTION_ALLOW;
60 return MODEACTION_DENY;
64 class ModuleBotMode : public Module
69 ModuleBotMode(Server* Me)
74 Srv->AddMode(bm, 'B');
77 void Implements(char* List)
82 virtual ~ModuleBotMode()
87 virtual Version GetVersion()
89 return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
92 virtual void OnWhois(userrec* src, userrec* dst)
94 if (dst->IsModeSet('B'))
96 src->WriteServ("335 "+std::string(src->nick)+" "+std::string(dst->nick)+" :is a \2bot\2 on "+ServerInstance->Config->Network);
102 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
104 class ModuleBotModeFactory : public ModuleFactory
107 ModuleBotModeFactory()
111 ~ModuleBotModeFactory()
115 virtual Module * CreateModule(Server* Me)
117 return new ModuleBotMode(Me);
123 extern "C" void * init_module( void )
125 return new ModuleBotModeFactory;