]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_botmode.cpp
...because every now and again, i have to do a massive commit.
[user/henk/code/inspircd.git] / src / modules / m_botmode.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
6  * See: http://wiki.inspircd.org/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #include "inspircd.h"
15
16 /* $ModDesc: Provides support for unreal-style umode +B */
17
18 /** Handles user mode +B
19  */
20 class BotMode : public SimpleUserModeHandler
21 {
22  public:
23         BotMode(Module* Creator) : SimpleUserModeHandler(Creator, "bot", 'B') { }
24 };
25
26 class ModuleBotMode : public Module
27 {
28         BotMode bm;
29  public:
30         ModuleBotMode()
31                 : bm(this)
32         {
33                 if (!ServerInstance->Modes->AddMode(&bm))
34                         throw ModuleException("Could not add new modes!");
35                 Implementation eventlist[] = { I_OnWhois };
36                 ServerInstance->Modules->Attach(eventlist, this, 1);
37         }
38
39
40         virtual ~ModuleBotMode()
41         {
42         }
43
44         virtual Version GetVersion()
45         {
46                 return Version("Provides support for unreal-style umode +B",VF_COMMON|VF_VENDOR);
47         }
48
49         virtual void OnWhois(User* src, User* dst)
50         {
51                 if (dst->IsModeSet('B'))
52                 {
53                         ServerInstance->SendWhoisLine(src, dst, 335, std::string(src->nick)+" "+std::string(dst->nick)+" :is a bot on "+ServerInstance->Config->Network);
54                 }
55         }
56
57 };
58
59
60 MODULE_INIT(ModuleBotMode)