]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
m_dnsbl: switch to OnSetClientIP hook which may be refired.
[user/henk/code/inspircd.git] / src / users.cpp
index 8b3065706ca526ac659cf880604b94245814aedb..73eb8413712a115be67f3ccb3d9d617cea5b82a3 100644 (file)
@@ -1,16 +1,28 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ *   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2006-2009 Robin Burchell <robin+git@viroteck.net>
+ *   Copyright (C) 2006-2007, 2009 Dennis Friis <peavey@inspircd.org>
+ *   Copyright (C) 2008 John Brooks <john.brooks@dereferenced.net>
+ *   Copyright (C) 2008 Thomas Stagner <aquanight@inspircd.org>
+ *   Copyright (C) 2008 Oliver Lupton <oliverlupton@gmail.com>
+ *   Copyright (C) 2003-2008 Craig Edwards <craigedwards@brainbox.cc>
  *
- *  InspIRCd: (C) 2002-2010 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 <stdarg.h>
 #include "socketengine.h"
@@ -212,7 +224,8 @@ LocalUser::LocalUser(int myfd, irc::sockets::sockaddrs* client, irc::sockets::so
 {
        lastping = 0;
        eh.SetFd(myfd);
-       memcpy(&client_sa, client, sizeof(irc::sockets::sockaddrs));
+
+       SetClientIP(client);
        memcpy(&server_sa, servaddr, sizeof(irc::sockets::sockaddrs));
 }
 
@@ -996,10 +1009,24 @@ irc::sockets::cidr_mask User::GetCIDRMask()
        return irc::sockets::cidr_mask(client_sa, range);
 }
 
+bool User::SetClientIP(irc::sockets::sockaddrs *sa)
+{
+       memcpy(&client_sa, sa, sizeof(irc::sockets::sockaddrs));
+
+       FOREACH_MOD(I_OnSetClientIP, OnSetClientIP(this));
+
+       return true;
+}
+
 bool User::SetClientIP(const char* sip)
 {
+       irc::sockets::sockaddrs sa;
+
        this->cachedip = "";
-       return irc::sockets::aptosa(sip, 0, client_sa);
+       if (!irc::sockets::aptosa(sip, 0, sa))
+               return false;
+
+       return SetClientIP(&sa);
 }
 
 static std::string wide_newline("\r\n");