IRC SERVER
The goal of this project is to make you write your own IRC server.
Operator.hpp
Go to the documentation of this file.
1 #ifndef OPERATOR_H
2 #define OPERATOR_H
3 
4 // Our includes
5 #include "../Mode.hpp"
6 
7 class Operator : public ChannelModeType
8 {
9  public:
11  {
13  }
14 
15  bool validate(void)
16  {
17  if (_params.size() != 3)
18  {
20  return false;
21  }
22 
23  Client *client = _server->getClient(_params[2]);
24  if (client == NULL)
25  {
28  return false;
29  }
30  return true;
31  }
32 
33  void add()
34  {
35  Client *client = _server->getClient(_params[2]);
36  _channel->addOpe(client);
38  }
39 
40  void remove()
41  {
42  Client *client = _server->getClient(_params[2]);
43  _channel->removeOpe(client);
45  }
46 };
47 #endif
ChannelModeType::_sender
Client * _sender
Definition: Mode.hpp:21
CHANNEL_MODE_OPERATOR
@ CHANNEL_MODE_OPERATOR
Definition: Channel.hpp:17
Operator::Operator
Operator()
Definition: Operator.hpp:10
Operator::validate
bool validate(void)
Definition: Operator.hpp:15
ChannelModeType::_mode
ChannelMode _mode
Definition: Mode.hpp:16
Client::message
void message(char const *message)
Definition: client.cpp:15
Operator::remove
void remove()
Definition: Operator.hpp:40
Channel::removeMode
void removeMode(ChannelMode mode)
Definition: Channel.hpp:349
ChannelModeType::_params
std::map< size_t, std::string > _params
Definition: Mode.hpp:20
ChannelModeType
Definition: Mode.hpp:13
ERR_NOSUCHNICK
#define ERR_NOSUCHNICK(servername, nick)
Definition: Replies.hpp:104
ERR_NEEDMOREPARAMS
#define ERR_NEEDMOREPARAMS(servername, nick, command)
Definition: Replies.hpp:131
Operator
Definition: Operator.hpp:7
ERR_USERNOTINCHANNEL
#define ERR_USERNOTINCHANNEL(servername, nick, channel)
Definition: Replies.hpp:124
Channel::removeOpe
void removeOpe(Client *client)
Definition: Channel.hpp:254
Server::getClient
Client * getClient(std::string const &name)
Definition: Server.hpp:140
ChannelModeType::_channel
Channel * _channel
Definition: Mode.hpp:19
Client
Definition: Client.hpp:22
Operator::add
void add()
Definition: Operator.hpp:33
Client::_nick
std::string _nick
Definition: Client.hpp:26
ChannelModeType::_server
Server * _server
Definition: Mode.hpp:22
Client::_servername
std::string _servername
Definition: Client.hpp:30
Channel::addOpe
void addOpe(Client *client)
Definition: Channel.hpp:243
Channel::addMode
void addMode(ChannelMode mode)
Definition: Channel.hpp:343