]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spy.cpp
fixed some indentation and spacing in modules
[user/henk/code/inspircd.git] / src / modules / m_spy.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 /* $ModDesc: Provides the ability to see the complete names list of channels an oper is not a member of */
15
16 #include "inspircd.h"
17 #include "wildcard.h"
18
19 class ModuleSpy : public Module
20 {
21  public:
22         ModuleSpy(InspIRCd* Me) : Module(Me)
23         {
24                 ServerInstance->Modules->Attach(I_OnUserList, this);
25         }
26
27         virtual int OnUserList(User* user, Channel* Ptr, CUList* &nameslist)
28         {
29                 /* User is an oper and is NOT on the channel */
30                 if (IS_OPER(user) && !Ptr->HasUser(user))
31                         return -1;
32
33                 return 0;
34         }
35
36         void Prioritize()
37         {
38                 /* To ensure that we get priority over namesx and delayjoin for names list generation */
39                 Module* list[] = { ServerInstance->Modules->Find("m_namesx.so"), ServerInstance->Modules->Find("m_delayjoin.so") };
40                 ServerInstance->Modules->SetPriority(this, I_OnUserList, PRIO_BEFORE, list, 2);
41         }
42
43         virtual ~ModuleSpy()
44         {
45         }
46
47         virtual Version GetVersion()
48         {
49                 return Version(1, 2, 0, 0, VF_VENDOR, API_VERSION);
50         }
51 };
52
53 MODULE_INIT(ModuleSpy)
54