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