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 * ---------------------------------------------------
16 /* $ModDesc: Provides support for unreal-style umode +B */
18 /** Handles user mode +B
20 class BotMode : public ModeHandler
23 BotMode(InspIRCd* Instance) : ModeHandler(Instance, 'B', 0, 0, false, MODETYPE_USER, false) { }
25 ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
29 if (!dest->IsModeSet('B'))
31 dest->SetMode('B',true);
32 return MODEACTION_ALLOW;
37 if (dest->IsModeSet('B'))
39 dest->SetMode('B',false);
40 return MODEACTION_ALLOW;
44 return MODEACTION_DENY;
48 class ModuleBotMode : public Module
53 ModuleBotMode(InspIRCd* Me)
57 bm = new BotMode(ServerInstance);
58 if (!ServerInstance->AddMode(bm))
59 throw ModuleException("Could not add new modes!");
60 Implementation eventlist[] = { I_OnWhois };
61 ServerInstance->Modules->Attach(eventlist, this, 1);
64 void Implements(char* List)
69 virtual ~ModuleBotMode()
71 ServerInstance->Modes->DelMode(bm);
75 virtual Version GetVersion()
77 return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
80 virtual void OnWhois(User* src, User* dst)
82 if (dst->IsModeSet('B'))
84 ServerInstance->SendWhoisLine(src, dst, 335, std::string(src->nick)+" "+std::string(dst->nick)+" :is a bot on "+ServerInstance->Config->Network);
91 MODULE_INIT(ModuleBotMode)