]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_nopartmsg.cpp
648626a2392929ca808814df0305e834e90f71a2
[user/henk/code/inspircd.git] / src / modules / m_nopartmsg.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/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: Implements extban +b p: - part message bans */
17
18 class ModulePartMsgBan : public Module
19 {
20  private:
21  public:
22         ModulePartMsgBan(InspIRCd* Me) : Module(Me)
23         {
24                 Implementation eventlist[] = { I_OnUserPart, I_On005Numeric };
25                 ServerInstance->Modules->Attach(eventlist, this, 2);
26         }
27
28         virtual ~ModulePartMsgBan()
29         {
30         }
31
32         virtual Version GetVersion()
33         {
34                 return Version(1,2,0,0,VF_VENDOR,API_VERSION);
35         }
36
37
38     virtual void OnUserPart(User* user, Channel* channel, const std::string &partmessage, bool &silent)
39         {
40                 if (!IS_LOCAL(user))
41                         return;
42
43 #if 0
44                 if (channel->IsExtBanned(user, 'p'))
45                         partmessage = "";
46 #endif
47
48                 return;
49         }
50
51         virtual void On005Numeric(std::string &output)
52         {
53                 if (output.find(" EXTBAN=:") == std::string::npos)
54                         output.append(" EXTBAN=:p");
55                 else
56                         output.insert(output.find(" EXTBAN=:") + 9, "p");
57         }
58 };
59
60
61 MODULE_INIT(ModulePartMsgBan)
62