]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/usermanager.h
Two stage commit: don't set user->muted except in QuitUser (duplicate setting), also...
[user/henk/code/inspircd.git] / include / usermanager.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *          the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #ifndef __USERMANAGER_H
15 #define __USERMANAGER_H
16
17 /** A list of ip addresses cross referenced against clone counts */
18 typedef std::map<irc::string, unsigned int> clonemap;
19
20 class CoreExport UserManager : public classbase
21 {
22  private:
23         InspIRCd *ServerInstance;
24
25         /** Map of local ip addresses for clone counting
26          */
27         clonemap local_clones;
28  public:
29         UserManager(InspIRCd *Instance)
30         {
31                 ServerInstance = Instance;
32         }
33
34         /** Map of global ip addresses for clone counting
35          * XXX - this should be private, but m_clones depends on it currently.
36          */
37         clonemap global_clones;
38
39         /** Add a client to the system.
40          * This will create a new User, insert it into the user_hash,
41          * initialize it as not yet registered, and add it to the socket engine.
42          * @param Instance a pointer to the server instance
43          * @param socket The socket id (file descriptor) this user is on
44          * @param port The port number this user connected on
45          * @param iscached This variable is reserved for future use
46          * @param ip The IP address of the user
47          * @return This function has no return value, but a call to AddClient may remove the user.
48          */
49         void AddClient(InspIRCd* Instance, int socket, int port, bool iscached, int socketfamily, sockaddr* ip);
50
51         /** Add a user to the local clone map
52          * @param user The user to add
53          */
54         void AddLocalClone(User *user);
55
56         /** Add a user to the global clone map
57          * @param user The user to add
58          */
59         void AddGlobalClone(User *user);
60
61         /** Remove all clone counts from the user, you should
62          * use this if you change the user's IP address 
63          * after they have registered.
64          * @param user The user to remove
65          */
66         void RemoveCloneCounts(User *user);
67
68         /** Return the number of global clones of this user
69          * @param user The user to get a count for
70          * @return The global clone count of this user
71          */
72         unsigned long GlobalCloneCount(User *user);
73
74         /** Return the number of local clones of this user
75          * @param user The user to get a count for
76          * @return The local clone count of this user
77          */
78         unsigned long LocalCloneCount(User *user);
79
80
81
82
83         void RemoveCloneCounts();
84 };
85
86 #endif