]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_nopartmsg.cpp
Extbans can be VF_OPTCOMMON as they do not desync on module add/remove
[user/henk/code/inspircd.git] / src / modules / m_nopartmsg.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: Implements extban +b p: - part message bans */
17
18 class ModulePartMsgBan : public Module
19 {
20  private:
21  public:
22         ModulePartMsgBan()
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("Implements extban +b p: - part message bans", VF_OPTCOMMON|VF_VENDOR);
35         }
36
37
38         virtual void OnUserPart(Membership* memb, std::string &partmessage, CUList& excepts)
39         {
40                 if (!IS_LOCAL(memb->user))
41                         return;
42
43                 if (memb->chan->GetExtBanStatus(memb->user, 'p') == MOD_RES_DENY)
44                         partmessage = "";
45
46                 return;
47         }
48
49         virtual void On005Numeric(std::string &output)
50         {
51                 ServerInstance->AddExtBanChar('p');
52         }
53 };
54
55
56 MODULE_INIT(ModulePartMsgBan)
57