1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2021 ircd-hybrid development team
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 * USA
20 */
21
22 /*! \file numeric.c
23 * \brief Declarations of numeric replies.
24 * \version $Id: numeric.c 9858 2021-01-01 04:43:42Z michael $
25 */
26
27 #include "stdinc.h"
28 #include "numeric.h"
29
30
31 static const char *const replies[] =
32 {
33 /* 001 */ [RPL_WELCOME] = ":Welcome to the %s Internet Relay Chat Network %s!%s@%s",
34 /* 002 */ [RPL_YOURHOST] = ":Your host is %s, running version %s",
35 /* 003 */ [RPL_CREATED] = ":This server was created %s",
36 /* 004 */ [RPL_MYINFO] = "%s %s %s bchiklmnoprstuveCIKLMNORST bkloveIh",
37 /* 005 */ [RPL_ISUPPORT] = "%s :are supported by this server",
38 /* 010 */ [RPL_REDIR] = "%s %u :Please use this Server/Port instead",
39 /* 015 */ [RPL_MAP] = ":%s%s",
40 /* 016 */ [RPL_MAPMORE] = ":%s%s --> *more*",
41 /* 017 */ [RPL_MAPEND] = ":End of /MAP",
42 /* 200 */ [RPL_TRACELINK] = "Link %s %s %s",
43 /* 201 */ [RPL_TRACECONNECTING] = "Try. %s %s",
44 /* 202 */ [RPL_TRACEHANDSHAKE] = "H.S. %s %s",
45 /* 203 */ [RPL_TRACEUNKNOWN] = "???? %s %s (%s) %ju",
46 /* 204 */ [RPL_TRACEOPERATOR] = "Oper %s %s (%s) %ju %u",
47 /* 205 */ [RPL_TRACEUSER] = "User %s %s (%s) %ju %u",
48 /* 206 */ [RPL_TRACESERVER] = "Serv %s %uS %uC %s %s!%s@%s %ju",
49 /* 208 */ [RPL_TRACENEWTYPE] = "<newtype> 0 %s",
50 /* 209 */ [RPL_TRACECLASS] = "Class %s %u",
51 /* 211 */ [RPL_STATSLINKINFO] = "%s %u %u %ju %u %ju :%ju %ju %s",
52 /* 212 */ [RPL_STATSCOMMANDS] = "%s %u %ju %u %u",
53 /* 213 */ [RPL_STATSCLINE] = "%c %s %s %s %u %s",
54 /* 215 */ [RPL_STATSILINE] = "%c %s * %s@%s %u %s",
55 /* 216 */ [RPL_STATSKLINE] = "%c %s * %s :%s",
56 /* 217 */ [RPL_STATSQLINE] = "%c %s :%s",
57 /* 218 */ [RPL_STATSYLINE] = "%c %s %u %u %u %u %u %u %u/%u %u/%u %s",
58 /* 219 */ [RPL_ENDOFSTATS] = "%c :End of /STATS report",
59 /* 220 */ [RPL_STATSPLINE] = "%c %d %s %d %s :%s",
60 /* 221 */ [RPL_UMODEIS] = "%s",
61 /* 225 */ [RPL_STATSDLINE] = "%c %s :%s",
62 /* 226 */ [RPL_STATSALINE] = "%s",
63 /* 227 */ [RPL_STATSPSEUDO] = "s %s %s %s@%s :%s",
64 /* 241 */ [RPL_STATSLLINE] = "%c %s * %s %u %s",
65 /* 242 */ [RPL_STATSUPTIME] = ":Server Up %s",
66 /* 243 */ [RPL_STATSOLINE] = "%c %s@%s * %s %s %s",
67 /* 244 */ [RPL_STATSHLINE] = "%c %s * %s %u %s",
68 /* 245 */ [RPL_STATSTLINE] = "T %s %s",
69 /* 246 */ [RPL_STATSSERVICE] = "S %s * %s %u %u",
70 /* 247 */ [RPL_STATSXLINE] = "%c %s :%s",
71 /* 248 */ [RPL_STATSULINE] = "U %s %s@%s %s",
72 /* 250 */ [RPL_STATSCONN] = ":Highest connection count: %u (%u clients) (%ju connections received)",
73 /* 251 */ [RPL_LUSERCLIENT] = ":There are %u users and %u invisible on %u servers",
74 /* 252 */ [RPL_LUSEROP] = "%u :IRC Operators online",
75 /* 253 */ [RPL_LUSERUNKNOWN] = "%u :unknown connection(s)",
76 /* 254 */ [RPL_LUSERCHANNELS] = "%u :channels formed",
77 /* 255 */ [RPL_LUSERME] = ":I have %u clients and %u servers",
78 /* 256 */ [RPL_ADMINME] = ":Administrative info about %s",
79 /* 257 */ [RPL_ADMINLOC1] = ":%s",
80 /* 258 */ [RPL_ADMINLOC2] = ":%s",
81 /* 259 */ [RPL_ADMINEMAIL] = ":%s",
82 /* 262 */ [RPL_TRACEEND] = "%s :End of TRACE",
83 /* 263 */ [RPL_LOAD2HI] = "%s :Server load is temporarily too heavy. Please wait a while and try again.",
84 /* 265 */ [RPL_LOCALUSERS] = ":Current local users: %u Max: %u",
85 /* 266 */ [RPL_GLOBALUSERS] = ":Current global users: %u Max: %u",
86 /* 276 */ [RPL_WHOISCERTFP] = "%s :has client certificate fingerprint %s",
87 /* 281 */ [RPL_ACCEPTLIST] = ":%s",
88 /* 282 */ [RPL_ENDOFACCEPT] = ":End of /ACCEPT list.",
89 /* 301 */ [RPL_AWAY] = "%s :%s",
90 /* 302 */ [RPL_USERHOST] = ":%s",
91 /* 303 */ [RPL_ISON] = ":%s",
92 /* 305 */ [RPL_UNAWAY] = ":You are no longer marked as being away",
93 /* 306 */ [RPL_NOWAWAY] = ":You have been marked as being away",
94 /* 307 */ [RPL_WHOISREGNICK] = "%s :has identified for this nick",
95 /* 311 */ [RPL_WHOISUSER] = "%s %s %s * :%s",
96 /* 312 */ [RPL_WHOISSERVER] = "%s %s :%s",
97 /* 313 */ [RPL_WHOISOPERATOR] = "%s :%s",
98 /* 314 */ [RPL_WHOWASUSER] = "%s %s %s * :%s",
99 /* 315 */ [RPL_ENDOFWHO] = "%s :End of /WHO list.",
100 /* 317 */ [RPL_WHOISIDLE] = "%s %u %ju :seconds idle, signon time",
101 /* 318 */ [RPL_ENDOFWHOIS] = "%s :End of /WHOIS list.",
102 /* 319 */ [RPL_WHOISCHANNELS] = "%s :%s",
103 /* 321 */ [RPL_LISTSTART] = "Channel :Users Name",
104 /* 322 */ [RPL_LIST] = "%s %u :%s%s",
105 /* 323 */ [RPL_LISTEND] = ":End of /LIST",
106 /* 324 */ [RPL_CHANNELMODEIS] = "%s %s %s",
107 /* 329 */ [RPL_CREATIONTIME] = "%s %ju",
108 /* 330 */ [RPL_WHOISACCOUNT] = "%s %s :%s logged in as",
109 /* 331 */ [RPL_NOTOPIC] = "%s :No topic is set.",
110 /* 332 */ [RPL_TOPIC] = "%s :%s",
111 /* 333 */ [RPL_TOPICWHOTIME] = "%s %s %ju",
112 /* 335 */ [RPL_WHOISBOT] = "%s :is a Bot",
113 /* 336 */ [RPL_INVITELIST] = ":%s",
114 /* 337 */ [RPL_ENDOFINVITELIST] = ":End of /INVITE list.",
115 /* 338 */ [RPL_WHOISACTUALLY] = "%s %s@%s %s :Actual user@host, actual IP",
116 /* 339 */ [RPL_WHOISTEXT] = "%s :%s",
117 /* 341 */ [RPL_INVITING] = "%s %s",
118 /* 346 */ [RPL_INVEXLIST] = "%s %s %s %ju",
119 /* 347 */ [RPL_ENDOFINVEXLIST] = "%s :End of Channel Invite List",
120 /* 348 */ [RPL_EXCEPTLIST] = "%s %s %s %ju",
121 /* 349 */ [RPL_ENDOFEXCEPTLIST] = "%s :End of Channel Exception List",
122 /* 351 */ [RPL_VERSION] = "%s. %s :%s",
123 /* 352 */ [RPL_WHOREPLY] = "%s %s %s %s %s %s :%u %s",
124 /* 353 */ [RPL_NAMREPLY] = "%s %s :%s",
125 /* 362 */ [RPL_CLOSING] = "%s :Closed. Status = %u",
126 /* 363 */ [RPL_CLOSEEND] = "%u: Connections closed",
127 /* 364 */ [RPL_LINKS] = "%s %s :%u %s",
128 /* 365 */ [RPL_ENDOFLINKS] = "%s :End of /LINKS list.",
129 /* 366 */ [RPL_ENDOFNAMES] = "%s :End of /NAMES list.",
130 /* 367 */ [RPL_BANLIST] = "%s %s %s %ju",
131 /* 368 */ [RPL_ENDOFBANLIST] = "%s :End of Channel Ban List",
132 /* 369 */ [RPL_ENDOFWHOWAS] = "%s :End of WHOWAS",
133 /* 371 */ [RPL_INFO] = ":%s",
134 /* 372 */ [RPL_MOTD] = ":- %s",
135 /* 373 */ [RPL_INFOSTART] = ":Server INFO",
136 /* 374 */ [RPL_ENDOFINFO] = ":End of /INFO list.",
137 /* 375 */ [RPL_MOTDSTART] = ":- %s Message of the Day - ",
138 /* 376 */ [RPL_ENDOFMOTD] = ":End of /MOTD command.",
139 /* 379 */ [RPL_WHOISMODES] = "%s :is using modes %s",
140 /* 381 */ [RPL_YOUREOPER] = ":You are now an IRC operator",
141 /* 382 */ [RPL_REHASHING] = "%s :Rehashing",
142 /* 391 */ [RPL_TIME] = "%s :%s",
143 /* 396 */ [RPL_VISIBLEHOST] = "%s :is now your visible host",
144 /* 401 */ [ERR_NOSUCHNICK] = "%s :No such nick/channel",
145 /* 402 */ [ERR_NOSUCHSERVER] = "%s :No such server",
146 /* 403 */ [ERR_NOSUCHCHANNEL] = "%s :No such channel",
147 /* 404 */ [ERR_CANNOTSENDTOCHAN] = "%s :Cannot send to channel",
148 /* 405 */ [ERR_TOOMANYCHANNELS] = "%s :You have joined too many channels",
149 /* 406 */ [ERR_WASNOSUCHNICK] = "%s :There was no such nickname",
150 /* 407 */ [ERR_TOOMANYTARGETS] = "%s :Too many recipients. Only %u processed",
151 /* 408 */ [ERR_NOCTRLSONCHAN] = "%s :You cannot use control codes on this channel. Not sent: %s",
152 /* 409 */ [ERR_NOORIGIN] = ":No origin specified",
153 /* 410 */ [ERR_INVALIDCAPCMD] = "%s :Invalid CAP subcommand",
154 /* 411 */ [ERR_NORECIPIENT] = ":No recipient given (%s)",
155 /* 412 */ [ERR_NOTEXTTOSEND] = ":No text to send",
156 /* 413 */ [ERR_NOTOPLEVEL] = "%s :No top-level domain specified",
157 /* 414 */ [ERR_WILDTOPLEVEL] = "%s :Wildcard in top-level domain",
158 /* 421 */ [ERR_UNKNOWNCOMMAND] = "%s :Unknown command",
159 /* 422 */ [ERR_NOMOTD] = ":MOTD File is missing",
160 /* 429 */ [ERR_TOOMANYAWAY] = ":Too many aways - Flood protection activated",
161 /* 431 */ [ERR_NONICKNAMEGIVEN] = ":No nickname given",
162 /* 432 */ [ERR_ERRONEUSNICKNAME] = "%s :%s",
163 /* 433 */ [ERR_NICKNAMEINUSE] = "%s :Nickname is already in use.",
164 /* 435 */ [ERR_BANNICKCHANGE] = "%s :Cannot change nickname while banned on channel",
165 /* 436 */ [ERR_NICKCOLLISION] = "%s :Nickname collision KILL",
166 /* 438 */ [ERR_NICKTOOFAST] = "%s :Nick change too fast. Please wait %u seconds.",
167 /* 440 */ [ERR_SERVICESDOWN] = "%s :Services are currently unavailable.",
168 /* 441 */ [ERR_USERNOTINCHANNEL] = "%s %s :They aren't on that channel",
169 /* 442 */ [ERR_NOTONCHANNEL] = "%s :You are not on that channel",
170 /* 443 */ [ERR_USERONCHANNEL] = "%s %s :is already on channel",
171 /* 447 */ [ERR_NONICKCHANGE] = ":Cannot change nickname while on %s (+N)",
172 /* 451 */ [ERR_NOTREGISTERED] = ":You have not registered",
173 /* 456 */ [ERR_ACCEPTFULL] = ":Accept list is full",
174 /* 457 */ [ERR_ACCEPTEXIST] = "%s!%s@%s :is already on your accept list",
175 /* 458 */ [ERR_ACCEPTNOT] = "%s!%s@%s :is not on your accept list",
176 /* 461 */ [ERR_NEEDMOREPARAMS] = "%s :Not enough parameters",
177 /* 462 */ [ERR_ALREADYREGISTRED] = ":You may not reregister",
178 /* 464 */ [ERR_PASSWDMISMATCH] = ":Password incorrect",
179 /* 465 */ [ERR_YOUREBANNEDCREEP] = ":You are banned from this server- %s",
180 /* 468 */ [ERR_ONLYSERVERSCANCHANGE] = "%s :Only servers can change that mode",
181 /* 471 */ [ERR_CHANNELISFULL] = "%s :Cannot join channel (+l)",
182 /* 472 */ [ERR_UNKNOWNMODE] = "%c :is unknown mode char to me",
183 /* 473 */ [ERR_INVITEONLYCHAN] = "%s :Cannot join channel (+i)",
184 /* 474 */ [ERR_BANNEDFROMCHAN] = "%s :Cannot join channel (+b)",
185 /* 475 */ [ERR_BADCHANNELKEY] = "%s :Cannot join channel (+k)",
186 /* 477 */ [ERR_NEEDREGGEDNICK] = "%s :You need to identify to a registered nick to join or speak in that channel.",
187 /* 478 */ [ERR_BANLISTFULL] = "%s %s :Channel ban list is full",
188 /* 479 */ [ERR_BADCHANNAME] = "%s :Illegal channel name",
189 /* 480 */ [ERR_CANNOTKNOCK] = "%s :Cannot knock on channel (+K)",
190 /* 481 */ [ERR_NOPRIVILEGES] = ":Permission denied - You are not an IRC operator",
191 /* 482 */ [ERR_CHANOPRIVSNEEDED] = "%s :You are not channel operator",
192 /* 483 */ [ERR_CANTKILLSERVER] = ":You cannot kill a server!",
193 /* 485 */ [ERR_CHANBANREASON] = "%s :Cannot join channel (%s)",
194 /* 486 */ [ERR_NONONREG] = "%s :You must identify to a registered nick to private message that person",
195 /* 489 */ [ERR_SECUREONLYCHAN] = "%s :Cannot join channel (+S) - TLS required",
196 /* 491 */ [ERR_NOOPERHOST] = ":Only few of mere mortals may try to enter the twilight zone",
197 /* 492 */ [ERR_NOCTCP] = "%s :You cannot send CTCPs to this channel. Not sent: %s",
198 /* 501 */ [ERR_UMODEUNKNOWNFLAG] = ":Unknown MODE flag",
199 /* 502 */ [ERR_USERSDONTMATCH] = ":Cannot change mode for other users",
200 /* 504 */ [ERR_USERNOTONSERV] = "%s :User is not on this server",
201 /* 513 */ [ERR_WRONGPONG] = ":To connect type /QUOTE PONG %u",
202 /* 520 */ [ERR_OPERONLYCHAN] = "%s :Cannot join channel (+O)",
203 /* 521 */ [ERR_LISTSYNTAX] = ":Bad list syntax, type /QUOTE HELP LIST",
204 /* 523 */ [ERR_WHOLIMEXCEED] = "%u :%s search limit exceeded.",
205 /* 524 */ [ERR_HELPNOTFOUND] = "%s :Help not found",
206 /* 671 */ [RPL_WHOISSECURE] = "%s :is connected via TLS (secure link)",
207 /* 702 */ [RPL_MODLIST] = "%s %p %s %s",
208 /* 703 */ [RPL_ENDOFMODLIST] = ":End of /MODULE LIST.",
209 /* 704 */ [RPL_HELPSTART] = "%s :%s",
210 /* 705 */ [RPL_HELPTXT] = "%s :%s",
211 /* 706 */ [RPL_ENDOFHELP] = "%s :End of /HELP.",
212 /* 709 */ [RPL_ETRACE] = "%s %s %s %s %s %s :%s",
213 /* 710 */ [RPL_KNOCK] = "%s %s!%s@%s :has asked for an invite.",
214 /* 711 */ [RPL_KNOCKDLVR] = "%s :Your KNOCK has been delivered.",
215 /* 712 */ [ERR_TOOMANYKNOCK] = "%s :Too many KNOCKs (%s).",
216 /* 713 */ [ERR_CHANOPEN] = "%s :Channel is open.",
217 /* 714 */ [ERR_KNOCKONCHAN] = "%s :You are already on that channel.",
218 /* 715 */ [ERR_TOOMANYINVITE] = "%s :Too many INVITEs (%s).",
219 /* 716 */ [RPL_TARGUMODEG] = "%s :is in %s mode (%s)",
220 /* 717 */ [RPL_TARGNOTIFY] = "%s :has been informed that you messaged them.",
221 /* 718 */ [RPL_UMODEGMSG] = "%s %s@%s :is messaging you, and you are umode %s.",
222 /* 723 */ [ERR_NOPRIVS] = "%s :Insufficient oper privileges.",
223 /* 730 */ [RPL_MONONLINE] = ":%s",
224 /* 731 */ [RPL_MONOFFLINE] = ":%s",
225 /* 732 */ [RPL_MONLIST] = ":%s",
226 /* 733 */ [RPL_ENDOFMONLIST] = ":End of MONITOR list",
227 /* 734 */ [ERR_MONLISTFULL] = "%d %s :Monitor list is full",
228 /* 743 */ [ERR_INVALIDBAN] = "%s :Invalid ban mask",
229 /* 759 */ [RPL_ETRACEEND] = "%s :End of ETRACE",
230 /* 999 */ [ERR_LAST_ERR_MSG] = ":Last error message"
231 };
232
233 /*
234 * numeric_form
235 *
236 * inputs - numeric
237 * output - corresponding string
238 * side effects - NONE
239 */
240 const char *
numeric_form(enum irc_numerics numeric)241 numeric_form(enum irc_numerics numeric)
242 {
243 assert(numeric < ERR_LAST_ERR_MSG);
244
245 if (numeric > ERR_LAST_ERR_MSG)
246 numeric = ERR_LAST_ERR_MSG;
247
248 assert(replies[numeric]);
249
250 return replies[numeric];
251 }
252