]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/usermanager.h
First UserManager overhaul: Move clone counts out of InspIRCd & User.
[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 user to the local clone map
40          * @param user The user to add
41          */
42         void AddLocalClone(User *user);
43
44         /** Add a user to the global clone map
45          * @param user The user to add
46          */
47         void AddGlobalClone(User *user);
48
49         /** Remove all clone counts from the user, you should
50          * use this if you change the user's IP address 
51          * after they have registered.
52          * @param user The user to remove
53          */
54         void RemoveCloneCounts(User *user);
55
56         /** Return the number of global clones of this user
57          * @param user The user to get a count for
58          * @return The global clone count of this user
59          */
60         unsigned long GlobalCloneCount(User *user);
61
62         /** Return the number of local clones of this user
63          * @param user The user to get a count for
64          * @return The local clone count of this user
65          */
66         unsigned long LocalCloneCount(User *user);
67
68
69
70
71         void RemoveCloneCounts();
72 };
73
74 #endif