]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_gecosban.cpp
0a868d347b0fb618f7963b72cdefdf0f2ac4dcb2
[user/henk/code/inspircd.git] / src / modules / m_gecosban.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: Implements extban +b r: - realname (gecos) bans */
17
18 class ModuleGecosBan : public Module
19 {
20  private:
21  public:
22         ModuleGecosBan(InspIRCd* Me) : Module(Me)
23         {
24                 Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric };
25                 ServerInstance->Modules->Attach(eventlist, this, 2);
26         }
27
28         ~ModuleGecosBan()
29         {
30         }
31
32         Version GetVersion()
33         {
34                 return Version("Extban 'r' - realname (gecos) ban", VF_COMMON|VF_VENDOR);
35         }
36
37         ModResult OnCheckBan(User *user, Channel *c, const std::string& mask)
38         {
39                 if (mask[0] == 'r' && mask[1] == ':')
40                 {
41                         if (InspIRCd::Match(user->fullname, mask.substr(2)))
42                                 return MOD_RES_DENY;
43                 }
44                 return MOD_RES_PASSTHRU;
45         }
46
47         void On005Numeric(std::string &output)
48         {
49                 ServerInstance->AddExtBanChar('r');
50         }
51 };
52
53
54 MODULE_INIT(ModuleGecosBan)
55