]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/users.h
Merge pull request #244 from SaberUK/insp20-configure-fix
[user/henk/code/inspircd.git] / include / users.h
index 6b891d7da335cfb0c51c95dc167265c8638e4e03..6852b3fb92f9b0f3929968025688e9215b178dbd 100644 (file)
@@ -1,23 +1,35 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
  *
- *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
+ *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2007-2008 Robin Burchell <robin+git@viroteck.net>
+ *   Copyright (C) 2008 Thomas Stagner <aquanight@inspircd.org>
+ *   Copyright (C) 2003-2007 Craig Edwards <craigedwards@brainbox.cc>
+ *   Copyright (C) 2007 Burlex <???@???>
+ *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
  *
- * 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/>.
  */
 
-#ifndef __USERS_H__
-#define __USERS_H__
+
+#ifndef USERS_H
+#define USERS_H
 
 #include "socket.h"
 #include "inspsocket.h"
 #include "dns.h"
 #include "mode.h"
+#include "membership.h"
 
 /** connect class types
  */
@@ -121,6 +133,10 @@ struct CoreExport ConnectClass : public refcountbase
         */
        unsigned long maxglobal;
 
+       /** True if max connections for this class is hit and a warning is wanted
+        */
+       bool maxconnwarn;
+
        /** Max channels for this class
         */
        unsigned int maxchans;
@@ -348,6 +364,12 @@ class CoreExport User : public Extensible
         */
        unsigned int quitting:1;
 
+       /** Recursion fix: user is out of SendQ and will be quit as soon as possible.
+        * This can't be handled normally because QuitUser itself calls Write on other
+        * users, which could trigger their SendQ to overrun.
+        */
+       unsigned int quitting_sendq:1;
+
        /** This is true if the user matched an exception (E:Line). It is used to save time on ban checks.
         */
        unsigned int exempt:1;
@@ -712,14 +734,10 @@ class CoreExport UserIOHandler : public StreamSocket
        void AddWriteBuf(const std::string &data);
 };
 
-class CoreExport LocalUser : public User
-{
-       /** A list of channels the user has a pending invite to.
-        * Upon INVITE channels are added, and upon JOIN, the
-        * channels are removed from this list.
-        */
-       InvitedList invites;
+typedef unsigned int already_sent_t;
 
+class CoreExport LocalUser : public User, public InviteBase
+{
  public:
        LocalUser(int fd, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server);
        CullResult cull();
@@ -776,6 +794,9 @@ class CoreExport LocalUser : public User
         */
        unsigned int CommandFloodPenalty;
 
+       static already_sent_t already_sent_id;
+       already_sent_t already_sent;
+
        /** Stored reverse lookup from res_forward. Should not be used after resolution.
         */
        std::string stored_host;
@@ -804,7 +825,7 @@ class CoreExport LocalUser : public User
        /** Returns the list of channels this user has been invited to but has not yet joined.
         * @return A list of channels the user is invited to
         */
-       InvitedList* GetInviteList();
+       InviteList& GetInviteList();
 
        /** Returns true if a user is invited to a channel.
         * @param channel A channel name to look up
@@ -825,6 +846,8 @@ class CoreExport LocalUser : public User
         */
        void RemoveInvite(const irc::string &channel);
 
+       void RemoveExpiredInvites();
+
        /** Returns true or false for if a user can execute a privilaged oper command.
         * This is done by looking up their oper type from User::oper, then referencing
         * this to their oper classes and checking the commands they can execute.
@@ -851,8 +874,6 @@ class CoreExport LocalUser : public User
         * @return True if the user can set or unset this mode.
         */
        bool HasModePermission(unsigned char mode, ModeType type);
-
-       inline int GetFd() { return eh.GetFd(); }
 };
 
 class CoreExport RemoteUser : public User
@@ -904,12 +925,8 @@ inline FakeUser* IS_SERVER(User* u)
 class CoreExport UserResolver : public Resolver
 {
  private:
-       /** User this class is 'attached' to.
-        */
-       LocalUser* bound_user;
-       /** File descriptor teh lookup is bound to
-        */
-       int bound_fd;
+       /** UUID we are looking up */
+       std::string uuid;
        /** True if the lookup is forward, false if is a reverse lookup
         */
        bool fwd;