InspIRCd  2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations
usermanager.h
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  * Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
5  *
6  * This file is part of InspIRCd. InspIRCd is free software: you can
7  * redistribute it and/or modify it under the terms of the GNU General Public
8  * License as published by the Free Software Foundation, version 2.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 
20 #ifndef USERMANAGER_H
21 #define USERMANAGER_H
22 
23 #include <list>
24 
26 typedef std::map<irc::sockets::cidr_mask, unsigned int> clonemap;
27 
28 class CoreExport UserManager
29 {
30  private:
33  clonemap local_clones;
34  public:
35  UserManager();
36 
37  ~UserManager()
38  {
39  for (user_hash::iterator i = clientlist->begin();i != clientlist->end();i++)
40  {
41  delete i->second;
42  }
43  clientlist->clear();
44  delete clientlist;
45  delete uuidlist;
46  }
47 
50  user_hash* clientlist;
51 
55  user_hash* uuidlist;
56 
59  LocalUserList local_users;
60 
63  std::list<User*> all_opers;
64 
68  unsigned int unregistered_count;
69 
72  unsigned int local_count;
73 
77  clonemap global_clones;
78 
88  void AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server);
89 
96  void QuitUser(User *user, const std::string &quitreason, const char* operreason = "");
97 
101  void AddLocalClone(User *user);
102 
106  void AddGlobalClone(User *user);
107 
113  void RemoveCloneCounts(User *user);
114 
119  unsigned long GlobalCloneCount(User *user);
120 
125  unsigned long LocalCloneCount(User *user);
126 
130  unsigned int UserCount();
131 
135  unsigned int RegisteredUserCount();
136 
140  unsigned int OperCount();
141 
145  unsigned int UnregisteredUserCount();
146 
150  unsigned int LocalUserCount();
151 
152 
153 
154 
157  int ModeCount(const char mode);
158 
163  void ServerNoticeAll(const char* text, ...) CUSTOM_PRINTF(2, 3);
164 
169  void ServerPrivmsgAll(const char* text, ...) CUSTOM_PRINTF(2, 3);
170 };
171 
172 #endif
Definition: users.h:230
LocalUserList local_users
Definition: usermanager.h:59
user_hash * clientlist
Definition: usermanager.h:50
std::list< User * > all_opers
Definition: usermanager.h:63
Definition: socket.h:58
user_hash * uuidlist
Definition: usermanager.h:55
Definition: usermanager.h:28
unsigned int unregistered_count
Definition: usermanager.h:68
clonemap global_clones
Definition: usermanager.h:77
unsigned int local_count
Definition: usermanager.h:72
Definition: socket.h:146