]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_allowinvite.cpp
Include untranslated user/channel metadata in CHECK output
[user/henk/code/inspircd.git] / src / modules / m_allowinvite.cpp
index cbab0bd2f1d94a81a1fd8392b84108bb6c26d006..e177f8ee62202a59810c8a9bfb2677c37ab917b6 100644 (file)
@@ -3,7 +3,7 @@
  *       +------------------------------------+
  *
  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
@@ -23,13 +23,12 @@ class AllowInvite : public SimpleChannelModeHandler
 
 class ModuleAllowInvite : public Module
 {
-       AllowInvite *ni;
+       AllowInvite ni;
  public:
 
-       ModuleAllowInvite(InspIRCd* Me) : Module(Me)
+       ModuleAllowInvite(InspIRCd* Me) : Module(Me), ni(Me)
        {
-               ni = new AllowInvite(ServerInstance);
-               if (!ServerInstance->Modes->AddMode(ni))
+               if (!ServerInstance->Modes->AddMode(&ni))
                        throw ModuleException("Could not add new modes!");
                Implementation eventlist[] = { I_OnUserPreInvite, I_On005Numeric };
                ServerInstance->Modules->Attach(eventlist, this, 2);
@@ -44,7 +43,13 @@ class ModuleAllowInvite : public Module
        {
                if (IS_LOCAL(user))
                {
-                       if (channel->IsModeSet('A') && channel->GetExtBanStatus(user, 'A') < 0)
+                       if (channel->GetExtBanStatus(user, 'A') == -1)
+                       {
+                               // Matching extban, explicitly deny /invite
+                               user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You are banned from using INVITE", user->nick.c_str(), channel->name.c_str());
+                               return 1;
+                       }
+                       if (channel->IsModeSet('A') || channel->GetExtBanStatus(user, 'A') == 1)
                        {
                                // Explicitly allow /invite
                                return -1;
@@ -56,8 +61,7 @@ class ModuleAllowInvite : public Module
 
        virtual ~ModuleAllowInvite()
        {
-               ServerInstance->Modes->DelMode(ni);
-               delete ni;
+               ServerInstance->Modes->DelMode(&ni);
        }
 
        virtual Version GetVersion()