IRC SERVER
The goal of this project is to make you write your own IRC server.
Replies.hpp
Go to the documentation of this file.
1 /* ************************************************************************** */
2 /* */
3 /* ::: :::::::: */
4 /* Replies.hpp :+: :+: :+: */
5 /* +:+ +:+ +:+ */
6 /* By: aborboll <[email protected]> +#+ +:+ +#+ */
7 /* +#+#+#+#+#+ +#+ */
8 /* Created: 2022/04/24 12:22:18 by aborboll #+# #+# */
9 /* Updated: 2023/04/18 16:12:15 by aborboll ### ########.fr */
10 /* */
11 /* ************************************************************************** */
12 
13 #ifndef REPLIES_HPP
14 #define REPLIES_HPP
15 
16 #define RPL_WELCOME(servername, nick) \
17  ":" + servername + " 001 " + nick + " :Welcome to the Internet Relay Network " + nick + "\n"
18 #define RPL_YOURHOST(servername, nick, version) \
19  ":" + servername + " 002 " + nick + " :Your host is " + servername + ", running version " + version + "\n"
20 #define RPL_CREATED(servername, nick) \
21  ":" + servername + " 003 " + nick + " :This server was created January 1st, 1970\n"
22 #define RPL_MYINFO(servername, nick, version, usermodes, chanmodes) \
23  ":" + servername + " 004 " + nick + " " + servername + " " + version + " " + usermodes + " " + chanmodes + " :" + servername + " server\n"
24 #define RPL_ISUPPORT(servername, nick, tokens) \
25  ":" + servername + " 005 " + nick + " " + tokens + " :are supported by this server\n"
26 #define RPL_BOUNCE 010
27 #define RPL_UMODEIS 221
28 #define RPL_LUSERCLIENT 251
29 #define RPL_LUSEROP 252
30 #define RPL_LUSERUNKNOWN 253
31 #define RPL_LUSERCHANNELS 254
32 #define RPL_LUSERME 255
33 #define RPL_ADMINME 256
34 #define RPL_ADMINLOC1 257
35 #define RPL_ADMINLOC2 258
36 #define RPL_ADMINEMAIL 259
37 #define RPL_TRYAGAIN 263
38 #define RPL_LOCALUSERS 265
39 #define RPL_GLOBALUSERS 266
40 #define RPL_WHOISCERTFP 276
41 #define RPL_NONE 300
42 #define RPL_AWAY 301
43 #define RPL_USERHOST 302
44 #define RPL_UNAWAY 305
45 #define RPL_NOWAWAY 306
46 #define RPL_WHOREPLY 352
47 #define RPL_ENDOFWHO 315
48 #define RPL_WHOISREGNICK 307
49 #define RPL_WHOISUSER(servername, nick, user, host, realname) \
50  ":" + servername + " 311 " + nick + " " + user + " " + host + " * :" + realname + "\n"
51 #define RPL_WHOISSERVER 312
52 #define RPL_WHOISOPERATOR 313
53 #define RPL_WHOWASUSER 314
54 #define RPL_WHOISIDLE 317
55 #define RPL_ENDOFWHOIS 318
56 #define RPL_WHOISCHANNELS(servername, nick, mode, channel) \
57  ":" + servername + " 311 " + nick + " " + mode + " #" + channel + "\n"
58 #define RPL_WHOISSPECIAL 320
59 #define RPL_LISTSTART(servername, nick) \
60  ":" + servername + " 321 " + nick + " Channel :Users Name\n"
61 #define RPL_LIST(servername, nick, channel, users, topic) \
62  ":" + servername + " 322 " + nick + " #" + channel + " " + users + " :" + topic + "\n"
63 #define RPL_LISTEND(servername, nick) \
64  ":" + servername + " 323 " + nick + " :End of /LIST\n"
65 #define RPL_CHANNELMODEIS(servername, nick, channel, modes) \
66  ":" + servername + " 324 " + nick + " #" + channel + " +" + modes + "\n"
67 #define RPL_CREATIONTIME 329
68 #define RPL_WHOISACCOUNT 330
69 #define RPL_NOTOPIC(servername, nick, channel) \
70  ":" + servername + " 331 " + nick + " #" + channel + " :No topic is set\n"
71 #define RPL_TOPIC(servername, nick, channel, topic) \
72  ":" + servername + " 332 " + nick + " #" + channel + " :" + topic + "\n"
73 #define RPL_TOPICWHOTIME(servername, nick, channel, user, time) \
74  ":" + servername + " 333 " + nick + " #" + channel + " " + user + " " + time + "\n"
75 #define RPL_WHOISACTUALLY 338
76 #define RPL_INVITING(servername, nick, channel, user) \
77  ":" + servername + " 341 " + nick + " #" + channel + " " + user + "\n"
78 #define RPL_INVITELIST 346
79 #define RPL_ENDOFINVITELIST 347
80 #define RPL_EXCEPTLIST 348
81 #define RPL_ENDOFEXCEPTLIST 349
82 #define RPL_VERSION 351
83 #define RPL_NAMREPLY(servername, nick, symbol, channel, users) \
84  ":" + servername + " 353 " + nick + " " + symbol + " #" + channel + " :" + users + "\n"
85 #define RPL_ENDOFNAMES(servername, nick, channel) \
86  ":" + servername + " 366 " + nick + " #" + channel + " :End of /NAMES list\n"
87 #define RPL_BANLIST 367
88 #define RPL_ENDOFBANLIST 368
89 #define RPL_ENDOFWHOWAS 369
90 #define RPL_INFO 371
91 #define RPL_ENDOFINFO 374
92 #define RPL_MOTDSTART(servername, nick) \
93  ":" + servername + " 375 " + nick + " :- " + servername + " Message of the day - \n"
94 #define RPL_MOTD(servername, nick, motd) \
95  ":" + servername + " 372 " + nick + " :- " + motd + "\n"
96 #define RPL_ENDOFMOTD(servername, nick) \
97  ":" + servername + " 376 " + nick + " :End of /MOTD command\n"
98 #define RPL_WHOISHOST 378
99 #define RPL_WHOISMODES 379
100 #define RPL_YOUREOPER 381
101 #define RPL_REHASHING 382
102 #define RPL_TIME 391
103 #define ERR_UNKNOWNERROR 400
104 #define ERR_NOSUCHNICK(servername, nick) \
105  ":" + servername + " 401 " + nick + " :No such nick/channel\n"
106 #define ERR_NOSUCHSERVER 402
107 #define ERR_NOSUCHCHANNEL(servername, nick, channel) \
108  ":" + servername + " 403 " + nick + " #" + channel + " :No such channel\n"
109 #define ERR_CANNOTSENDTOCHAN(servername, nick, channel) \
110  ":" + servername + " 404 " + nick + " #" + channel + " :Cannot send to channel\n"
111 #define ERR_TOOMANYCHANNELS(servername, nick, channel) \
112  ":" + servername + " 405 " + nick + " #" + channel + " :You have joined too many channels\n"
113 #define ERR_WASNOSUCHNICK 406
114 #define ERR_NOORIGIN 409
115 #define ERR_INPUTTOOLONG 417
116 #define ERR_UNKNOWNCOMMAND 421
117 #define ERR_NOMOTD 422
118 #define ERR_NONICKNAMEGIVEN(servername) \
119  ":" + servername + " 431 " + servername + " :No nickname given\n"
120 #define ERR_ERRONEUSNICKNAME(servername, nick) \
121  ":" + servername + " 432 * " + nick + " :Erroneous nickname\n"
122 #define ERR_NICKNAMEINUSE(servername, nick) \
123  ":" + servername + " 433 * " + nick + " :Nickname is already in use\n"
124 #define ERR_USERNOTINCHANNEL(servername, nick, channel) \
125  ":" + servername + " 441 * " + nick + " #" + channel + " :They aren't on that channel\n"
126 #define ERR_NOTONCHANNEL(servername, nick, channel) \
127  ":" + servername + " 442 * " + nick + " #" + channel + " :You're not on that channel\n"
128 #define ERR_USERONCHANNEL(servername, nick, username, channel) \
129  ":" + servername + " 443 * " + nick + " " + username + " #" + channel + " :is already on channel\n"
130 #define ERR_NOTREGISTERED 451
131 #define ERR_NEEDMOREPARAMS(servername, nick, command) \
132  ":" + servername + " 461 " + nick + " " + command + " :Wrong num parameters\n"
133 #define ERR_ALREADYREGISTRED(servername, nick) \
134  ":" + servername + " 462 " + nick + " :You may not reregister\n"
135 #define ERR_PASSWDMISMATCH(servername, nick) \
136  ":" + servername + " 464 " + nick + " :Password incorrect\n"
137 #define ERR_YOUREBANNEDCREEP(servername, nick) \
138  ":" + servername + " 465 " + nick + " :You are banned from this server\n"
139 #define ERR_KEYSET(servername, nick, channel) \
140  ":" + servername + " 467 " + nick + " #" + channel + " :Channel key already set\n"
141 #define ERR_CHANNELISFULL(servername, nick, channel) \
142  ":" + servername + " 471 " + nick + " #" + channel + " :Cannot join channel , channel is full(+l)\n"
143 #define ERR_UNKNOWNMODE(servername, nick, mode) \
144  ":" + servername + " 472 " + nick + " " + mode + " :is unknown mode char to me for that channel\n"
145 #define ERR_INVITEONLYCHAN(servername, nick, channel) \
146  ":" + servername + " 473 " + nick + " #" + channel + " :Cannot join channel (+i)\n"
147 #define ERR_BANNEDFROMCHAN(servername, nick, channel) \
148  ":" + servername + " 474 " + nick + " #" + channel + " :Cannot join channel (+b)\n"
149 #define ERR_BADCHANNELKEY(servername, nick, channel) \
150  ":" + servername + " 475 " + nick + " #" + channel + " :Bad channel key\n"
151 #define ERR_BADCHANMASK(servername, nick) \
152  ":" + servername + " 476 * " + nick + " :Bad Channel Mask\n"
153 #define ERR_NOPRIVILEGES 481
154 #define ERR_CHANOPRIVSNEEDED(servername, nick, channel) \
155  ":" + servername + " 482 " + nick + " #" + channel + " :You're not channel operator\n"
156 #define ERR_CANTKILLSERVER 483
157 #define ERR_NOOPERHOST 491
158 #define ERR_UMODEUNKNOWNFLAG 501
159 #define ERR_USERSDONTMATCH(servername, nick) \
160  ":" + servername + " 502 " + nick + " :Cant change mode for other users\n"
161 #define ERR_HELPNOTFOUND 524
162 #define ERR_INVALIDKEY 525
163 #define RPL_STARTTLS 670
164 #define RPL_WHOISSECURE 671
165 #define ERR_STARTTLS 691
166 #define ERR_INVALIDMODEPARAM 696
167 #define RPL_HELPSTART 704
168 #define RPL_HELPTXT 705
169 #define RPL_ENDOFHELP 706
170 #define ERR_NOPRIVS 723
171 #define RPL_LOGGEDIN 900
172 #define RPL_LOGGEDOUT 901
173 #define ERR_NICKLOCKED 902
174 #define RPL_SASLSUCCESS 903
175 #define ERR_SASLFAIL 904
176 #define ERR_SASLTOOLONG 905
177 #define ERR_SASLABORTED 906
178 #define ERR_SASLALREADY 907
179 #define RPL_SASLMECHS 908
180 
181 // FICTICIAS
182 #define ERR_WRONGPASS(servername, nick) \
183  ":" + servername + " " + nick + " :Wrong pass\n"
184 #define ERR_NOTPASSNEEDED(servername, nick) \
185  ":" + servername + " " + nick + " :This server does not need any pass\n"
186 
187 #define RPL_CUSTOM_JOIN(user, channel) ":" + user + " JOIN #" + channel + "\n"
188 #define RPL_CUSTOM_KICK(user, channel, nick, reason) \
189  ":" + user + " KICK #" + channel + " " + nick + " :" + reason + "\n"
190 #define RPL_CUSTOM_MODE(user, channel, mode) \
191  ":" + user + " MODE #" + channel + " " + mode + "\n"
192 #define RPL_CUSTOM_INVITE(user, channel, nick) \
193  ":" + user + " INVITE " + nick + " #" + channel + "\n"
194 #endif