oh sa mere
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/21 10:33:17 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/30 21:12:10 by vvaas ### ########.fr */
|
||||
/* Updated: 2024/02/06 10:08:14 by vvaas ### ########.fr */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
@@ -41,7 +41,6 @@ namespace irc
|
||||
|
||||
inline void login() { _logged = true; }
|
||||
inline void register_user() { _registered = true; }
|
||||
inline void welcome() { if (!isLogged() || !isRegistered() || isWelcomed() || _nickname.empty()) return ; _welcomed = true; sendCode(RPL_WELCOME, "Welcome to yipirc :), " + _nickname); }
|
||||
inline void requireDisconnect() { _disconnect_required = true; }
|
||||
|
||||
inline bool isLogged() const { return _logged; }
|
||||
@@ -63,6 +62,7 @@ namespace irc
|
||||
void sendMsg(const std::string& sender, const std::string& cmd, const std::string& trailing);
|
||||
void sendModular(std::string message, ...);
|
||||
void sendCodeInChannel(const std::string& code, const class Channel &chan, const std::string& msg);
|
||||
void welcome(const class Server& server);
|
||||
void kill(const std::string& reason);
|
||||
inline void inviteToChannel(const std::string& channel) { _invites.insert(channel); }
|
||||
inline bool hasBeenInvitedTo(const std::string& channel) { return _invites.erase(channel); }
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
#define ERR_NOLOGIN "444"
|
||||
#define ERR_SUMMONDISABLED "445"
|
||||
#define ERR_USERSDISABLED "446"
|
||||
#define ERR_NOTREGISTERED "451", "You have not registered"
|
||||
#define ERR_NOTREGISTERED "451"
|
||||
#define ERR_NEEDMOREPARAMS "461"
|
||||
#define ERR_ALREADYREGISTRED "462", "Unauthorized command (already registered)"
|
||||
#define ERR_ALREADYREGISTRED "462"
|
||||
#define ERR_NOPERMFORHOST "463"
|
||||
#define ERR_PASSWDMISMATCH "464", "Password incorrect\n"
|
||||
#define ERR_PASSWDMISMATCH "464"
|
||||
#define ERR_YOUREBANNEDCREEP "465"
|
||||
#define ERR_YOUWILLBEBANNED "466"
|
||||
#define ERR_KEYSET "467"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/21 09:12:28 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/30 00:24:49 by vvaas ### ########.fr */
|
||||
/* Updated: 2024/02/06 10:51:18 by vvaas ### ########.fr */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <irc.hpp>
|
||||
#include <unstd/shared_ptr.hpp>
|
||||
#include <config.hpp>
|
||||
#include <channel.hpp>
|
||||
|
||||
namespace irc
|
||||
{
|
||||
@@ -36,6 +37,10 @@ namespace irc
|
||||
|
||||
void wait();
|
||||
|
||||
inline const std::string &getRunDate(void) const { return _run_date; };
|
||||
inline size_t getClientCount(void) const { return _client.size(); };
|
||||
inline size_t getChannelCount(void) const { return _channels.size(); };
|
||||
|
||||
~Server();
|
||||
|
||||
private:
|
||||
@@ -48,9 +53,9 @@ namespace irc
|
||||
void handleInput();
|
||||
|
||||
// ugly as f*ck
|
||||
void handleNick(unstd::SharedPtr<class Client> client, const class Message& msg);
|
||||
void handleUser(unstd::SharedPtr<class Client> client, const class Message& msg);
|
||||
void handlePass(unstd::SharedPtr<class Client> client, const class Message& msg);
|
||||
void handleNick(unstd::SharedPtr<class Client> client, const class Message& msg, const class Server& server);
|
||||
void handleUser(unstd::SharedPtr<class Client> client, const class Message& msg, const class Server& server);
|
||||
void handlePass(unstd::SharedPtr<class Client> client, const class Message& msg, const class Server& server);
|
||||
void handleQuit(unstd::SharedPtr<class Client> client, const class Message& msg);
|
||||
void handlePart(unstd::SharedPtr<class Client> client, const class Message& msg);
|
||||
void handleJoin(unstd::SharedPtr<class Client> client, const class Message& msg);
|
||||
@@ -76,6 +81,7 @@ namespace irc
|
||||
sockaddr_in _s_data;
|
||||
socklen_t _s_len;
|
||||
fd_set _fd_set;
|
||||
std::string _run_date;
|
||||
const std::string _password;
|
||||
const std::string _ip;
|
||||
int _port;
|
||||
|
||||
Reference in New Issue
Block a user