yipiiii
This commit is contained in:
@@ -6,24 +6,31 @@
|
||||
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/21 10:33:17 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/21 16:32:05 by vvaas ### ########.fr */
|
||||
/* Updated: 2024/01/22 01:29:55 by vvaas ### ########.fr */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
#ifndef __CLIENT__
|
||||
#define __CLIENT__
|
||||
|
||||
#include <irc.hpp>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
namespace irc
|
||||
{
|
||||
class Client
|
||||
{
|
||||
public:
|
||||
Client(int fd);
|
||||
|
||||
Client(int fd, sockaddr_in sock, int id);
|
||||
inline int get_fd(void) { return (_fd); }
|
||||
inline void set_fd(int new_fd) { _fd = new_fd; }
|
||||
inline sockaddr_in get_sockaddr(void) { return (_s_data); }
|
||||
inline std::string get_string_id(void) { std::stringstream out; out << _id; return (out.str()); }
|
||||
~Client();
|
||||
|
||||
private:
|
||||
sockaddr_in _s_data;
|
||||
int _fd;
|
||||
int _id;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/21 09:12:28 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/21 17:18:17 by vvaas ### ########.fr */
|
||||
/* Updated: 2024/01/22 01:14:42 by vvaas ### ########.fr */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <vector>
|
||||
#include <irc.hpp>
|
||||
#include <unstd/shared_ptr.hpp>
|
||||
#include <csignal>
|
||||
|
||||
#define MAX_USERS 20
|
||||
namespace irc
|
||||
@@ -28,18 +29,22 @@ namespace irc
|
||||
|
||||
~Server();
|
||||
inline unsigned long get_port(void) { return (htons(_port)); }
|
||||
|
||||
private:
|
||||
void init_socket(void);
|
||||
void wait(void);
|
||||
void init_socket_data(void);
|
||||
void init_signal(void);
|
||||
|
||||
void wait(void);
|
||||
void add_client(int fd);
|
||||
|
||||
void handle_input(void);
|
||||
private:
|
||||
sockaddr_in _s_data;
|
||||
socklen_t _s_len;
|
||||
fd_set _fd_set;
|
||||
|
||||
std::vector<class Channel> _channels;
|
||||
std::vector<unstd::SharedPtr<class Client> > _client;
|
||||
std::vector<class Client> _client;
|
||||
const std::string _password;
|
||||
const std::string _ip;
|
||||
const int _port;
|
||||
|
||||
Reference in New Issue
Block a user