]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_invisible.cpp
Instead of re adding the HandshakeTimer in m_spanningtree, make it a reoccurring...
[user/henk/code/inspircd.git] / src / modules / m_invisible.cpp
index 836369b8f398036d3c2abcf56a0f55a378e1dee0..965ff2635c2bdd72e0b7dac85eef7a0ed4a96c47 100644 (file)
@@ -2,8 +2,8 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
@@ -55,29 +55,8 @@ class InvisibleMode : public ModeHandler
 
        ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool)
        {
-               if (source != dest)
-                       return MODEACTION_DENY;
-
                if (dest->IsModeSet('Q') != adding)
                {
-                       bool ok = false;
-
-                       for (int j = 0; j < conf->Enumerate("type"); j++)
-                       {
-                               std::string opertype = conf->ReadValue("type","name",j);
-                               if (opertype == source->oper)
-                               {
-                                       ok = conf->ReadFlag("type", "canquiet", j);
-                                       break;
-                               }
-                       }
-
-                       if (!ok)
-                       {
-                               source->WriteNumeric(481, "%s :Permission Denied - You do not have access to become invisible via user mode +Q", source->nick.c_str());
-                               return MODEACTION_DENY;
-                       }
-
                        dest->SetMode('Q', adding);
 
                        /* Fix for bug #379 reported by stealth. On +/-Q make m_watch think the user has signed on/off */
@@ -116,7 +95,7 @@ class InvisibleMode : public ModeHandler
                                }
                        }
 
-                       ServerInstance->SNO->WriteToSnoMask('A', "\2NOTICE\2: Oper %s has become %svisible (%sQ)", dest->GetFullHost().c_str(), adding ? "in" : "", adding ? "+" : "-");
+                       ServerInstance->SNO->WriteToSnoMask('A', "\2NOTICE\2: Oper %s has become %svisible (%cQ)", dest->GetFullHost().c_str(), adding ? "in" : "", adding ? '+' : '-');
                        return MODEACTION_ALLOW;
                }
                else
@@ -169,8 +148,8 @@ class ModuleInvisible : public Module
 
                /* Yeah i know people can take this out. I'm not about to obfuscate code just to be a pain in the ass. */
                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);
+               Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserJoin, I_OnUserPart, I_OnUserQuit, I_OnRehash, I_OnHostCycle };
+               ServerInstance->Modules->Attach(eventlist, this, 7);
        };
 
        virtual ~ModuleInvisible()
@@ -187,6 +166,7 @@ class ModuleInvisible : public Module
        virtual void OnRehash(User* user, const std::string &parameter);
        void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent);
        void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message);
+       bool OnHostCycle(User* user);
        /* No privmsg response when hiding - submitted by Eric at neowin */
        virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list);
        virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list);
@@ -250,6 +230,11 @@ void ModuleInvisible::OnUserQuit(User* user, const std::string &reason, const st
        }
 }
 
+bool ModuleInvisible::OnHostCycle(User* user)
+{
+       return user->IsModeSet('Q');
+}
+
 /* No privmsg response when hiding - submitted by Eric at neowin */
 int ModuleInvisible::OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
 {