1010class Server ;
1111class Channel ;
1212
13- // NOLINTNEXTLINE(performance-enum-size)
14- enum ClientStatus {
15- UNAUTHENTICATED, // before anything
16- AUTHENTICATED, // after PASS
17- REGISTERED, // after PASS + NICK + USER
18- };
13+ // NOLINTNEXTLINE(performance-enum-size)
14+ // enum ClientStatus {
15+ // UNAUTHENTICATED, // before anything
16+ // AUTHENTICATED, // after PASS
17+ // REGISTERED, // after PASS + NICK + USER
18+ // };
19+ typedef unsigned short ClientStatus;
20+
21+ #define UNAUTHENTICATED 0b00000 // NOLINT
22+ #define AUTHENTICATED 0b00001 // NOLINT
23+ #define REGISTERED 0b00010 // NOLINT
1924
2025class Client
2126{
2227 public:
2328 Client (Socket socket, sockaddr_in addr);
2429 virtual ~Client ();
2530
26-
2731 Socket get_socket () const ;
2832 const std::string& get_address () const ;
2933 unsigned short get_port () const ;
@@ -36,32 +40,32 @@ class Client
3640 std::string get_nickname () const ;
3741 std::string get_user_name () const ;
3842 std::string get_real_name () const ;
39- std::string get_userhost () const ;
40- std::string get_full_userhost () const ;
43+ std::string get_userhost () const ;
44+ std::string get_full_userhost () const ;
4145 ClientStatus get_status () const ;
4246
4347 bool is_registered () const ;
44- bool is_authenticated () const ;
48+ bool is_authenticated () const ;
4549 int get_nb_joined_channels () const ;
4650
4751 void set_nickname (const std::string& nick);
4852 void set_user_name (const std::string& userName);
4953 void set_real_name (const std::string& realName);
5054 void set_status (ClientStatus status);
5155 void add_joined_channel (Channel& channel);
52- void remove_joined_channel (Channel& channel);
56+ void remove_joined_channel (Channel& channel);
5357 void remove_from_all_channels ();
5458 void set_send_buffer (const std::string& buffer);
5559
5660 void append_to_send_buffer (const std::string& msg);
5761 void append_to_read_buffer (const std::string& msg);
5862
59- void broadcast_to_all_channels (Server& server, ReplyCode code, const std::string& params, const std::string& trailing = " " );
60- Channel* get_channel (const std::string& name);
63+ void broadcast_to_all_channels (Server& server, ReplyCode code, const std::string& params, const std::string& trailing = " " );
64+ Channel* get_channel (const std::string& name);
6165
6266 private:
6367 Client (const Client& other);
64- Client& operator =(const Client& other);
68+ Client& operator =(const Client& other);
6569 TcpSocket _socket;
6670 sockaddr_in _addr;
6771 std::string _addrStr;
0 commit comments