From ffd650da204a482a117b9f1f59e3573c85d67346 Mon Sep 17 00:00:00 2001 From: aortigos Date: Fri, 8 May 2026 16:27:00 +0200 Subject: [PATCH] Fixed syntax and operator= --- User/User.cpp | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/User/User.cpp b/User/User.cpp index c9c2049..c125fd8 100644 --- a/User/User.cpp +++ b/User/User.cpp @@ -31,7 +31,13 @@ User& User::operator=(const User &other) { if (this != &other) { - // Copy attributes here + fd = other.fd; + nick = other.nick; + username = other.username; + realname = other.realname; + buffer = other.buffer; + authenticated = other.authenticated; + registered = other.registered; } // std::cout << "User copy assignment operator called" << std::endl; return (*this); @@ -44,22 +50,22 @@ User::~User() // Getters -int User::getFd() const { return (this->fd) }; -std::string User::getNick() const { return (this->nick) }; -std::string User::getUsername() const { return (this->username) }; -std::string User::getRealname() const { return (this->realname) }; -std::string &User::getBuffer() { return (this->buffer) }; -bool User::isAuthenticated() const { return (this->authenticated) }; -bool User::isRegistered() const { return (this->registered) }; +int User::getFd() const { return (this->fd); }; +std::string User::getNick() const { return (this->nick); }; +std::string User::getUsername() const { return (this->username); }; +std::string User::getRealname() const { return (this->realname); }; +std::string &User::getBuffer() { return (this->buffer); }; +bool User::isAuthenticated() const { return (this->authenticated); }; +bool User::isRegistered() const { return (this->registered); }; // Setters -void setNick(std::string nick) { this->nick = nick; } -void setUsername(std::string username) { this->username = username; } -void setRealname(std::string realname) { this->realname = realname; } -void appendBuffer(std::string buff) { this->buffer = buff; } -void clearBuffer() { this->buffer.clear(); } +void User::setNick(std::string nick) { this->nick = nick; } +void User::setUsername(std::string username) { this->username = username; } +void User::setRealname(std::string realname) { this->realname = realname; } +void User::appendBuffer(std::string buff) { this->buffer = buff; } +void User::clearBuffer() { this->buffer.clear(); } -void setAuthenticated(bool value) { this->authenticated = value; } -void setRegistered(bool value) { this->registered = value; } \ No newline at end of file +void User::setAuthenticated(bool value) { this->authenticated = value; } +void User::setRegistered(bool value) { this->registered = value; } \ No newline at end of file