]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spy.cpp
Make FJOIN send UUID
[user/henk/code/inspircd.git] / src / modules / m_spy.cpp
index 4ef628436a85cc1e5f6ecfd5af8b2b59cc642804..b33a0ba54835e636988ad9a7e1943c2f7914f6ba 100644 (file)
 
 /* $ModDesc: Provides SPYLIST and SPYNAMES capability, allowing opers to see who's in +s channels */
 
-#include "inspircd_config.h"
+#include "inspircd.h"
 #include "users.h" 
 #include "channels.h"
 #include "modules.h"
-#include "inspircd.h"
 #include "wildcard.h"
 
 void spy_userlist(userrec *user, chanrec *c)
@@ -39,7 +38,7 @@ void spy_userlist(userrec *user, chanrec *c)
 
        for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
        {
-               size_t ptrlen = snprintf(ptr, MAXBUF, "%s%s ", c->GetPrefixChar(i->second), i->second->nick);
+               size_t ptrlen = snprintf(ptr, MAXBUF, "%s%s ", c->GetPrefixChar(i->first), i->first->nick);
 
                curlen += ptrlen;
                ptr += ptrlen;
@@ -78,14 +77,14 @@ class cmd_spylist : public command_t
        cmd_spylist (InspIRCd* Instance) : command_t(Instance,"SPYLIST", 'o', 0)
        {
                this->source = "m_spy.so";
-               syntax = "";
+               syntax.clear();
        }
 
        CmdResult Handle (const char** parameters, int pcnt, userrec *user)
        {
                ServerInstance->WriteOpers("*** Oper %s used SPYLIST to list +s/+p channels and keys.",user->nick);
                user->WriteServ("321 %s Channel :Users Name",user->nick);
-               for (chan_hash::const_iterator i = ServerInstance->chanlist.begin(); i != ServerInstance->chanlist.end(); i++)
+               for (chan_hash::const_iterator i = ServerInstance->chanlist->begin(); i != ServerInstance->chanlist->end(); i++)
                {
                        if (pcnt && !match(i->second->name, parameters[0]))
                                continue;
@@ -94,7 +93,7 @@ class cmd_spylist : public command_t
                user->WriteServ("323 %s :End of channel list.",user->nick);
 
                /* Dont send out across the network */
-               return CMD_FAILURE;
+               return CMD_LOCALONLY;
        }
 };
 
@@ -127,14 +126,13 @@ class cmd_spynames : public command_t
                {
                        ServerInstance->WriteOpers("*** Oper %s used SPYNAMES to view the users on %s", user->nick, parameters[0]);
                        spy_userlist(user,c);
-                       user->WriteServ("366 %s %s :End of /NAMES list.", user->nick, c->name);
                }
                else
                {
                        user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
                }
 
-               return CMD_FAILURE;
+               return CMD_LOCALONLY;
        }
 };
 
@@ -143,7 +141,7 @@ class ModuleSpy : public Module
        cmd_spylist *mycommand;
        cmd_spynames *mycommand2;
  public:
-       ModuleSpy(InspIRCd* Me) : Module::Module(Me)
+       ModuleSpy(InspIRCd* Me) : Module(Me)
        {
                
                mycommand = new cmd_spylist(ServerInstance);
@@ -162,27 +160,4 @@ class ModuleSpy : public Module
        }
 };
 
-
-class ModuleSpyFactory : public ModuleFactory
-{
- public:
-       ModuleSpyFactory()
-       {
-       }
-       
-       ~ModuleSpyFactory()
-       {
-       }
-       
-       virtual Module * CreateModule(InspIRCd* Me)
-       {
-               return new ModuleSpy(Me);
-       }
-       
-};
-
-
-extern "C" void * init_module( void )
-{
-       return new ModuleSpyFactory;
-}
+MODULE_INIT(ModuleSpy)