1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
14 #ifndef __USERMANAGER_H
15 #define __USERMANAGER_H
17 /** A list of ip addresses cross referenced against clone counts */
18 typedef std::map<irc::string, unsigned int> clonemap;
20 class CoreExport UserManager : public classbase
23 InspIRCd *ServerInstance;
25 /** Map of local ip addresses for clone counting
27 clonemap local_clones;
29 UserManager(InspIRCd *Instance)
31 ServerInstance = Instance;
34 /** Map of global ip addresses for clone counting
35 * XXX - this should be private, but m_clones depends on it currently.
37 clonemap global_clones;
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.
49 void AddClient(InspIRCd* Instance, int socket, int port, bool iscached, int socketfamily, sockaddr* ip);
51 /** Add a user to the local clone map
52 * @param user The user to add
54 void AddLocalClone(User *user);
56 /** Add a user to the global clone map
57 * @param user The user to add
59 void AddGlobalClone(User *user);
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
66 void RemoveCloneCounts(User *user);
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
72 unsigned long GlobalCloneCount(User *user);
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
78 unsigned long LocalCloneCount(User *user);
80 /** Return a count of users, unknown and known connections
81 * @return The number of users
83 unsigned int UserCount();
85 /** Return a count of fully registered connections only
86 * @return The number of registered users
88 unsigned int RegisteredUserCount();
90 /** Return a count of opered (umode +o) users only
91 * @return The number of opers
93 unsigned int OperCount();
95 /** Return a count of unregistered (before NICK/USER) users only
96 * @return The number of unregistered (unknown) connections
98 unsigned int UnregisteredUserCount();
100 /** Return a count of local users on this server only
101 * @return The number of local users
103 unsigned int LocalUserCount();