]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_operinvex.cpp
a32f39176b4d846df4c14c958cc33e4029c895bb
[user/henk/code/inspircd.git] / src / modules / m_operinvex.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 #include "u_listmode.h"
16
17 /* $ModDep: ../../include/u_listmode.h */
18
19 /* $ModDesc: Implements extban/invex +I O: - opertype bans */
20
21 class ModuleOperInvex : public Module
22 {
23  private:
24  public:
25         ModuleOperInvex(InspIRCd* Me) : Module(Me)
26         {
27                 Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric };
28                 ServerInstance->Modules->Attach(eventlist, this, 2);
29         }
30
31         ~ModuleOperInvex()
32         {
33         }
34
35         Version GetVersion()
36         {
37                 return Version("ExtBan 'O' - oper type ban", VF_COMMON|VF_VENDOR);
38         }
39
40         ModResult OnCheckBan(User *user, Channel *c, const std::string& mask)
41         {
42                 if (mask[0] == 'O' && mask[1] == ':')
43                 {
44                         if (IS_OPER(user) && InspIRCd::Match(user->oper, mask.substr(2)))
45                                 return MOD_RES_DENY;
46                 }
47                 return MOD_RES_PASSTHRU;
48         }
49
50         virtual void On005Numeric(std::string &output)
51         {
52                 ServerInstance->AddExtBanChar('O');
53         }
54 };
55
56
57 MODULE_INIT(ModuleOperInvex)
58