]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_kicknorejoin.cpp
Remove some uline checks that ran after an IS_LOCAL() check
[user/henk/code/inspircd.git] / src / modules / m_kicknorejoin.cpp
index 708ff17a8aa01539db2ab280831eba413b6c9bcf..836f92e6ccdcf1e46e3c7ee3e24ee10f8e594604 100644 (file)
@@ -1,16 +1,28 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
+ *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2008 Pippijn van Steenhoven <pip88nl@gmail.com>
+ *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
+ *   Copyright (C) 2006-2007 Robin Burchell <robin+git@viroteck.net>
+ *   Copyright (C) 2006 John Brooks <john.brooks@dereferenced.net>
+ *   Copyright (C) 2006 Craig Edwards <craigedwards@brainbox.cc>
+ *   Copyright (C) 2006 Oliver Lupton <oliverlupton@gmail.com>
  *
- * This program is free but copyrighted software; see
- *            the file COPYING for details.
+ * This file is part of InspIRCd.  InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
  *
- * ---------------------------------------------------
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+
 #include "inspircd.h"
 
 /* $ModDesc: Provides channel mode +J (delay rejoin after kick) */
@@ -52,11 +64,14 @@ public:
        ModuleKickNoRejoin()
                : kr(this)
        {
-               if (!ServerInstance->Modes->AddMode(&kr))
-                       throw ModuleException("Could not add new modes!");
-               ServerInstance->Extensions.Register(&kr.ext);
+       }
+
+       void init()
+       {
+               ServerInstance->Modules->AddService(kr);
+               ServerInstance->Modules->AddService(kr.ext);
                Implementation eventlist[] = { I_OnUserPreJoin, I_OnUserKick };
-               ServerInstance->Modules->Attach(eventlist, this, 2);
+               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
        }
 
        ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
@@ -74,8 +89,9 @@ public:
                                        {
                                                if (iter->first == user)
                                                {
+                                                       std::string modeparam = chan->GetModeParameter(&kr);
                                                        user->WriteNumeric(ERR_DELAYREJOIN, "%s %s :You must wait %s seconds after being kicked to rejoin (+J)",
-                                                               user->nick.c_str(), chan->name.c_str(), chan->GetModeParameter(&kr).c_str());
+                                                               user->nick.c_str(), chan->name.c_str(), modeparam.c_str());
                                                        return MOD_RES_DENY;
                                                }
                                        }
@@ -101,12 +117,12 @@ public:
                if (memb->chan->IsModeSet(&kr) && (source != memb->user))
                {
                        delaylist* dl = kr.ext.get(memb->chan);
-                       if (dl)
+                       if (!dl)
                        {
                                dl = new delaylist;
                                kr.ext.set(memb->chan, dl);
                        }
-                       (*dl)[memb->user] = ServerInstance->Time() + atoi(memb->chan->GetModeParameter(&kr).c_str());
+                       (*dl)[memb->user] = ServerInstance->Time() + ConvToInt(memb->chan->GetModeParameter(&kr));
                }
        }
 
@@ -116,7 +132,7 @@ public:
 
        Version GetVersion()
        {
-               return Version("Channel mode to delay rejoin after kick", VF_COMMON | VF_VENDOR);
+               return Version("Channel mode to delay rejoin after kick", VF_VENDOR);
        }
 };