The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

m_spy.cpp

Go to the documentation of this file.
00001 /*       +------------------------------------+
00002  *       | Inspire Internet Relay Chat Daemon |
00003  *       +------------------------------------+
00004  *
00005  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
00006  * See: http://www.inspircd.org/wiki/index.php/Credits
00007  *
00008  * This program is free but copyrighted software; see
00009  *          the file COPYING for details.
00010  *
00011  * ---------------------------------------------------
00012  */
00013 
00014 /* $ModDesc: Provides the ability to see the complete names list of channels an oper is not a member of */
00015 
00016 #include "inspircd.h"
00017 
00018 class ModuleSpy : public Module
00019 {
00020  public:
00021         ModuleSpy(InspIRCd* Me) : Module(Me)
00022         {
00023                 ServerInstance->Modules->Attach(I_OnUserList, this);
00024         }
00025 
00026         virtual int OnUserList(User* user, Channel* Ptr, CUList* &nameslist)
00027         {
00028                 /* User has priv and is NOT on the channel */
00029                 if (user->HasPrivPermission("channels/auspex") && !Ptr->HasUser(user))
00030                         return -1;
00031 
00032                 return 0;
00033         }
00034 
00035         void Prioritize()
00036         {
00037                 /* To ensure that we get priority over namesx and delayjoin for names list generation */
00038                 Module* list[] = { ServerInstance->Modules->Find("m_namesx.so"), ServerInstance->Modules->Find("m_delayjoin.so") };
00039                 ServerInstance->Modules->SetPriority(this, I_OnUserList, PRIO_BEFORE, list, 2);
00040         }
00041 
00042         virtual ~ModuleSpy()
00043         {
00044         }
00045 
00046         virtual Version GetVersion()
00047         {
00048                 return Version("$Id: m_spy.cpp 10666 2008-10-18 16:52:53Z w00t $", VF_VENDOR, API_VERSION);
00049         }
00050 };
00051 
00052 MODULE_INIT(ModuleSpy)
00053