]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/xline.cpp
Merge pull request #96 from Justasic/insp20
[user/henk/code/inspircd.git] / src / xline.cpp
index b101237a38920295a6aa561d05fce818f947745f..ed3ed6364b1ef01714867cf57e0f64026211c48c 100644 (file)
@@ -1,16 +1,26 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2005-2009 Robin Burchell <robin+git@viroteck.net>
+ *   Copyright (C) 2004-2008 Craig Edwards <craigedwards@brainbox.cc>
+ *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
+ *   Copyright (C) 2007 John Brooks <john.brooks@dereferenced.net>
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
+ * 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 free but copyrighted software; see
- *         the file COPYING for details.
+ * 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"
 #include "xline.h"
 #include "bancache.h"
@@ -146,7 +156,7 @@ void XLineManager::CheckELines()
        if (ELines.empty())
                return;
 
-       for (std::vector<User*>::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
+       for (std::vector<LocalUser*>::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
        {
                User* u = (User*)(*u2);
 
@@ -311,7 +321,7 @@ bool XLineManager::DelLine(const char* hostmask, const std::string &type, User*
 void ELine::Unset()
 {
        /* remove exempt from everyone and force recheck after deleting eline */
-       for (std::vector<User*>::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
+       for (std::vector<LocalUser*>::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
        {
                User* u = (User*)(*u2);
                u->exempt = false;
@@ -415,7 +425,7 @@ void XLineManager::ExpireLine(ContainerIter container, LookupIter item)
 // applies lines, removing clients and changing nicks etc as applicable
 void XLineManager::ApplyLines()
 {
-       std::vector<User*>::reverse_iterator u2 = ServerInstance->Users->local_users.rbegin();
+       std::vector<LocalUser*>::reverse_iterator u2 = ServerInstance->Users->local_users.rbegin();
        while (u2 != ServerInstance->Users->local_users.rend())
        {
                User* u = *u2++;
@@ -494,7 +504,8 @@ XLineManager::~XLineManager()
        for(unsigned int i=0; i < sizeof(gekqz); i++)
        {
                XLineFactory* xlf = GetFactory(std::string(1, gekqz[i]));
-               UnregisterFactory(xlf);
+               if (xlf)
+                       UnregisterFactory(xlf);
                delete xlf;
        }
 
@@ -670,7 +681,7 @@ bool GLine::Matches(const std::string &str)
 void ELine::OnAdd()
 {
        /* When adding one eline, only check the one eline */
-       for (std::vector<User*>::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
+       for (std::vector<LocalUser*>::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
        {
                User* u = (User*)(*u2);
                if (this->Matches(u))