]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_invisible.cpp
Add comments
[user/henk/code/inspircd.git] / src / modules / m_invisible.cpp
index 2ec8439cf7d89483a43bfa2677c5b7db384f560f..3f816b3c0932f951e30452932f70d6943d94131e 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
@@ -47,7 +47,7 @@ class InvisibleMode : public ModeHandler
 
        ~InvisibleMode()
        {
-               for (user_hash::iterator i = ServerInstance->clientlist->begin(); i != ServerInstance->clientlist->end(); i++)
+               for (user_hash::iterator i = ServerInstance->Users->clientlist->begin(); i != ServerInstance->Users->clientlist->end(); i++)
                        if (i->second->Visibility == qo)
                                i->second->Visibility = NULL;
                delete qo;
@@ -115,7 +115,7 @@ class InvisibleMode : public ModeHandler
                                        }
                                }
 
-                               ServerInstance->WriteOpers("*** \2NOTICE\2: Oper %s has become %svisible (%sQ)", dest->GetFullHost(), adding ? "in" : "", adding ? "+" : "-");
+                               ServerInstance->SNO->WriteToSnoMask('A', "\2NOTICE\2: Oper %s has become %svisible (%sQ)", dest->GetFullHost(), adding ? "in" : "", adding ? "+" : "-");
                        }
                        return MODEACTION_ALLOW;
                }
@@ -159,23 +159,25 @@ class ModuleInvisible : public Module
        {
                conf = new ConfigReader(ServerInstance);
                qm = new InvisibleMode(ServerInstance);
-               if (!ServerInstance->AddMode(qm, 'Q'))
+               if (!ServerInstance->Modes->AddMode(qm))
                        throw ModuleException("Could not add new modes!");
                ido = new InvisibleDeOper(ServerInstance);
-               if (!ServerInstance->AddModeWatcher(ido))
+               if (!ServerInstance->Modes->AddModeWatcher(ido))
                        throw ModuleException("Could not add new mode watcher on usermode +o!");
 
                /* Yeah i know people can take this out. I'm not about to obfuscate code just to be a pain in the ass. */
-               ServerInstance->ServerNoticeAll("*** m_invisible.so has just been loaded on this network. For more information, please visit http://inspircd.org/wiki/Modules/invisible");
+               ServerInstance->Users->ServerNoticeAll("*** m_invisible.so has just been loaded on this network. For more information, please visit http://inspircd.org/wiki/Modules/invisible");
+               Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserJoin, I_OnUserPart, I_OnUserQuit, I_OnRehash };
+               ServerInstance->Modules->Attach(eventlist, this, 6);
        }
 
        virtual ~ModuleInvisible()
        {
                ServerInstance->Modes->DelMode(qm);
                ServerInstance->Modes->DelModeWatcher(ido);
-               DELETE(qm);
-               DELETE(ido);
-               DELETE(conf);
+               delete qm;
+               delete ido;
+               delete conf;
        }
 
        virtual Version GetVersion()
@@ -183,25 +185,21 @@ class ModuleInvisible : public Module
                return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
        }
 
-       void Implements(char* List)
-       {
-               List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = List[I_OnUserJoin] = List[I_OnUserPart] = List[I_OnUserQuit] = List[I_OnRehash] = 1;
-       }
        
-       virtual void OnUserJoin(User* user, Channel* channel, bool &silent)
+       virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent)
        {
                if (user->IsModeSet('Q'))
                {
                        silent = true;
                        /* Because we silenced the event, make sure it reaches the user whos joining (but only them of course) */
                        this->WriteCommonFrom(user, channel, "JOIN %s", channel->name);
-                       ServerInstance->WriteOpers("*** \2NOTICE\2: Oper %s has joined %s invisibly (+Q)", user->GetFullHost(), channel->name);
+                       ServerInstance->SNO->WriteToSnoMask('A', "\2NOTICE\2: Oper %s has joined %s invisibly (+Q)", user->GetFullHost(), channel->name);
                }
        }
 
        virtual void OnRehash(User* user, const std::string &parameter)
        {
-               DELETE(conf);
+               delete conf;
                conf = new ConfigReader(ServerInstance);
        }