]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_serverban.cpp
Extbans can be VF_OPTCOMMON as they do not desync on module add/remove
[user/henk/code/inspircd.git] / src / modules / m_serverban.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 s: - server name bans */
17
18 class ModuleServerBan : public Module
19 {
20  private:
21  public:
22         ModuleServerBan()       {
23                 Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric };
24                 ServerInstance->Modules->Attach(eventlist, this, 2);
25         }
26
27         ~ModuleServerBan()
28         {
29         }
30
31         Version GetVersion()
32         {
33                 return Version("Extban 's' - server ban",VF_OPTCOMMON|VF_VENDOR);
34         }
35
36         ModResult OnCheckBan(User *user, Channel *c, const std::string& mask)
37         {
38                 if (mask[0] == 's' && mask[1] == ':')
39                 {
40                         if (InspIRCd::Match(user->server, mask.substr(2)))
41                                 return MOD_RES_DENY;
42                 }
43                 return MOD_RES_PASSTHRU;
44         }
45
46         void On005Numeric(std::string &output)
47         {
48                 ServerInstance->AddExtBanChar('s');
49         }
50 };
51
52
53 MODULE_INIT(ModuleServerBan)
54