1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
20 #include "configreader.h"
22 /* $ModDesc: Provides support for unreal-style umode +B */
24 /** Handles user mode +B
26 class BotMode : public ModeHandler
29 BotMode(InspIRCd* Instance) : ModeHandler(Instance, 'B', 0, 0, false, MODETYPE_USER, false) { }
31 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
35 if (!dest->IsModeSet('B'))
37 dest->SetMode('B',true);
38 return MODEACTION_ALLOW;
43 if (dest->IsModeSet('B'))
45 dest->SetMode('B',false);
46 return MODEACTION_ALLOW;
50 return MODEACTION_DENY;
54 class ModuleBotMode : public Module
59 ModuleBotMode(InspIRCd* Me)
63 bm = new BotMode(ServerInstance);
64 if (!ServerInstance->AddMode(bm, 'B'))
65 throw ModuleException("Could not add new modes!");
68 void Implements(char* List)
73 virtual ~ModuleBotMode()
75 ServerInstance->Modes->DelMode(bm);
79 virtual Version GetVersion()
81 return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
84 virtual void OnWhois(userrec* src, userrec* dst)
86 if (dst->IsModeSet('B'))
88 ServerInstance->SendWhoisLine(src, dst, 335, std::string(src->nick)+" "+std::string(dst->nick)+" :is a bot on "+ServerInstance->Config->Network);
95 MODULE_INIT(ModuleBotMode);