feat(core): adding the server info method

This commit is contained in:
Raphael 2025-05-13 12:58:05 +02:00
parent e6e9158d3b
commit a1ffeaddda
3 changed files with 13 additions and 3 deletions

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */ /* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/13 11:06:56 by rparodi #+# #+# */ /* Created: 2025/05/13 11:06:56 by rparodi #+# #+# */
/* Updated: 2025/05/13 11:42:11 by rparodi ### ########.fr */ /* Updated: 2025/05/13 12:54:02 by rparodi ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -22,5 +22,6 @@ class Server {
Server(); Server();
Server(int port, const std::string &password); Server(int port, const std::string &password);
~Server(); ~Server();
void showInfo() const;
unsigned short int getPort() const; unsigned short int getPort() const;
}; };

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */ /* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/13 11:03:13 by rparodi #+# #+# */ /* Created: 2025/05/13 11:03:13 by rparodi #+# #+# */
/* Updated: 2025/05/13 11:56:50 by rparodi ### ########.fr */ /* Updated: 2025/05/13 12:56:52 by rparodi ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -24,6 +24,7 @@ int main(int argc, char *argv[]) {
return 1; return 1;
} }
Server server(tmp_port, argv[2]); Server server(tmp_port, argv[2]);
server.showInfo();
while (1) while (1)
; ;
return 0; return 0;

View file

@ -6,10 +6,11 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */ /* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/13 11:11:07 by rparodi #+# #+# */ /* Created: 2025/05/13 11:11:07 by rparodi #+# #+# */
/* Updated: 2025/05/13 12:00:55 by rparodi ### ########.fr */ /* Updated: 2025/05/13 12:55:21 by rparodi ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "color.hpp"
#include "core.hpp" #include "core.hpp"
#include <iostream> #include <iostream>
@ -41,6 +42,13 @@ Server::~Server() {
std::cout << CLR_GREY << "Info: Server destructor called" << CLR_RESET << std::endl; std::cout << CLR_GREY << "Info: Server destructor called" << CLR_RESET << std::endl;
} }
void Server::showInfo() const {
std::cout << CLR_GREY << "IRCSettings:" << CLR_RESET << std::endl;
std::cout << CLR_GREY << "\t- Port:\t\t" << CLR_GREEN << this->_port << CLR_RESET << std::endl;
std::cout << CLR_GREY << "\t- Password:\t" << CLR_GREEN << this->_password << CLR_RESET << std::endl;
}
/** /**
* @brief The getter of the port. * @brief The getter of the port.
* *