-
Notifications
You must be signed in to change notification settings - Fork 1
/
cmd.hpp
141 lines (109 loc) · 3.37 KB
/
cmd.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#ifndef CMD_HPP
# define CMD_HPP
# include <iostream>
# include <vector>
# include <cstring>
# include <cstdio>
# include <string>
# include <sstream>
# include <arpa/inet.h>
using namespace std;
class Channel;
class Client;
struct content
{
string cmd;
string arg;
};
class cmd {
private:
int _clntSock;
vector<content> _content;
vector<Client *>& _clntList;
vector<Channel *>& _chList;
string _servPass;
string _chpass;
bool _kflag;
bool& _quit;
public:
cmd(int clntSock, char *buf, int strlen, string servpass, vector<Client *> &clntList, vector<Channel *> &chList, bool &quit);
~cmd();
std::vector<string> *splitCmd(string &str);
void printContent(const vector<content>& content);
int parsecommand();
Channel *addChannel(std::string name);
void delChannel(Channel *channel);
Channel *searchChannel(string channelName);
Client *addClient(int sock);
void delClient(Client *client);
Client *searchClient(int sock);
Client *searchClient(string name);
/* privmsg.cpp */
void privmsg(vector<string> tokens);
void privmsgToChannel(vector<string> tokens);
void privmsgToClient(vector<string> tokens);
/* user.cpp */
void user(string arg);
/* nick.cpp */
void nick(string nick);
bool isNickExist(string nick);
/* pass.cpp */
void pass(string pass);
/* ping.cpp */
void ping();
/* quit.cpp */
void quit(string arg);
/* invite.cpp */
void invite(string arg);
/* join.cpp */
void join(string arg);
void joinWithPass(vector<string> &chList, vector<string> &passList);
void joinNoPass(vector<string> &chList);
void joinNewChannel(Client *me, string channel);
void joinExistChannel(Client *me, Channel *ch, string pass);
/* who.cpp */
void who(string arg);
/* util.cpp */
void noSuchNick(string wrongnick);
void noSuchChannel(string wrongchannel);
bool hasSpecialCharacter(const std::string& str);
void sendNotOpMsg(string channel, string mode, bool flag);
/* privmsg.cpp */
void privmsg(string arg);
void privmsgToClient(string arg, string inputmsg);
void privmsgToChannel(string arg, string inputmsg);
/* topic.cpp */
void topic(string arg);
void settingtopic(string arg, string inputmsg);
/* mode.cpp */
void mode(string arg);
void onlyChannel(string ch_name);
void modeToChannel(string arg, string line);
void modeToClient(string clntName, string opt);
void mode_k(string channel, char option, string pass);
void plusOption_k(string ch_name, string pass);
void minusOption_k(string ch_name, string pass);
void mode_l(string channel, char option, string num);
void plusOption_l(string ch_name, string num);
void minusOption_l(string ch_name);
void mode_o(string channel, char option, string nick);
void plusOption_o(string ch_name, string nick);
void minusOption_o(string ch_name, string nick);
void mode_t(string ch_name, char option);
void mode_i(string ch_name, char option);
void mode_n(string ch_name, char option);
void mode_b(string ch_name, char option);
void error_arg(char c);
/* part.cpp */
void part(string arg);
void execPart(string ch_name, string inputmsg);
/* kick.cpp */
void kick(string arg);
void execKick(string ch_name, string inputmsg);
void emptyChannelClear();
const vector<content>& getContent() const;
/* whois.cpp */
void whois(string nick);
void setQuit(bool val);
};
#endif