summaryrefslogtreecommitdiffstats
path: root/src/server/ChatServer.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/ChatServer.hpp')
-rw-r--r--src/server/ChatServer.hpp35
1 files changed, 24 insertions, 11 deletions
diff --git a/src/server/ChatServer.hpp b/src/server/ChatServer.hpp
index e2ef154..4fa90e5 100644
--- a/src/server/ChatServer.hpp
+++ b/src/server/ChatServer.hpp
@@ -17,6 +17,28 @@ enum handle_room_enter {
class ChatRoom;
class UserInfo;
+class StorageOfUsers {
+ int online;
+ struct item {
+ UserInfo *u;
+ item *next;
+ };
+ item *first;
+public:
+ StorageOfUsers() : online(0), first(0) {}
+ ~StorageOfUsers();
+
+ void SendAllUsers(const char *msg, UserInfo *except = 0,
+ const int spec_msg = system_msg);
+
+ void AddUser(UserInfo *u);
+ void RemoveUser(UserInfo *u);
+ // func for fast clear storage:
+ UserInfo *Disconnect();
+
+ int GetOnline() const { return online; }
+};
+
class ChatServer : public FdHandler {
EventSelector *the_selector;
DatabaseManager *dbase;
@@ -25,6 +47,8 @@ class ChatServer : public FdHandler {
int room_len;
ChatRoom *lobby;
+ StorageOfUsers *talkers;
+
ChatServer(EventSelector *sel, DatabaseManager *db, int fd);
public:
~ChatServer();
@@ -49,15 +73,4 @@ private:
virtual void Handle(bool r, bool w);
};
-/*class StorageOfUsers {
- struct item {
- ChatSession *s;
- item *next;
- }
- item *first;
-public:
- AddSession(ChatSession *s);
- RemoveSession(ChatSession *s);
-};*/
-
#endif \ No newline at end of file