Merge pull request #29 from EniumRaphael/samy
🛠️ Patch Notes — ft_irc v1.3.6
This commit is contained in:
commit
94bf51a9fb
4 changed files with 25 additions and 27 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/05/20 21:57:49 by rparodi #+# #+# */
|
||||
/* Updated: 2025/06/19 02:22:55 by sben-tay ### ########.fr */
|
||||
/* Updated: 2025/06/20 19:17:53 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -39,38 +39,39 @@ class User
|
|||
public:
|
||||
User(short unsigned fd, PollManager& poll);
|
||||
short unsigned int getFd() const;
|
||||
bool isReadyToSend() const;
|
||||
bool isRegistered() const;
|
||||
std::string getName() const;
|
||||
std::string extractFullCommand();
|
||||
void setRegistered();
|
||||
void appendToReadBuffer(const std::string &data);
|
||||
void appendToWriteBuffer(const std::string &data);
|
||||
std::string extractFullCommand();
|
||||
void checkRegistration();
|
||||
void resolveHostInfo();
|
||||
|
||||
// setters and getters
|
||||
void setRegistered();
|
||||
void setNickname(const std::string &nickname);
|
||||
void setUsername(const std::string &username);
|
||||
void setRealname(const std::string &realname);
|
||||
std::string getUsername(void) const;
|
||||
std::string getRealname(void) const;
|
||||
void setHasNick(bool value);
|
||||
void setHasUser(bool value);
|
||||
void setHasPass(bool value);
|
||||
void setPassReceived(bool value);
|
||||
void setPassIsValid(bool value);
|
||||
bool getHasPass() const;
|
||||
std::string getNickname() const;
|
||||
const std::string& getHostname() const;
|
||||
const std::string& getIpAddress() const;
|
||||
void setHostname(const std::string &hostname);
|
||||
void setIpAddress(const std::string &ip);
|
||||
const std::string getUsername(void) const;
|
||||
const std::string getRealname(void) const;
|
||||
const std::string getNickname() const;
|
||||
const std::string getWriteBuffer() const;
|
||||
const std::string& getHostname() const;
|
||||
const std::string& getIpAddress() const;
|
||||
const std::string getName() const;
|
||||
const std::string getPrefix() const;
|
||||
|
||||
bool hasDataToSend() const;
|
||||
std::string getWriteBuffer() const;
|
||||
bool getHasPass() const;
|
||||
bool isReadyToSend() const;
|
||||
bool isRegistered() const;
|
||||
|
||||
void clearWriteBuffer();
|
||||
void consumeWriteBuffer(size_t len);
|
||||
|
||||
std::string getPrefix() const;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/06/08 22:10:24 by sben-tay #+# #+# */
|
||||
/* Updated: 2025/06/18 12:54:41 by rparodi ### ########.fr */
|
||||
/* Updated: 2025/06/20 19:18:52 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -21,7 +21,6 @@ e_code Cap::checkArgs() {
|
|||
this->_sender->appendToWriteBuffer(msg461);
|
||||
return ERR_NEEDMOREPARAMS;
|
||||
}
|
||||
_sender->appendToReadBuffer(_command);
|
||||
return (_PARSING_OK);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/05/13 11:11:07 by rparodi #+# #+# */
|
||||
/* Updated: 2025/06/20 15:13:42 by sben-tay ### ########.fr */
|
||||
/* Updated: 2025/06/20 19:19:42 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -106,11 +106,9 @@ void Server::start()
|
|||
_users[fd]->appendToReadBuffer(data);
|
||||
std::string rawCmd;
|
||||
|
||||
DEBUG_MSG("cmd = " << _users[fd]->extractFullCommand());
|
||||
while (!(rawCmd = _users[fd]->extractFullCommand()).empty()) {
|
||||
std::vector<std::string> lines = splitLines(rawCmd);
|
||||
for (size_t i = 0; i < lines.size(); ++i) {
|
||||
DEBUG_MSG("cmd = " << _users[fd]->extractFullCommand());
|
||||
std::cout << "Client " << fd << " says: " << lines[i] << std::endl;
|
||||
cmd::dispatch(_users[fd], NULL, this, lines[i]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/05/21 20:37:12 by omoudni #+# #+# */
|
||||
/* Updated: 2025/06/20 13:40:14 by sben-tay ### ########.fr */
|
||||
/* Updated: 2025/06/20 19:18:27 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ short unsigned int User::getFd() const { return this->_fd; }
|
|||
*
|
||||
* @return the actual nickname of the user
|
||||
*/
|
||||
std::string User::getName() const {
|
||||
const std::string User::getName() const {
|
||||
return this->_nickname;
|
||||
}
|
||||
|
||||
|
|
@ -151,17 +151,17 @@ void User::setPassIsValid(bool value) { _passIsValid = value; }
|
|||
|
||||
bool User::getHasPass() const { return _hasPass; }
|
||||
|
||||
std::string User::getNickname() const { return _nickname; }
|
||||
const std::string User::getNickname() const { return _nickname; }
|
||||
|
||||
bool User::hasDataToSend() const { return !_write_buffer.empty(); }
|
||||
|
||||
std::string User::getWriteBuffer() const { return _write_buffer; }
|
||||
const std::string User::getWriteBuffer() const { return _write_buffer; }
|
||||
|
||||
void User::clearWriteBuffer() { _write_buffer.clear(); }
|
||||
|
||||
std::string User::getPrefix() const { return _nickname + "!" + _username + "@" + _hostname; }
|
||||
const std::string User::getPrefix() const { return _nickname + "!" + _username + "@" + _hostname; }
|
||||
|
||||
std::string User::getUsername() const { return _username; }
|
||||
const std::string User::getUsername() const { return _username; }
|
||||
|
||||
const std::string& User::getHostname() const { return _hostname; }
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ void User::resolveHostInfo()
|
|||
|
||||
void User::setRealname(const std::string &realname) { _realname = realname; }
|
||||
|
||||
std::string User::getRealname(void) const { return _realname; }
|
||||
const std::string User::getRealname(void) const { return _realname; }
|
||||
|
||||
void User::consumeWriteBuffer(size_t len) {
|
||||
if (len >= _write_buffer.size())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue