]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_botmode.cpp
Remove InspIRCd* parameters and fields
[user/henk/code/inspircd.git] / src / modules / m_botmode.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2009 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, '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                 ServerInstance->Modes->DelMode(&bm);
43         }
44
45         virtual Version GetVersion()
46         {
47                 return Version("Provides support for unreal-style umode +B",VF_COMMON|VF_VENDOR,API_VERSION);
48         }
49
50         virtual void OnWhois(User* src, User* dst)
51         {
52                 if (dst->IsModeSet('B'))
53                 {
54                         ServerInstance->SendWhoisLine(src, dst, 335, std::string(src->nick)+" "+std::string(dst->nick)+" :is a bot on "+ServerInstance->Config->Network);
55                 }
56         }
57
58 };
59
60
61 MODULE_INIT(ModuleBotMode)