kfc man
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/21 10:34:25 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/22 20:05:52 by maldavid ### ########.fr */
|
||||
/* Updated: 2024/01/23 10:49:35 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -28,13 +28,16 @@ namespace irc
|
||||
inline const std::string& getName() const { return _name; }
|
||||
inline const std::string& getPassword() const { return _password; }
|
||||
|
||||
inline void addClient(unstd::SharedPtr<Client> client) { _clients.insert(client); }
|
||||
inline bool removeClient(unstd::SharedPtr<Client> client) { return _clients.erase(client); }
|
||||
void addClient(unstd::SharedPtr<Client> client);
|
||||
bool removeClient(unstd::SharedPtr<Client> client);
|
||||
|
||||
inline std::size_t getNumberOfClients() const { return _clients.size(); }
|
||||
|
||||
inline void addOperator(unstd::SharedPtr<Client> op) { _operators.insert(op); }
|
||||
inline bool removeOperator(unstd::SharedPtr<Client> op) { return _operators.erase(op); }
|
||||
|
||||
void handleMessage(const std::string& msg, unstd::SharedPtr<Client> client) const;
|
||||
|
||||
inline bool isInviteOnly() const { return _invite_only; }
|
||||
|
||||
void setTopic(unstd::SharedPtr<Client> client, const std::string& new_topic);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/21 10:33:17 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/22 20:41:53 by vvaas ### ########.fr */
|
||||
/* Updated: 2024/01/23 10:30:27 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
@@ -44,7 +44,9 @@ namespace irc
|
||||
|
||||
inline void setFd(int new_fd) { _fd = new_fd; }
|
||||
|
||||
void sendCode(const std::string& code, const std::string &msg);
|
||||
void sendCode(const std::string& code, const std::string& msg);
|
||||
void sendMsg(const std::string& sender, const std::string& cmd, const std::string& trailing);
|
||||
|
||||
~Client();
|
||||
|
||||
private:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/22 09:45:10 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/22 09:46:42 by maldavid ### ########.fr */
|
||||
/* Updated: 2024/01/23 10:22:15 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -15,5 +15,7 @@
|
||||
|
||||
#define INPUT_SIZE 1024
|
||||
#define LOGS_BUFFER_SIZE 4096
|
||||
#define MAX_USERS 20
|
||||
#define NULL_SOCKET -1
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,19 +6,16 @@
|
||||
/* By: vavaas <vavaas@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/29 13:24:01 by vavaas #+# #+# */
|
||||
/* Updated: 2024/01/22 09:46:18 by maldavid ### ########.fr */
|
||||
/* Updated: 2024/01/23 10:14:40 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
#ifndef __IRC__
|
||||
#define __IRC__
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
#include <cstdlib>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/21 09:12:28 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/22 17:30:47 by maldavid ### ########.fr */
|
||||
/* Updated: 2024/01/23 10:21:04 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
#include <vector>
|
||||
#include <irc.hpp>
|
||||
#include <unstd/shared_ptr.hpp>
|
||||
#include <csignal>
|
||||
|
||||
#define MAX_USERS 20
|
||||
#include <config.hpp>
|
||||
|
||||
namespace irc
|
||||
{
|
||||
@@ -28,7 +26,14 @@ namespace irc
|
||||
public:
|
||||
Server(int port, const std::string& password);
|
||||
|
||||
inline void closeMainSocket() { close(_main_socket); _main_socket = 0; _active = false; }
|
||||
inline void closeMainSocket()
|
||||
{
|
||||
if(_main_socket > NULL_SOCKET)
|
||||
close(_main_socket);
|
||||
_main_socket = NULL_SOCKET;
|
||||
_active = false;
|
||||
}
|
||||
|
||||
void wait();
|
||||
|
||||
~Server();
|
||||
|
||||
Reference in New Issue
Block a user