Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / ircd / s_err.c
1 /*
2  * IRC - Internet Relay Chat, ircd/s_err.c
3  * Copyright (C) 1992 Darren Reed
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 1, or (at your option)
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 /** @file
20  * @brief Error handling support.
21  * @version $Id$
22  */
23 #include "config.h"
24
25 #include "numeric.h"
26 #include "ircd_log.h"
27 #include "s_debug.h"
28
29 /* #include <assert.h> -- Now using assert in ircd_log.h */
30 #include <string.h>
31
32 /** Array of Numeric replies, indexed by numeric. */
33 static Numeric replyTable[] = {
34 /* 000 */
35   { 0 },
36 /* 001 */
37   { RPL_WELCOME, ":Welcome to the %s IRC Network%s%s, %s", "001" },
38 /* 002 */
39   { RPL_YOURHOST, ":Your host is %s, running version %s", "002" },
40 /* 003 */
41   { RPL_CREATED, ":This server was created %s", "003" },
42 /* 004 */
43   { RPL_MYINFO, "%s %s %s %s %s", "004" },
44 /* 005 */
45   { RPL_ISUPPORT, "%s :are supported by this server", "005" },
46 /* 006 */
47   { 0 },
48 /* 007 */
49   { 0 },
50 /* 008 */
51   { RPL_SNOMASK, "%d :: Server notice mask (%#x)", "008" },
52 /* 009 */
53   { 0 },
54 /* 010 */
55   { 0 },
56 /* 011 */
57   { 0 },
58 /* 012 */
59   { 0 },
60 /* 013 */
61   { 0 },
62 /* 014 */
63   { 0 },
64 /* 015 */
65   { RPL_MAP, ":%s%s%s %s [%i clients]", "015" },
66 /* 016 */
67   { RPL_MAPMORE, ":%s%s --> *more*", "016" },
68 /* 017 */
69   { RPL_MAPEND, ":End of /MAP", "017" },
70 /* 018 */
71   { 0 },
72 /* 019 */
73   { 0 },
74 /* 020 */
75   { 0 },
76 /* 021 */
77   { 0 },
78 /* 022 */
79   { 0 },
80 /* 023 */
81   { 0 },
82 /* 024 */
83   { 0 },
84 /* 025 */
85   { 0 },
86 /* 026 */
87   { 0 },
88 /* 027 */
89   { 0 },
90 /* 028 */
91   { 0 },
92 /* 029 */
93   { 0 },
94 /* 030 */
95   { RPL_APASSWARN, ":%s%s%s%s%s", "030" },
96 /* 031 */
97   { 0 },
98 /* 032 */
99   { 0 },
100 /* 033 */
101   { 0 },
102 /* 034 */
103   { 0 },
104 /* 035 */
105   { 0 },
106 /* 036 */
107   { 0 },
108 /* 037 */
109   { 0 },
110 /* 038 */
111   { 0 },
112 /* 039 */
113   { 0 },
114 /* 040 */
115   { 0 },
116 /* 041 */
117   { 0 },
118 /* 042 */
119   { 0 },
120 /* 043 */
121   { 0 },
122 /* 044 */
123   { 0 },
124 /* 045 */
125   { 0 },
126 /* 046 */
127   { 0 },
128 /* 047 */
129   { 0 },
130 /* 048 */
131   { 0 },
132 /* 049 */
133   { 0 },
134 /* 050 */
135   { 0 },
136 /* 051 */
137   { 0 },
138 /* 052 */
139   { 0 },
140 /* 053 */
141   { 0 },
142 /* 054 */
143   { 0 },
144 /* 055 */
145   { 0 },
146 /* 056 */
147   { 0 },
148 /* 057 */
149   { 0 },
150 /* 058 */
151   { 0 },
152 /* 059 */
153   { 0 },
154 /* 060 */
155   { 0 },
156 /* 061 */
157   { 0 },
158 /* 062 */
159   { 0 },
160 /* 063 */
161   { 0 },
162 /* 064 */
163   { 0 },
164 /* 065 */
165   { 0 },
166 /* 066 */
167   { 0 },
168 /* 067 */
169   { 0 },
170 /* 068 */
171   { 0 },
172 /* 069 */
173   { 0 },
174 /* 070 */
175   { 0 },
176 /* 071 */
177   { 0 },
178 /* 072 */
179   { 0 },
180 /* 073 */
181   { 0 },
182 /* 074 */
183   { 0 },
184 /* 075 */
185   { 0 },
186 /* 076 */
187   { 0 },
188 /* 077 */
189   { 0 },
190 /* 078 */
191   { 0 },
192 /* 079 */
193   { 0 },
194 /* 080 */
195   { 0 },
196 /* 081 */
197   { 0 },
198 /* 082 */
199   { 0 },
200 /* 083 */
201   { 0 },
202 /* 084 */
203   { 0 },
204 /* 085 */
205   { 0 },
206 /* 086 */
207   { 0 },
208 /* 087 */
209   { 0 },
210 /* 088 */
211   { 0 },
212 /* 089 */
213   { 0 },
214 /* 090 */
215   { 0 },
216 /* 091 */
217   { 0 },
218 /* 092 */
219   { 0 },
220 /* 093 */
221   { 0 },
222 /* 094 */
223   { 0 },
224 /* 095 */
225   { 0 },
226 /* 096 */
227   { 0 },
228 /* 097 */
229   { 0 },
230 /* 098 */
231   { 0 },
232 /* 099 */
233   { 0 },
234 /* 100 */
235   { 0 },
236 /* 101 */
237   { 0 },
238 /* 102 */
239   { 0 },
240 /* 103 */
241   { 0 },
242 /* 104 */
243   { 0 },
244 /* 105 */
245   { 0 },
246 /* 106 */
247   { 0 },
248 /* 107 */
249   { 0 },
250 /* 108 */
251   { 0 },
252 /* 109 */
253   { 0 },
254 /* 110 */
255   { 0 },
256 /* 111 */
257   { 0 },
258 /* 112 */
259   { 0 },
260 /* 113 */
261   { 0 },
262 /* 114 */
263   { 0 },
264 /* 115 */
265   { 0 },
266 /* 116 */
267   { 0 },
268 /* 117 */
269   { 0 },
270 /* 118 */
271   { 0 },
272 /* 119 */
273   { 0 },
274 /* 120 */
275   { 0 },
276 /* 121 */
277   { 0 },
278 /* 122 */
279   { 0 },
280 /* 123 */
281   { 0 },
282 /* 124 */
283   { 0 },
284 /* 125 */
285   { 0 },
286 /* 126 */
287   { 0 },
288 /* 127 */
289   { 0 },
290 /* 128 */
291   { 0 },
292 /* 129 */
293   { 0 },
294 /* 130 */
295   { 0 },
296 /* 131 */
297   { 0 },
298 /* 132 */
299   { 0 },
300 /* 133 */
301   { 0 },
302 /* 134 */
303   { 0 },
304 /* 135 */
305   { 0 },
306 /* 136 */
307   { 0 },
308 /* 137 */
309   { 0 },
310 /* 138 */
311   { 0 },
312 /* 139 */
313   { 0 },
314 /* 140 */
315   { 0 },
316 /* 141 */
317   { 0 },
318 /* 142 */
319   { 0 },
320 /* 143 */
321   { 0 },
322 /* 144 */
323   { 0 },
324 /* 145 */
325   { 0 },
326 /* 146 */
327   { 0 },
328 /* 147 */
329   { 0 },
330 /* 148 */
331   { 0 },
332 /* 149 */
333   { 0 },
334 /* 150 */
335   { 0 },
336 /* 151 */
337   { 0 },
338 /* 152 */
339   { 0 },
340 /* 153 */
341   { 0 },
342 /* 154 */
343   { 0 },
344 /* 155 */
345   { 0 },
346 /* 156 */
347   { 0 },
348 /* 157 */
349   { 0 },
350 /* 158 */
351   { 0 },
352 /* 159 */
353   { 0 },
354 /* 160 */
355   { 0 },
356 /* 161 */
357   { 0 },
358 /* 162 */
359   { 0 },
360 /* 163 */
361   { 0 },
362 /* 164 */
363   { 0 },
364 /* 165 */
365   { 0 },
366 /* 166 */
367   { 0 },
368 /* 167 */
369   { 0 },
370 /* 168 */
371   { 0 },
372 /* 169 */
373   { 0 },
374 /* 170 */
375   { 0 },
376 /* 171 */
377   { 0 },
378 /* 172 */
379   { 0 },
380 /* 173 */
381   { 0 },
382 /* 174 */
383   { 0 },
384 /* 175 */
385   { 0 },
386 /* 176 */
387   { 0 },
388 /* 177 */
389   { 0 },
390 /* 178 */
391   { 0 },
392 /* 179 */
393   { 0 },
394 /* 180 */
395   { 0 },
396 /* 181 */
397   { 0 },
398 /* 182 */
399   { 0 },
400 /* 183 */
401   { 0 },
402 /* 184 */
403   { 0 },
404 /* 185 */
405   { 0 },
406 /* 186 */
407   { 0 },
408 /* 187 */
409   { 0 },
410 /* 188 */
411   { 0 },
412 /* 189 */
413   { 0 },
414 /* 190 */
415   { 0 },
416 /* 191 */
417   { 0 },
418 /* 192 */
419   { 0 },
420 /* 193 */
421   { 0 },
422 /* 194 */
423   { 0 },
424 /* 195 */
425   { 0 },
426 /* 196 */
427   { 0 },
428 /* 197 */
429   { 0 },
430 /* 198 */
431   { 0 },
432 /* 199 */
433   { 0 },
434 /* 200 */
435   { RPL_TRACELINK, "Link %s.%s %s %s", "200" },
436 /* 201 */
437   { RPL_TRACECONNECTING, "Try. %s %s", "201" },
438 /* 202 */
439   { RPL_TRACEHANDSHAKE, "H.S. %s %s", "202" },
440 /* 203 */
441   { RPL_TRACEUNKNOWN, "???? %s %s", "203" },
442 /* 204 */
443   { RPL_TRACEOPERATOR, "Oper %s %s %ld", "204" },
444 /* 205 */
445   { RPL_TRACEUSER, "User %s %s %ld", "205" },
446 /* 206 */
447   { RPL_TRACESERVER, "Serv %s %dS %dC %s %s!%s@%s %ld %ld", "206" },
448 /* 207 */
449   { 0 },
450 /* 208 */
451   { RPL_TRACENEWTYPE, "<newtype> 0 %s", "208" },
452 /* 209 */
453   { RPL_TRACECLASS, "Class %s %d", "209" },
454 /* 210 */
455   { 0 },
456 /* 211 */
457   { RPL_STATSLINKINFO, 0, "211" },
458 /* 212 */
459   { RPL_STATSCOMMANDS, "%s %u %u", "212" },
460 /* 213 */
461   { RPL_STATSCLINE, "C %s %s %d %d %s %s", "213" },
462 /* 214 */
463   { 0 },
464 /* 215 */
465   { RPL_STATSILINE, "I %s %d %s %d %s", "215" },
466 /* 216 */
467   { RPL_STATSKLINE, "%c %s \"%s\" %s 0 0", "216" },
468 /* 217 */
469   { RPL_STATSPLINE, "P %d %d %s %s", "217" },
470 /* 218 */
471   { RPL_STATSYLINE, "%c %s %d %d %d %ld %d", "218" },
472 /* 219 */
473   { RPL_ENDOFSTATS, "%s :End of /STATS report", "219" },
474 /* 220 */
475   { 0 },
476 /* 221 */
477   { RPL_UMODEIS, "%s", "221" },
478 /* 222 */
479   { 0 },
480 /* 223 */
481   { 0 },
482 /* 224 */
483   { 0 },
484 /* 225 */
485   { 0 },
486 /* 226 */
487   { RPL_STATSALINE, "%s", "226" },
488 /* 227 */
489   { 0 },
490 /* 228 */
491   { RPL_STATSQLINE, "Q %s :%s", "228" },
492 /* 229 */
493   { 0 },
494 /* 230 */
495   { 0 },
496 /* 231 */
497   { RPL_SERVICEINFO, 0, "231" },
498 /* 232 */
499   { RPL_ENDOFSERVICES, 0, "232" },
500 /* 233 */
501   { RPL_SERVICE, 0, "233" },
502 /* 234 */
503   { RPL_SERVLIST, 0, "234" },
504 /* 235 */
505   { RPL_SERVLISTEND, 0, "235" },
506 /* 236 */
507   { RPL_STATSVERBOSE, "V :Sent as explicit", "236" },
508 /* 237 */
509   { RPL_STATSENGINE, "%s :Event loop engine", "237" },
510 /* 238 */
511   { RPL_STATSFLINE, "%c %s %s", "238" },
512 /* 239 */
513   { 0 },
514 /* 240 */
515   { 0 },
516 /* 241 */
517   { RPL_STATSLLINE, "Module Description EntryPoint", "241" },
518 /* 242 */
519   { RPL_STATSUPTIME, ":Server Up %d days, %d:%02d:%02d", "242" },
520 /* 243 */
521   { RPL_STATSOLINE, "O %s * %s %d %d", "243" },
522 /* 244 */
523   { 0 },
524 /* 245 */
525   { 0 },
526 /* 246 */
527   { RPL_STATSTLINE, "%c %s %s", "246" },
528 /* 247 */
529   { RPL_STATSGLINE, "%c %s%s%s %Tu :%s", "247" },
530 /* 248 */
531   { RPL_STATSULINE, "U %s", "248" },
532 /* 249 */
533   { RPL_STATSDEBUG, 0, "249" },
534 /* 250 */
535   { RPL_STATSCONN, ":Highest connection count: %d (%d clients)", "250" },
536 /* 251 */
537   { RPL_LUSERCLIENT, ":There are %d users and %d invisible on %d servers", "251" },
538 /* 252 */
539   { RPL_LUSEROP, "%d :operator(s) online", "252" },
540 /* 253 */
541   { RPL_LUSERUNKNOWN, "%d :unknown connection(s)", "253" },
542 /* 254 */
543   { RPL_LUSERCHANNELS, "%d :channels formed", "254" },
544 /* 255 */
545   { RPL_LUSERME, ":I have %d clients and %d servers", "255" },
546 /* 256 */
547   { RPL_ADMINME, ":Administrative info about %s", "256" },
548 /* 257 */
549   { RPL_ADMINLOC1, ":%s", "257" },
550 /* 258 */
551   { RPL_ADMINLOC2, ":%s", "258" },
552 /* 259 */
553   { RPL_ADMINEMAIL, ":%s", "259" },
554 /* 260 */
555   { 0 },
556 /* 261 */
557   { RPL_TRACELOG, "File %s %d", "261" },
558 /* 262 */
559   { RPL_TRACEEND, ":End of TRACE", "262" },
560 /* 263 */
561   { 0 },
562 /* 264 */
563   { 0 },
564 /* 265 */
565   { 0 },
566 /* 266 */
567   { 0 },
568 /* 267 */
569   { 0 },
570 /* 268 */
571   { 0 },
572 /* 269 */
573   { 0 },
574 /* 270 */
575   { RPL_PRIVS, "%s :", "270" },
576 /* 271 */
577   { RPL_SILELIST, "%s %s%s", "271" },
578 /* 272 */
579   { RPL_ENDOFSILELIST, "%s :End of Silence List", "272" },
580 /* 273 */
581   { 0 },
582 /* 274 */
583   { 0 },
584 /* 275 */
585   { RPL_STATSDLINE, "%c %s %s", "275" },
586 /* 276 */
587   { RPL_STATSRLINE, "%-9s %-9s %-10s %s", "276" },
588 /* 277 */
589   { 0 },
590 /* 278 */
591   { 0 },
592 /* 279 */
593   { 0 },
594 /* 280 */
595   { RPL_GLIST, "%s%s%s %Tu %s %c :%s", "280" },
596 /* 281 */
597   { RPL_ENDOFGLIST, ":End of G-line List", "281" },
598 /* 282 */
599   { RPL_JUPELIST, "%s %Tu %s %c :%s", "282" },
600 /* 283 */
601   { RPL_ENDOFJUPELIST, ":End of Jupe List", "283" },
602 /* 284 */
603   { RPL_FEATURE, 0, "284" },
604 /* 285 */
605   { 0 },
606 /* 286 */
607   { 0 },
608 /* 287 */
609   { 0 },
610 /* 288 */
611   { 0 },
612 /* 289 */
613   { 0 },
614 /* 290 */
615   { 0 },
616 /* 291 */
617   { 0 },
618 /* 292 */
619   { 0 },
620 /* 293 */
621   { 0 },
622 /* 294 */
623   { 0 },
624 /* 295 */
625   { 0 },
626 /* 296 */
627   { 0 },
628 /* 297 */
629   { 0 },
630 /* 298 */
631   { 0 },
632 /* 299 */
633   { 0 },
634 /* 300 */
635   { RPL_NONE, 0, "300" },
636 /* 301 */
637   { RPL_AWAY, "%s :%s", "301" },
638 /* 302 */
639   { RPL_USERHOST, ":", "302" },
640 /* 303 */
641   { RPL_ISON, ":", "303" },
642 /* 304 */
643   { RPL_TEXT, 0, "304" },
644 /* 305 */
645   { RPL_UNAWAY, ":You are no longer marked as being away", "305" },
646 /* 306 */
647   { RPL_NOWAWAY, ":You have been marked as being away", "306" },
648 /* 307 */
649   { 0 },
650 /* 308 */
651   { 0 },
652 /* 309 */
653   { 0 },
654 /* 310 */
655   { 0 },
656 /* 311 */
657   { RPL_WHOISUSER, "%s %s %s * :%s", "311" },
658 /* 312 */
659   { RPL_WHOISSERVER, "%s %s :%s", "312" },
660 /* 313 */
661   { RPL_WHOISOPERATOR, "%s :is an IRC Operator", "313" },
662 /* 314 */
663   { RPL_WHOWASUSER, "%s %s %s * :%s", "314" },
664 /* 315 */
665   { RPL_ENDOFWHO, "%s :End of /WHO list.", "315" },
666 /* 316 */
667   { 0 },
668 /* 317 */
669   { RPL_WHOISIDLE, "%s %ld %ld :seconds idle, signon time", "317" },
670 /* 318 */
671   { RPL_ENDOFWHOIS, "%s :End of /WHOIS list.", "318" },
672 /* 319 */
673   { RPL_WHOISCHANNELS, "%s :%s", "319" },
674 /* 320 */
675   { 0 },
676 /* 321 */
677   { RPL_LISTSTART, "Channel :Users  Name", "321" },
678 /* 322 */
679   { RPL_LIST, "%s %d :%s", "322" },
680 /* 323 */
681   { RPL_LISTEND, ":End of /LIST", "323" },
682 /* 324 */
683   { RPL_CHANNELMODEIS, "%s %s %s", "324" },
684 /* 325 */
685   { 0 },
686 /* 326 */
687   { 0 },
688 /* 327 */
689   { 0 },
690 /* 328 */
691   { 0 },
692 /* 329 */
693   { RPL_CREATIONTIME, "%s %Tu", "329" },
694 /* 330 */
695   { RPL_WHOISACCOUNT, "%s %s :is logged in as", "330" },
696 /* 331 */
697   { RPL_NOTOPIC, "%s :No topic is set.", "331" },
698 /* 332 */
699   { RPL_TOPIC, "%s :%s", "332" },
700 /* 333 */
701   { RPL_TOPICWHOTIME, "%s %s %Tu", "333" },
702 /* 334 */
703   { RPL_LISTUSAGE, ":%s", "334" },
704 /* 335 */
705   { 0 },
706 /* 336 */
707   { 0 },
708 /* 337 */
709   { 0 },
710 /* 338 */
711   { RPL_WHOISACTUALLY, "%s %s@%s %s :Actual user@host, Actual IP", "338" },
712 /* 339 */
713   { 0 },
714 /* 340 */
715   { RPL_USERIP, ":", "340" },
716 /* 341 */
717   { RPL_INVITING, "%s %s", "341" },
718 /* 342 */
719   { 0 },
720 /* 343 */
721   { 0 },
722 /* 344 */
723   { 0 },
724 /* 345 */
725   { RPL_ISSUEDINVITE, "%s %s %s :%s has been invited by %s", "345" },
726 /* 346 */
727   { RPL_INVITELIST, ":%s", "346" },
728 /* 347 */
729   { RPL_ENDOFINVITELIST, ":End of Invite List", "347" },
730 /* 348 */
731   { 0 },
732 /* 349 */
733   { 0 },
734 /* 350 */
735   { 0 },
736 /* 351 */
737   { RPL_VERSION, "%s.%s %s :%s", "351" },
738 /* 352 */
739   { RPL_WHOREPLY, "%s", "352" },
740 /* 353 */
741   { RPL_NAMREPLY, "%s", "353" },
742 /* 354 */
743   { RPL_WHOSPCRPL, "%s", "354" },
744 /* 355 */
745   { RPL_DELNAMREPLY, "%s", "355" },
746 /* 356 */
747   { 0 },
748 /* 357 */
749   { 0 },
750 /* 358 */
751   { 0 },
752 /* 359 */
753   { 0 },
754 /* 360 */
755   { 0 },
756 /* 361 */
757   { RPL_KILLDONE, 0, "361" }, /* Not used */
758 /* 362 */
759   { RPL_CLOSING, "%s :Operator enforced Close", "362" },
760 /* 363 */
761   { RPL_CLOSEEND, "%d :Connections Closed", "363" },
762 /* 364 */
763   { RPL_LINKS, "%s %s :%d P%u %s", "364" },
764 /* 365 */
765   { RPL_ENDOFLINKS, "%s :End of /LINKS list.", "365" },
766 /* 366 */
767   { RPL_ENDOFNAMES, "%s :End of /NAMES list.", "366" },
768 /* 367 */
769   { RPL_BANLIST, "%s %s %s %Tu", "367" },
770 /* 368 */
771   { RPL_ENDOFBANLIST, "%s :End of Channel Ban List", "368" },
772 /* 369 */
773   { RPL_ENDOFWHOWAS, "%s :End of WHOWAS", "369" },
774 /* 370 */
775   { 0 },
776 /* 371 */
777   { RPL_INFO, ":%s", "371" },
778 /* 372 */
779   { RPL_MOTD, ":- %s", "372" },
780 /* 373 */
781   { RPL_INFOSTART, ":Server INFO", "373" },
782 /* 374 */
783   { RPL_ENDOFINFO, ":End of /INFO list.", "374" },
784 /* 375 */
785   { RPL_MOTDSTART, ":- %s Message of the Day - ", "375" },
786 /* 376 */
787   { RPL_ENDOFMOTD, ":End of /MOTD command.", "376" },
788 /* 377 */
789   { 0 },
790 /* 378 */
791   { 0 },
792 /* 379 */
793   { 0 },
794 /* 380 */
795   { 0 },
796 /* 381 */
797   { RPL_YOUREOPER, ":You are now an IRC Operator", "381" },
798 /* 382 */
799   { RPL_REHASHING, "%s :Rehashing", "382" },
800 /* 383 */
801   { 0 },
802 /* 384 */
803   { RPL_MYPORTIS, "%d :Port to local server is", "384" }, /* not used */
804 /* 385 */
805   { RPL_NOTOPERANYMORE, 0, "385" }, /* not used */
806 /* 386 */
807   { 0 },
808 /* 387 */
809   { 0 },
810 /* 388 */
811   { 0 },
812 /* 389 */
813   { 0 },
814 /* 390 */
815   { 0 },
816 /* 391 */
817   { RPL_TIME, "%s %Tu %ld :%s", "391" },
818 /* 392 */
819   { 0 },
820 /* 393 */
821   { 0 },
822 /* 394 */
823   { 0 },
824 /* 395 */
825   { 0 },
826 /* 396 */
827   { RPL_HOSTHIDDEN, "%s :is now your hidden host", "396" },
828 /* 397 */
829   { 0 },
830 /* 398 */
831   { 0 },
832 /* 399 */
833   { 0 },
834 /* 400 */
835   { ERR_FIRSTERROR, "", "400" },
836 /* 401 */
837   { ERR_NOSUCHNICK, "%s :No such nick", "401" },
838 /* 402 */
839   { ERR_NOSUCHSERVER, "%s :No such server", "402" },
840 /* 403 */
841   { ERR_NOSUCHCHANNEL, "%s :No such channel", "403" },
842 /* 404 */
843   { ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel", "404" },
844 /* 405 */
845   { ERR_TOOMANYCHANNELS, "%s :You have joined too many channels", "405" },
846 /* 406 */
847   { ERR_WASNOSUCHNICK, "%s :There was no such nickname", "406" },
848 /* 407 */
849   { ERR_TOOMANYTARGETS, "%s :Duplicate recipients. No message delivered", "407" },
850 /* 408 */
851   { 0 },
852 /* 409 */
853   { ERR_NOORIGIN, ":No origin specified", "409" },
854 /* 410 */
855   { 0 },
856 /* 411 */
857   { ERR_NORECIPIENT, ":No recipient given (%s)", "411" },
858 /* 412 */
859   { ERR_NOTEXTTOSEND, ":No text to send", "412" },
860 /* 413 */
861   { ERR_NOTOPLEVEL, "%s :No toplevel domain specified", "413" },
862 /* 414 */
863   { ERR_WILDTOPLEVEL, "%s :Wildcard in toplevel Domain", "414" },
864 /* 415 */
865   { 0 },
866 /* 416 */
867   { ERR_QUERYTOOLONG, "%s :Too many lines in the output, restrict your query", "416" },
868 /* 417 */
869   { 0 },
870 /* 418 */
871   { 0 },
872 /* 419 */
873   { 0 },
874 /* 420 */
875   { 0 },
876 /* 421 */
877   { ERR_UNKNOWNCOMMAND, "%s :Unknown command", "421" },
878 /* 422 */
879   { ERR_NOMOTD, ":MOTD File is missing", "422" },
880 /* 423 */
881   { ERR_NOADMININFO, "%s :No administrative info available", "423" },
882 /* 424 */
883   { 0 },
884 /* 425 */
885   { 0 },
886 /* 426 */
887   { 0 },
888 /* 427 */
889   { 0 },
890 /* 428 */
891   { 0 },
892 /* 429 */
893   { 0 },
894 /* 430 */
895   { 0 },
896 /* 431 */
897   { ERR_NONICKNAMEGIVEN, ":No nickname given", "431" },
898 /* 432 */
899   { ERR_ERRONEUSNICKNAME, "%s :Erroneous Nickname", "432" },
900 /* 433 */
901   { ERR_NICKNAMEINUSE, "%s :Nickname is already in use.", "433" },
902 /* 434 */
903   { 0 },
904 /* 435 */
905   { 0 },
906 /* 436 */
907   { ERR_NICKCOLLISION, "%s :Nickname collision KILL", "436" },
908 /* 437 */
909   { ERR_BANNICKCHANGE, "%s :Cannot change nickname while banned on channel or channel is moderated", "437" },
910 /* 438 */
911   { ERR_NICKTOOFAST, "%s :Nick change too fast. Please wait %d seconds.", "438" },
912 /* 439 */
913   { ERR_TARGETTOOFAST, "%s :Target change too fast. Please wait %d seconds.", "439" },
914 /* 440 */
915   { ERR_SERVICESDOWN, "%s :Services are currently unavailable.", "440" },
916 /* 441 */
917   { ERR_USERNOTINCHANNEL, "%s %s :They aren't on that channel", "441" },
918 /* 442 */
919   { ERR_NOTONCHANNEL, "%s :You're not on that channel", "442" },
920 /* 443 */
921   { ERR_USERONCHANNEL, "%s %s :is already on channel", "443" },
922 /* 444 */
923   { 0 },
924 /* 445 */
925   { 0 },
926 /* 446 */
927   { 0 },
928 /* 447 */
929   { 0 },
930 /* 448 */
931   { 0 },
932 /* 449 */
933   { 0 },
934 /* 450 */
935   { 0 },
936 /* 451 */
937   { ERR_NOTREGISTERED, ":You have not registered", "451" },
938 /* 452 */
939   { 0 },
940 /* 453 */
941   { 0 },
942 /* 454 */
943   { 0 },
944 /* 455 */
945   { 0 },
946 /* 456 */
947   { 0 },
948 /* 457 */
949   { 0 },
950 /* 458 */
951   { 0 },
952 /* 459 */
953   { 0 },
954 /* 460 */
955   { 0 },
956 /* 461 */
957   { ERR_NEEDMOREPARAMS, "%s :Not enough parameters", "461" },
958 /* 462 */
959   { ERR_ALREADYREGISTRED, ":You may not reregister", "462" },
960 /* 463 */
961   { ERR_NOPERMFORHOST, ":Your host isn't among the privileged", "463" },
962 /* 464 */
963   { ERR_PASSWDMISMATCH, ":Password Incorrect", "464" },
964 /* 465 */
965   { ERR_YOUREBANNEDCREEP, ":You are banned from this server", "465" },
966 /* 466 */
967   { ERR_YOUWILLBEBANNED, "", "466" },
968 /* 467 */
969   { ERR_KEYSET, "%s :Channel key already set", "467" },
970 /* 468 */
971   { ERR_INVALIDUSERNAME, 0, "468" },
972 /* 469 */
973   { 0 },
974 /* 470 */
975   { 0 },
976 /* 471 */
977   { ERR_CHANNELISFULL, "%s :Cannot join channel (+l)", "471" },
978 /* 472 */
979   { ERR_UNKNOWNMODE, "%c :is unknown mode char to me", "472" },
980 /* 473 */
981   { ERR_INVITEONLYCHAN, "%s :Cannot join channel (+i)", "473" },
982 /* 474 */
983   { ERR_BANNEDFROMCHAN, "%s :Cannot join channel (+b)", "474" },
984 /* 475 */
985   { ERR_BADCHANNELKEY, "%s :Cannot join channel (+k)", "475" },
986 /* 476 */
987   { ERR_BADCHANMASK, "%s :Bad Channel Mask", "476" },
988 /* 477 */
989   { ERR_NEEDREGGEDNICK, "%s :Cannot join channel (+r)", "477" },
990 /* 478 */
991   { ERR_BANLISTFULL, "%s %s :Channel ban/ignore list is full", "478" },
992 /* 479 */
993   { ERR_BADCHANNAME, "%s :Cannot join channel (access denied on this server)", "479" },
994 /* 480 */
995   { 0 },
996 /* 481 */
997   { ERR_NOPRIVILEGES, ":Permission Denied: Insufficient privileges", "481" },
998 /* 482 */
999   { ERR_CHANOPRIVSNEEDED, "%s :You're not channel operator", "482" },
1000 /* 483 */
1001   { ERR_CANTKILLSERVER, ":You cant kill a server!", "483" },
1002 /* 484 */
1003   { ERR_ISCHANSERVICE, "%s %s :Cannot kill, kick or deop a network service", "484" },
1004 /* 485 */
1005   { 0 },
1006 /* 486 */
1007   { 0 },
1008 /* 487 */
1009   { 0 },
1010 /* 488 */
1011   { 0 },
1012 /* 489 */
1013   { ERR_VOICENEEDED, "%s :You're neither voiced nor channel operator", "489" },
1014 /* 490 */
1015   { 0 },
1016 /* 491 */
1017   { ERR_NOOPERHOST, ":No O-lines for your host", "491" },
1018 /* 492 */
1019   { 0 },
1020 /* 493 */
1021   { ERR_NOFEATURE, "%s :No such feature", "493" },
1022 /* 494 */
1023   { ERR_BADFEATVALUE, "%s :Bad value for feature %s", "494" },
1024 /* 495 */
1025   { ERR_BADLOGTYPE, "%s :No such log type", "495" },
1026 /* 496 */
1027   { ERR_BADLOGSYS, "%s :No such log subsystem", "496" },
1028 /* 497 */
1029   { ERR_BADLOGVALUE, "%s :Bad value for log type", "497" },
1030 /* 498 */
1031   { ERR_ISOPERLCHAN, "%s %s :Cannot kick or deop an IRC Operator on a local channel", "498" },
1032 /* 499 */
1033   { 0 },
1034 /* 500 */
1035   { 0 },
1036 /* 501 */
1037   { ERR_UMODEUNKNOWNFLAG, "%c :Unknown user MODE flag", "501" },
1038 /* 502 */
1039   { ERR_USERSDONTMATCH, ":Cant change mode for other users", "502" },
1040 /* 503 */
1041   { 0 },
1042 /* 504 */
1043   { 0 },
1044 /* 505 */
1045   { 0 },
1046 /* 506 */
1047   { 0 },
1048 /* 507 */
1049   { 0 },
1050 /* 508 */
1051   { 0 },
1052 /* 509 */
1053   { 0 },
1054 /* 510 */
1055   { 0 },
1056 /* 511 */
1057   { ERR_SILELISTFULL, "%s :Your silence list is full", "511" },
1058 /* 512 */
1059   { ERR_NOSUCHGLINE, "%s :No such gline", "512" },
1060 /* 513 */
1061   { ERR_BADPING, 0, "513" },
1062 /* 514 */
1063   { ERR_NOSUCHJUPE, "%s :No such jupe", "514" },
1064 /* 515 */
1065   { ERR_BADEXPIRE, "%Tu :Bad expire time", "515" },
1066 /* 516 */
1067   { ERR_DONTCHEAT, " :Don't Cheat.", "516" },
1068 /* 517 */
1069   { ERR_DISABLED, "%s :Command disabled.", "517" },
1070 /* 518 */
1071   { ERR_LONGMASK, " :Mask is too long", "518" },
1072 /* 519 */
1073   { ERR_TOOMANYUSERS, "%d :Too many users affected by mask", "519" },
1074 /* 520 */
1075   { ERR_MASKTOOWIDE, "%s :Mask is too wide", "520" },
1076 /* 521 */
1077   { 0 },
1078 /* 522 */
1079   { 0 },
1080 /* 523 */
1081   { 0 },
1082 /* 524 */
1083   { ERR_QUARANTINED, "%s :Channel is quarantined : %s", "524" },
1084 /* 525 */
1085   { 0 },
1086 /* 526 */
1087   { 0 },
1088 /* 527 */
1089   { 0 },
1090 /* 528 */
1091   { 0 },
1092 /* 529 */
1093   { 0 },
1094 /* 530 */
1095   { 0 },
1096 /* 531 */
1097   { 0 },
1098 /* 532 */
1099   { 0 },
1100 /* 533 */
1101   { 0 },
1102 /* 534 */
1103   { 0 },
1104 /* 535 */
1105   { 0 },
1106 /* 536 */
1107   { 0 },
1108 /* 537 */
1109   { 0 },
1110 /* 538 */
1111   { 0 },
1112 /* 539 */
1113   { 0 },
1114 /* 540 */
1115   { 0 },
1116 /* 541 */
1117   { 0 },
1118 /* 542 */
1119   { 0 },
1120 /* 543 */
1121   { 0 },
1122 /* 544 */
1123   { 0 },
1124 /* 545 */
1125   { 0 },
1126 /* 546 */
1127   { 0 },
1128 /* 547 */
1129   { 0 },
1130 /* 548 */
1131   { 0 },
1132 /* 549 */
1133   { 0 },
1134 /* 550 */
1135   { ERR_NOTLOWEROPLEVEL, "%s %s %hu %hu :Cannot %s someone with %s op-level", "550" },
1136 /* 551 */
1137   { ERR_NOTMANAGER, "%s :You must be channel Admin to add or remove a password. %s %s %s", "551" },
1138 /* 552 */
1139   { ERR_CHANSECURED, "%s :Channel is older than 48 hours and secured. Cannot change Admin pass anymore", "552" },
1140 /* 553 */
1141   { ERR_UPASSSET, "%s :Cannot remove Admin pass (+A) while User pass (+U) is still set.  First use /MODE %s -U <userpass>", "553" },
1142 /* 554 */
1143   { ERR_UPASSNOTSET, "%s :Cannot set user pass (+U) until Admin pass (+A) is set.  First use /MODE %s +A <adminpass>", "554" },
1144 /* 555 */
1145   { 0 },
1146 /* 556 */
1147   { 0 },
1148 /* 557 */
1149   { 0 },
1150 /* 558 */
1151   { 0 },
1152 /* 559 */
1153   { 0 },
1154 /* 560 */
1155   { 0 },
1156 /* 561 */
1157   { 0 },
1158 /* 562 */
1159   { 0 },
1160 /* 563 */
1161   { 0 },
1162 /* 564 */
1163   { 0 },
1164 /* 565 */
1165   { 0 },
1166 /* 566 */
1167   { 0 },
1168 /* 567 */
1169   { 0 },
1170 /* 568 */
1171   { 0 },
1172 /* 569 */
1173   { 0 },
1174 /* 570 */
1175   { 0 },
1176 /* 571 */
1177   { 0 },
1178 /* 572 */
1179   { 0 },
1180 /* 573 */
1181   { 0 },
1182 /* 574 */
1183   { 0 },
1184 /* 575 */
1185   { 0 },
1186 /* 576 */
1187   { 0 },
1188 /* 577 */
1189   { 0 },
1190 /* 578 */
1191   { 0 },
1192 /* 579 */
1193   { 0 },
1194 /* 580 */
1195   { 0 },
1196 /* 581 */
1197   { 0 },
1198 /* 582 */
1199   { 0 },
1200 /* 583 */
1201   { 0 },
1202 /* 584 */
1203   { 0 },
1204 /* 585 */
1205   { 0 },
1206 /* 586 */
1207   { 0 },
1208 /* 587 */
1209   { 0 },
1210 /* 588 */
1211   { 0 },
1212 /* 589 */
1213   { 0 },
1214 /* 590 */
1215   { 0 },
1216 /* 591 */
1217   { 0 },
1218 /* 592 */
1219   { 0 },
1220 /* 593 */
1221   { 0 },
1222 /* 594 */
1223   { 0 },
1224 /* 595 */
1225   { 0 },
1226 /* 596 */
1227   { 0 },
1228 /* 597 */
1229   { 0 },
1230 /* 598 */
1231   { 0 },
1232 /* 599 */
1233   { 0 }
1234 };
1235
1236 /** Return a pointer to the Numeric for a particular code.
1237  * @param n %Numeric to look up.
1238  * @return Numeric structure.
1239  */
1240 const struct Numeric* get_error_numeric(int n)
1241 {
1242   assert(0 < n);
1243   assert(n < ERR_LASTERROR);
1244   assert(0 != replyTable[n].value);
1245
1246   return &replyTable[n];
1247 }
1248
1249 /** Return a format string for a numeric response.
1250  * @param n %Numeric to look up.
1251  * @return Pointer to a static buffer containing the format string.
1252  */
1253 char* rpl_str(int n)
1254 {
1255   static char numbuff[512];
1256   Numeric* p;
1257
1258   assert(0 < n);
1259   assert(n < ERR_LASTERROR);
1260   assert(0 != replyTable[n].value);
1261
1262   p = &replyTable[n];
1263   strcpy(numbuff, ":%s 000 %s ");
1264   if (p->str) {
1265     numbuff[4] = p->str[0];
1266     numbuff[5] = p->str[1];
1267     numbuff[6] = p->str[2];
1268     strcpy(numbuff + 11, p->format);
1269   }
1270
1271   return numbuff;
1272 }
1273