IRC SERVER
The goal of this project is to make you write your own IRC server.
|
Go to the documentation of this file.
5 #include "../Command.hpp"
13 _description =
"une al usuario al canal si existe o genera un nuevo "
15 _usage =
"join <canal>{,<canal>} [<clave>{,<clave>}]";
17 _example[1] =
"join #canal1,#canal2 clave1,clave2";
25 if (p.size() < 1 || p.size() > 2)
87 std::map<size_t, std::string> p = message->
getParams();
94 std::vector<std::string> _ch_params =
split(p[0],
",");
95 std::vector<std::string> _pw_params =
split(p[1],
",");
96 std::vector<Message> messages;
97 for (
size_t i = 0; i < _ch_params.size(); i++)
99 std::string _ch_param = _ch_params[i];
100 if (_pw_params.size() > 0 && i < _pw_params.size())
102 std::string tmp(std::string(this->
getName() +
" " + _ch_param +
" " + _pw_params[i]));
103 messages.push_back(
Message(tmp));
107 std::string tmp(std::string(this->
getName() +
" " + _ch_param));
108 messages.push_back(
Message(tmp));
125 std::string topic = channel->
getTopic();
128 (topic.size() > 0 ? topic :
"No topic is set")));
130 std::vector<Client *> clients = channel->
getClients();
131 std::string users_str =
"";
132 for (
size_t i = 0; i < clients.size(); i++)
135 channel->
getClientRoleString(clients[i]) + clients[i]->getNick() + (i == clients.size() - 1 ?
"" :
" ");
145 std::string password = p.size() > 0 ? p[1] : std::string(
"");
Definition: Channel.hpp:26
std::string & getName(void)
Definition: Channel.hpp:82
#define ERR_BADCHANNELKEY(servername, nick, channel)
Definition: Replies.hpp:149
bool validate(void)
Definition: Join.hpp:22
#define ERR_BANNEDFROMCHAN(servername, nick, channel)
Definition: Replies.hpp:147
bool isInvited(Client *client)
Definition: Channel.hpp:225
std::string _description
Definition: Command.hpp:12
void execute()
Definition: Join.hpp:115
std::string & getTopic(void)
Definition: Channel.hpp:87
const std::string getNick(void) const
Definition: Client.hpp:142
std::string _name
Definition: Command.hpp:11
Join()
Definition: Join.hpp:10
std::string getClientRoleString(Client *client)
Definition: Channel.hpp:356
Definition: Command.hpp:7
std::string getCmd(void) const
Definition: message.cpp:74
void message(char const *message)
Definition: client.cpp:15
#define ERR_INVITEONLYCHAN(servername, nick, channel)
Definition: Replies.hpp:145
Channel * createChannel(std::string &name, std::string &password)
Definition: Server.hpp:221
#define ERR_BADCHANMASK(servername, nick)
Definition: Replies.hpp:151
void setCreator(Client *creator)
Definition: Channel.hpp:58
#define RPL_ENDOFNAMES(servername, nick, channel)
Definition: Replies.hpp:85
std::vector< Client * > _normal_clients
Definition: Channel.hpp:43
bool isInviteOnly(void)
Definition: Channel.hpp:231
const std::string getUsername(void) const
Definition: Client.hpp:147
#define MAX_CHANNELS
Definition: config.hpp:6
Message * _message
Definition: Command.hpp:21
std::vector< std::string > split(const std::string &str, const std::string &delimiters)
Definition: functions.cpp:37
#define ERR_TOOMANYCHANNELS(servername, nick, channel)
Definition: Replies.hpp:111
std::string & getPassword(void)
Definition: Channel.hpp:77
#define ERR_NEEDMOREPARAMS(servername, nick, command)
Definition: Replies.hpp:131
std::map< size_t, std::string > _example
Definition: Command.hpp:16
bool isBanned(Client *client)
Definition: Channel.hpp:213
#define RPL_TOPIC(servername, nick, channel, topic)
Definition: Replies.hpp:71
#define RPL_CUSTOM_JOIN(user, channel)
Definition: Replies.hpp:187
std::string getName() const
Definition: Command.hpp:25
std::vector< Message > parser(Message *message)
Definition: Join.hpp:85
std::string getModeString(void)
Definition: Channel.hpp:311
void broadcastMessage(std::string message)
Definition: Channel.hpp:384
std::vector< Client * > getClients(void) const
Definition: Channel.hpp:172
std::vector< Client * > _ope_clients
Definition: Channel.hpp:45
bool joined(Client *client)
Definition: Channel.hpp:183
std::map< size_t, std::string > getParams(void) const
Definition: message.cpp:79
size_t getUserLimit(void)
Definition: Channel.hpp:164
Definition: Message.hpp:12
Channel * getChannel(std::string &name)
Definition: Server.hpp:202
#define RPL_NAMREPLY(servername, nick, symbol, channel, users)
Definition: Replies.hpp:83
std::string _usage
Definition: Command.hpp:13
#define ERR_CHANNELISFULL(servername, nick, channel)
Definition: Replies.hpp:141
const std::string getUserId(void) const
Definition: Client.hpp:162
std::map< std::string, Channel * > getRelatedChannels(Client *client)
Definition: Server.hpp:114
Client * _sender
Definition: Command.hpp:19
#define ERR_USERONCHANNEL(servername, nick, username, channel)
Definition: Replies.hpp:128
std::string _nick
Definition: Client.hpp:26
std::string _servername
Definition: Client.hpp:30
Server * _server
Definition: Command.hpp:20