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"
54 void setParams(std::map<size_t, std::string> params)
73 virtual void add() = 0;
101 Type getModelType(
void)
105 return target[0].at(0) ==
'#' ? CHANNEL_MODE : USER_MODE;
108 std::vector<ChannelModeType *> parseChannelMode()
112 std::string modeParams = params[1];
114 std::vector<ChannelModeType *> modes;
116 for (
size_t i = 1; i < modeParams.size(); i++)
119 switch (modeParams[i])
161 modes.push_back(mode);
171 _description =
"add or remove a mode to a channel or user";
172 _usage =
"mode <canal> {[+|-]|o|p|s|i|t|n|b|v} [<límite>] "
173 "[<usuario>] [<máscara de ban>]";
174 _example[0] =
"mode #canal +o nick";
185 if (params.size() < 1)
191 if (_channel == NULL)
196 else if (params.size() > 2 && _channel->
isOpe(
_sender) ==
false)
203 std::vector<ChannelModeType *> modes = parseChannelMode();
204 for (
size_t i = 0; i < modes.size(); i++)
221 if (params.size() == 1)
230 Type type = getModelType();
231 if (type == CHANNEL_MODE)
233 std::vector<ChannelModeType *> modes = parseChannelMode();
234 std::vector<ChannelModeType *>::iterator it;
236 for (
size_t i = 0; i < modes.size(); i++)
244 else if (type == USER_MODE)
Definition: Channel.hpp:26
char getIdentifier(ChannelMode _mode)
Definition: Channel.hpp:112
std::string & getName(void)
Definition: Channel.hpp:82
@ MINUS
Definition: Mode.hpp:10
void setChannel(Channel *channel)
Definition: Mode.hpp:49
Client * _sender
Definition: Mode.hpp:21
bool isOpe(Client *client)
Definition: Channel.hpp:195
#define ERR_NOSUCHCHANNEL(servername, nick, channel)
Definition: Replies.hpp:107
@ PLUS
Definition: Mode.hpp:9
std::string _description
Definition: Command.hpp:12
ChannelMode
Definition: Channel.hpp:6
ChannelModeType()
Definition: Mode.hpp:25
void setSender(Client *sender)
Definition: Mode.hpp:59
std::string _name
Definition: Command.hpp:11
void setServer(Server *server)
Definition: Mode.hpp:64
virtual ~ChannelModeType()
Definition: Mode.hpp:76
Definition: Command.hpp:7
ChannelMode _mode
Definition: Mode.hpp:16
virtual bool validate(void)
Definition: Mode.hpp:69
void message(char const *message)
Definition: client.cpp:15
Definition: BanMask.hpp:7
std::string getStringModes(void)
Definition: Channel.hpp:151
#define RPL_CHANNELMODEIS(servername, nick, channel, modes)
Definition: Replies.hpp:65
void execute()
Definition: Mode.hpp:217
void execute()
Definition: Mode.hpp:27
std::map< size_t, std::string > _params
Definition: Mode.hpp:20
Mode()
Definition: Mode.hpp:168
Definition: InviteOnly.hpp:7
Message * _message
Definition: Command.hpp:21
Definition: UserLimit.hpp:7
#define ERR_CHANOPRIVSNEEDED(servername, nick, channel)
Definition: Replies.hpp:154
#define ERR_NEEDMOREPARAMS(servername, nick, command)
Definition: Replies.hpp:131
std::map< size_t, std::string > _example
Definition: Command.hpp:16
void setSign(ModeSign sign)
Definition: Mode.hpp:44
Definition: Operator.hpp:7
Definition: Moderated.hpp:7
ModeSign
Definition: Mode.hpp:7
char _identifier
Definition: Mode.hpp:17
void setParams(std::map< size_t, std::string > params)
Definition: Mode.hpp:54
void broadcastMessage(std::string message)
Definition: Channel.hpp:384
Definition: TopicSettableByChannelOperatorOnly.hpp:7
Channel * _channel
Definition: Mode.hpp:19
std::map< size_t, std::string > getParams(void) const
Definition: message.cpp:79
Definition: CantSentMessagesOutside.hpp:7
Channel * getChannel(std::string &name)
Definition: Server.hpp:202
Definition: Client.hpp:22
std::string _usage
Definition: Command.hpp:13
#define RPL_CUSTOM_MODE(user, channel, mode)
Definition: Replies.hpp:190
const std::string getUserId(void) const
Definition: Client.hpp:162
Client * _sender
Definition: Command.hpp:19
void setMode(ChannelMode mode)
Definition: Mode.hpp:39
Definition: Server.hpp:32
std::string _nick
Definition: Client.hpp:26
Server * _server
Definition: Mode.hpp:22
std::string _servername
Definition: Client.hpp:30
bool validate()
Definition: Mode.hpp:181
Server * _server
Definition: Command.hpp:20
ModeSign _sign
Definition: Mode.hpp:18