commands whois, whowas created and fixed, update ping, nick, commands.cpp, update Server and user
This commit is contained in:
parent
597aed08d8
commit
6ffc1e5534
16 changed files with 250 additions and 34 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/05/20 23:31:58 by rparodi #+# #+# */
|
||||
/* Updated: 2025/06/08 22:57:21 by rparodi ### ########.fr */
|
||||
/* Updated: 2025/06/17 17:36:38 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -63,6 +63,8 @@ namespace cmd
|
|||
class Topic;
|
||||
class Unknown;
|
||||
class userCmd;
|
||||
class Whois;
|
||||
class Whowas;
|
||||
};
|
||||
|
||||
#include "./commands/commands.tpp"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/06/08 22:08:44 by sben-tay #+# #+# */
|
||||
/* Updated: 2025/06/08 22:42:04 by rparodi ### ########.fr */
|
||||
/* Updated: 2025/06/17 17:35:53 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
/* ::: :::::::: */
|
||||
/* commands.tpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/05/24 17:34:30 by rparodi #+# #+# */
|
||||
/* Updated: 2025/05/27 14:34:56 by rparodi ### ########.fr */
|
||||
/* Updated: 2025/06/17 17:36:11 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
22
include/commands/whois.hpp
Normal file
22
include/commands/whois.hpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* whois.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/06/17 14:02:02 by sben-tay #+# #+# */
|
||||
/* Updated: 2025/06/17 14:03:15 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "commands.hpp"
|
||||
|
||||
class cmd::Whois : public ACommand {
|
||||
public:
|
||||
Whois(User *user, Channel *channel, Server *server, std::string &line) : ACommand(user, channel, server, line) {}
|
||||
virtual void execute(void);
|
||||
virtual e_code checkArgs();
|
||||
};
|
||||
22
include/commands/whowas.hpp
Normal file
22
include/commands/whowas.hpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* whowas.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/06/17 17:01:16 by sben-tay #+# #+# */
|
||||
/* Updated: 2025/06/17 17:01:27 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "commands.hpp"
|
||||
|
||||
class cmd::Whowas : public ACommand {
|
||||
public:
|
||||
Whowas(User *user, Channel *channel, Server *server, std::string &line) : ACommand(user, channel, server, line) {}
|
||||
virtual void execute(void);
|
||||
virtual e_code checkArgs();
|
||||
};
|
||||
|
|
@ -6,13 +6,14 @@
|
|||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/05/20 21:50:32 by rparodi #+# #+# */
|
||||
/* Updated: 2025/06/16 18:01:10 by sben-tay ### ########.fr */
|
||||
/* Updated: 2025/06/17 17:36:46 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include "core.hpp"
|
||||
#include "channel.hpp"
|
||||
#include "user.hpp"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/05/20 21:57:49 by rparodi #+# #+# */
|
||||
/* Updated: 2025/06/16 18:36:01 by sben-tay ### ########.fr */
|
||||
/* Updated: 2025/06/17 15:59:19 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -24,6 +24,8 @@ class User
|
|||
std::string _read_buffer;
|
||||
std::string _write_buffer;
|
||||
std::string _username;
|
||||
std::string _realname;
|
||||
std::string _ipAdress;
|
||||
bool _hasNick;
|
||||
bool _hasUser;
|
||||
bool _hasPass;
|
||||
|
|
@ -40,11 +42,15 @@ class User
|
|||
void setRegistered();
|
||||
void appendToReadBuffer(const std::string &data);
|
||||
void appendToWriteBuffer(const std::string &data);
|
||||
void checkRegistration();
|
||||
void resolveHostInfo();
|
||||
|
||||
// setters and getters
|
||||
void setNickname(const std::string &nickname);
|
||||
void setUsername(const std::string &username);
|
||||
void checkRegistration();
|
||||
|
||||
// setters and getters
|
||||
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);
|
||||
|
|
@ -52,6 +58,10 @@ class User
|
|||
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);
|
||||
|
||||
bool hasDataToSend() const;
|
||||
std::string getWriteBuffer() const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue