]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/usermanager.h
Add Who::Request::GetFlagIndex to get field index
[user/henk/code/inspircd.git] / include / usermanager.h
index 361584cdaa184cd21cf30d8d218b5587d11748af..c013e59aeab343463bfef2ac374021471fd639de 100644 (file)
@@ -41,7 +41,7 @@ class CoreExport UserManager : public fakederef<UserManager>
 
        /** A list holding local users
        */
-       typedef intrusive_list<LocalUser> LocalList;
+       typedef insp::intrusive_list<LocalUser> LocalList;
 
  private:
        /** Map of IP addresses for clone counting
@@ -56,6 +56,11 @@ class CoreExport UserManager : public fakederef<UserManager>
         */
        LocalList local_users;
 
+       /** Last used already sent id, used when sending messages to neighbors to help determine whether the message has
+        * been sent to a particular user or not. See User::ForEachNeighbor() for more info.
+        */
+       already_sent_t already_sent_id;
+
  public:
        /** Constructor, initializes variables
         */
@@ -65,12 +70,11 @@ class CoreExport UserManager : public fakederef<UserManager>
         */
        ~UserManager();
 
-       /** Client list, a hash_map containing all clients, local and remote
+       /** Nickname string -> User* map. Contains all users, including unregistered ones.
         */
        user_hash clientlist;
 
-       /** Client list stored by UUID. Contains all clients, and is updated
-        * automatically by the constructor and destructor of User.
+       /** UUID -> User* map. Contains all users, including unregistered ones.
         */
        user_hash uuidlist;
 
@@ -83,38 +87,29 @@ class CoreExport UserManager : public fakederef<UserManager>
         */
        unsigned int unregistered_count;
 
-       /**
-        * Reset the already_sent IDs so we don't wrap it around and drop a message
-        * Also removes all expired invites
-     */
-       void GarbageCollect();
-
-       /** Perform background user events such as PING checks
+       /** Perform background user events for all local users such as PING checks, registration timeouts,
+        * penalty management and recvq processing for users who have data in their recvq due to throttling.
         */
        void DoBackgroundUserStuff();
 
-       /** Returns true when all modules have done pre-registration checks on a user
-        * @param user The user to verify
-        * @return True if all modules have finished checking this user
-        */
-       bool AllModulesReportReady(LocalUser* user);
-
-       /** Add a client to the system.
-        * This will create a new User, insert it into the user_hash,
-        * initialize it as not yet registered, and add it to the socket engine.
-        * @param socket The socket id (file descriptor) this user is on
-        * @param via The socket that this user connected using
+       /** Handle a client connection.
+        * Creates a new LocalUser object, inserts it into the appropriate containers,
+        * initializes it as not yet registered, and adds it to the socket engine.
+        *
+        * The new user may immediately be quit after being created, for example if the user limit
+        * is reached or if the user is banned.
+        * @param socket File descriptor of the connection
+        * @param via Listener socket that this user connected to
         * @param client The IP address and client port of the user
         * @param server The server IP address and port used by the user
-        * @return This function has no return value, but a call to AddClient may remove the user.
         */
        void AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server);
 
-       /** Disconnect a user gracefully
+       /** Disconnect a user gracefully.
+        * When this method returns the user provided will be quit, but the User object will continue to be valid and will be deleted at the end of the current main loop iteration.
         * @param user The user to remove
         * @param quitreason The quit reason to show to normal users
         * @param operreason The quit reason to show to opers, can be NULL if same as quitreason
-        * @return Although this function has no return type, on exit the user provided will no longer exist.
         */
        void QuitUser(User* user, const std::string& quitreason, const std::string* operreason = NULL);
 
@@ -130,6 +125,10 @@ class CoreExport UserManager : public fakederef<UserManager>
         */
        void RemoveCloneCounts(User *user);
 
+       /** Rebuild clone counts. Required when \<cidr> settings change.
+        */
+       void RehashCloneCounts();
+
        /** Return the number of local and global clones of this user
         * @param user The user to get the clone counts for
         * @return The clone counts of this user. The returned reference is volatile - you
@@ -183,4 +182,9 @@ class CoreExport UserManager : public fakederef<UserManager>
         * @param ... The format arguments
         */
        void ServerNoticeAll(const char* text, ...) CUSTOM_PRINTF(2, 3);
+
+       /** Retrieves the next already sent id, guaranteed to be not equal to any user's already_sent field
+        * @return Next already_sent id
+        */
+       already_sent_t NextAlreadySentId();
 };