]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_noinvite.cpp
Always deny invite to users below halfop status, move OnUserPreInvite up to above...
[user/henk/code/inspircd.git] / src / modules / m_noinvite.cpp
index 0126b11c0b3b2b1aeea87340bf8e91199c5800d2..53e5ca84f237893ba5a2147285dc33d684b35093 100644 (file)
@@ -31,22 +31,32 @@ class ModuleNoInvite : public Module
                ni = new NoInvite(ServerInstance);
                if (!ServerInstance->Modes->AddMode(ni))
                        throw ModuleException("Could not add new modes!");
-               Implementation eventlist[] = { I_OnUserPreInvite };
-               ServerInstance->Modules->Attach(eventlist, this, 1);
+               Implementation eventlist[] = { I_OnUserPreInvite, I_On005Numeric };
+               ServerInstance->Modules->Attach(eventlist, this, 2);
        }
 
+       virtual void On005Numeric(std::string &output)
+       {
+               ServerInstance->AddExtBanChar('V');
+       }
 
        virtual int OnUserPreInvite(User* user,User* dest,Channel* channel, time_t timeout)
        {
                if (IS_LOCAL(user))
                {
-                       if (channel->IsModeSet('V'))
+                       if (CHANOPS_EXEMPT(ServerInstance, 'c') && channel->GetStatus(user) == STATUS_OP)
                        {
-                               user->WriteNumeric(492, "%s %s :Can't invite %s to channel (+V set)",user->nick.c_str(), channel->name.c_str(), dest->nick.c_str());
+                               return 0;
+                       }
+
+                       if (channel->IsModeSet('V') || channel->IsExtBanned(user, 'V'))
+                       {
+                               user->WriteNumeric(ERR_NOCTCPALLOWED, "%s %s :Can't invite %s to channel (+V set)",user->nick.c_str(), channel->name.c_str(), dest->nick.c_str());
                                return 1;
                        }
-                       return 0;
                }
+
+               return 0;
        }
 
        virtual ~ModuleNoInvite()
@@ -54,7 +64,7 @@ class ModuleNoInvite : public Module
                ServerInstance->Modes->DelMode(ni);
                delete ni;
        }
-       
+
        virtual Version GetVersion()
        {
                return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION);