Merge branch 'master' into raph

This commit is contained in:
Raphaël 2025-05-24 18:03:06 +02:00 committed by GitHub
commit 520814d6bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 357 additions and 225 deletions

View file

@ -1,36 +1,42 @@
/* ************************************************************************** */
/******************************************************************************/
/* */
/* ::: :::::::: */
/* user.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* By: omoudni <omoudni@student.42paris.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/20 21:57:49 by rparodi #+# #+# */
/* Updated: 2025/05/20 22:13:41 by rparodi ### ########.fr */
/* Updated: 2025/05/21 21:16:56 by omoudni ### ########.fr */
/* */
/* ************************************************************************** */
/******************************************************************************/
#pragma once
#include <string>
#include <iostream>
#include "color.hpp"
#include "core.hpp"
class User {
private:
int _fd;
bool _registered;
std::string _nickname;
std::string _hostname;
std::string _read_buffer;
std::string _write_buffer;
public:
int getFd() const;
bool isReadyToSend() const;
bool isRegistered() const;
std::string getName() const;
std::string extractFullCommand();
void appendToReadBuffer(const std::string &data);
void appendToWriteBuffer(const std::string &data);
void setNickname(const std::string &nickname);
class User
{
private:
short unsigned int _fd;
bool _registered;
std::string _nickname;
std::string _hostname;
std::string _read_buffer;
std::string _write_buffer;
std::string _username;
bool _hasNick;
bool _hasUser;
public:
User(short unsigned fd);
short unsigned int getFd() const;
bool isReadyToSend() const;
bool isRegistered() const;
std::string getName() const;
std::string extractFullCommand();
void appendToReadBuffer(const std::string &data);
void appendToWriteBuffer(const std::string &data);
void setNickname(const std::string &nickname);
void setUsername(const std::string &username);
void checkRegistration();
};