From a5d15a716f6e7e21a67529478f77851d15defe09 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Sun, 13 Dec 2020 18:39:20 +0000 Subject: changes in work spec-symbols have done; server: send info about online and players --- src/server/UserInfo.hpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/server/UserInfo.hpp') diff --git a/src/server/UserInfo.hpp b/src/server/UserInfo.hpp index efe6d5e..b9f851b 100644 --- a/src/server/UserInfo.hpp +++ b/src/server/UserInfo.hpp @@ -7,6 +7,9 @@ #include "ChatRoom.hpp" #include "../const_vars.hpp" +#define STANDARD_USERNAME "0" +#define STANDARD_USERPASS "0" + class ChatServer; enum enum_status { @@ -26,13 +29,15 @@ class UserInfo : FdHandler { char buffer[max_msg_len]; int buf_used; bool ignoring; + int u_list; // user list for show players (see cmd: /prev /next) enum_status state; ChatRoom *the_master; - UserInfo(ChatRoom *i_master, int i_fd) : FdHandler(i_fd), name("0"), - password("0"), buf_used(0), ignoring(false), state(wait_name), - the_master(i_master) {} + UserInfo(ChatRoom *i_master, int i_fd) : FdHandler(i_fd), + name(STANDARD_USERNAME), password(STANDARD_USERPASS), + buf_used(0), ignoring(false), u_list(1), + state(wait_name), the_master(i_master) {} ~UserInfo() {} void SetRoom(ChatRoom *new_master); @@ -43,7 +48,7 @@ class UserInfo : FdHandler { void ReadAndCheck(); void CheckLines(); public: - void Send(const char *msg, const int spec_msg = system_msg); + void Send(const char *msg, const char spec_ch = SYSTEM_CHAR); // === realization in UserInfo_io.cpp === const char *GetName() const; @@ -54,6 +59,9 @@ public: enum_status GetStatus() const { return state; } void SetStatus(const enum_status n_status); + + int GetUserList() const { return u_list; } + void SetUserList(int list); }; #endif \ No newline at end of file -- cgit v1.2.3-18-g5258