IRC SERVER
The goal of this project is to make you write your own IRC server.
|
Go to the documentation of this file.
45 Client(
int &fd, std::string host, std::string servername, std::string version)
53 std::cout <<
C_RED <<
"Client " <<
_nick <<
" disconnected" C_X << std::endl;
71 std::vector<std::string> motd;
77 while (std::getline(data, line))
88 std::string support =
"";
89 std::vector<std::string> motd =
readConfigFile(
"./config/support");
91 for (std::vector<std::string>::iterator it = motd.begin(); it != motd.end(); ++it)
95 return support.substr(0, support.size() - 1);
108 for (std::vector<std::string>::iterator it = motd.begin(); it != motd.end(); ++it)
204 return std::find(this->_modes.begin(), this->_modes.end(), mode) !=
211 this->_modes.push_back(mode);
#define RPL_MOTDSTART(servername, nick)
Definition: Replies.hpp:92
ClientStatus _status
Definition: Client.hpp:40
Client(int &fd, std::string host, std::string servername, std::string version)
Definition: Client.hpp:45
void read(void)
Definition: client.cpp:28
bool hasMode(UserMode mode)
Definition: Client.hpp:202
std::string _serverversion
Definition: Client.hpp:32
std::vector< std::string > readConfigFile(char const *filename)
Definition: Client.hpp:69
void loginFail(void)
Definition: Client.hpp:114
bool isOperator(void)
Definition: Client.hpp:177
void disconnect(void)
Definition: Client.hpp:60
std::vector< Message > _messagesReceived
Definition: Client.hpp:34
void ban(void)
Definition: Client.hpp:64
std::vector< Message > _messagesSent
Definition: Client.hpp:33
#define C_RED
Definition: Color.hpp:6
std::string _username
Definition: Client.hpp:27
const std::string getNick(void) const
Definition: Client.hpp:142
#define ERR_YOUREBANNEDCREEP(servername, nick)
Definition: Replies.hpp:137
#define RPL_ENDOFMOTD(servername, nick)
Definition: Replies.hpp:96
const std::string getHost(void) const
Definition: Client.hpp:157
bool isRegistered(void)
Definition: Client.hpp:182
~Client()
Definition: Client.hpp:49
void message(char const *message)
Definition: client.cpp:15
std::vector< UserMode > _modes
Definition: Client.hpp:42
const std::string getServername(void) const
Definition: Client.hpp:167
bool isAuthenticated(void) const
Definition: Client.hpp:132
std::string _host
Definition: Client.hpp:29
std::string getSupportString(void)
Definition: Client.hpp:86
void setUsername(std::string const &username)
Definition: Client.hpp:192
#define RPL_WELCOME(servername, nick)
Definition: Replies.hpp:16
std::vector< Message > messagesSent() const
Definition: Client.hpp:122
bool isInvisible(void)
Definition: Client.hpp:172
Message * _message
Definition: Client.hpp:41
@ USER_MODE_REGISTERED
Definition: Client.hpp:19
const std::string getUsername(void) const
Definition: Client.hpp:147
#define MAX_CHANNELS
Definition: config.hpp:6
std::vector< Message > messagesReceived() const
Definition: Client.hpp:127
@ USER_MODE_INVISIBLE
Definition: Client.hpp:17
int _attempts
Definition: Client.hpp:39
void setNick(std::string const &nick)
Definition: Client.hpp:188
bool _is_ope
Definition: Client.hpp:37
bool _is_passLogged
Definition: Client.hpp:36
#define RPL_CREATED(servername, nick)
Definition: Replies.hpp:20
#define RPL_YOURHOST(servername, nick, version)
Definition: Replies.hpp:18
const int _maxChannels
Definition: Client.hpp:38
std::string _realname
Definition: Client.hpp:28
#define RPL_MYINFO(servername, nick, version, usermodes, chanmodes)
Definition: Replies.hpp:22
ClientStatus
Definition: config.hpp:12
UserMode
Definition: Client.hpp:15
Definition: Message.hpp:12
#define MAX_ATTEMPTS
Definition: config.hpp:8
Definition: Client.hpp:22
void addMode(UserMode mode)
Definition: Client.hpp:208
#define RPL_ISUPPORT(servername, nick, tokens)
Definition: Replies.hpp:24
const std::string getUserId(void) const
Definition: Client.hpp:162
bool canPerformPassCommand(void) const
Definition: Client.hpp:137
void setRealName(std::string const &realname)
Definition: Client.hpp:196
const std::string getRealname(void) const
Definition: Client.hpp:152
@ ALIVE
Definition: config.hpp:14
@ USER_MODE_OPERATOR
Definition: Client.hpp:18
std::string _nick
Definition: Client.hpp:26
int _fd
Definition: Client.hpp:25
#define C_X
Definition: Color.hpp:4
std::string _servername
Definition: Client.hpp:30
#define RPL_MOTD(servername, nick, motd)
Definition: Replies.hpp:94
void authenticate(void)
Definition: Client.hpp:98
bool _is_authenticated
Definition: Client.hpp:35