Anope IRC Services  Version 1.8
ratbox.c
Go to the documentation of this file.
1 /* Ratbox IRCD functions
2  *
3  * (C) 2003-2014 Anope Team
4  * Contact us at team@anope.org
5  *
6  * Please read COPYING and README for further details.
7  *
8  * Based on the original code of Epona by Lara.
9  * Based on the original code of Services by Andy Church.
10  *
11  *
12  */
13 
14 #include "services.h"
15 #include "pseudo.h"
16 #include "ratbox.h"
17 #include "version.h"
18 
20  {"Ratbox 2.0+", /* ircd name */
21  "+oiS", /* nickserv mode */
22  "+oiS", /* chanserv mode */
23  "+oiS", /* memoserv mode */
24  "+oiS", /* hostserv mode */
25  "+oaiS", /* operserv mode */
26  "+oiS", /* botserv mode */
27  "+oiS", /* helpserv mode */
28  "+oiS", /* Dev/Null mode */
29  "+oiS", /* Global mode */
30  "+oiS", /* nickserv alias mode */
31  "+oiS", /* chanserv alias mode */
32  "+oiS", /* memoserv alias mode */
33  "+oiS", /* hostserv alias mode */
34  "+oaiS", /* operserv alias mode */
35  "+oiS", /* botserv alias mode */
36  "+oiS", /* helpserv alias mode */
37  "+oiS", /* Dev/Null alias mode */
38  "+oiS", /* Global alias mode */
39  "+oiS", /* Used by BotServ Bots */
40  2, /* Chan Max Symbols */
41  "-acilmnpst", /* Modes to Remove */
42  "+o", /* Channel Umode used by Botserv bots */
43  0, /* SVSNICK */
44  0, /* Vhost */
45  0, /* Has Owner */
46  NULL, /* Mode to set for an owner */
47  NULL, /* Mode to unset for an owner */
48  NULL, /* Mode to set for chan admin */
49  NULL, /* Mode to unset for chan admin */
50  NULL, /* Mode On Reg */
51  NULL, /* Mode on ID for Roots */
52  NULL, /* Mode on ID for Admins */
53  NULL, /* Mode on ID for Opers */
54  NULL, /* Mode on UnReg */
55  NULL, /* Mode on Nick Change */
56  1, /* Supports SGlines */
57  1, /* Supports SQlines */
58  0, /* Supports SZlines */
59  0, /* Supports Halfop +h */
60  3, /* Number of server args */
61  1, /* Join 2 Set */
62  1, /* Join 2 Message */
63  1, /* Has exceptions +e */
64  0, /* TS Topic Forward */
65  0, /* TS Topci Backward */
66  0, /* Protected Umode */
67  0, /* Has Admin */
68  1, /* Chan SQlines */
69  0, /* Quit on Kill */
70  0, /* SVSMODE unban */
71  0, /* Has Protect */
72  0, /* Reverse */
73  0, /* Chan Reg */
74  0, /* Channel Mode */
75  0, /* vidents */
76  0, /* svshold */
77  0, /* time stamp on mode */
78  0, /* NICKIP */
79  0, /* UMODE */
80  0, /* O:LINE */
81  0, /* VHOST ON NICK */
82  0, /* Change RealName */
83  CMODE_p, /* No Knock */
84  0, /* Admin Only */
85  DEFAULT_MLOCK, /* Default MLOCK */
86  0, /* Vhost Mode */
87  0, /* +f */
88  0, /* +L */
89  0, /* +f Mode */
90  0, /* +L Mode */
91  0, /* On nick change check if they could be identified */
92  0, /* No Knock requires +i */
93  NULL, /* CAPAB Chan Modes */
94  0, /* We support TOKENS */
95  1, /* TOKENS are CASE inSensitive */
96  0, /* TIME STAMPS are BASE64 */
97  1, /* +I support */
98  0, /* SJOIN ban char */
99  0, /* SJOIN except char */
100  0, /* SJOIN invite char */
101  0, /* Can remove User Channel Modes with SVSMODE */
102  0, /* Sglines are not enforced until user reconnects */
103  NULL, /* vhost char */
104  1, /* ts6 */
105  0, /* support helper umode */
106  0, /* p10 */
107  NULL, /* character set */
108  0, /* reports sync state */
109  0, /* CIDR channelbans */
110  0, /* +j */
111  0, /* +j mode */
112  0, /* Use delayed client introduction. */
113  }
114  ,
115  {NULL}
116 };
117 
119  {
120  0, /* NOQUIT */
121  0, /* TSMODE */
122  0, /* UNCONNECT */
123  0, /* NICKIP */
124  0, /* SJOIN */
125  CAPAB_ZIP, /* ZIP */
126  0, /* BURST */
127  CAPAB_TS5, /* TS5 */
128  0, /* TS3 */
129  0, /* DKEY */
130  0, /* PT4 */
131  0, /* SCS */
132  CAPAB_QS, /* QS */
133  CAPAB_UID, /* UID */
134  CAPAB_KNOCK, /* KNOCK */
135  0, /* CLIENT */
136  0, /* IPV6 */
137  0, /* SSJ5 */
138  0, /* SN2 */
139  0, /* TOKEN */
140  0, /* VHOST */
141  0, /* SSJ3 */
142  0, /* NICK2 */
143  0, /* UMODE2 */
144  0, /* VL */
145  0, /* TLKEXT */
146  0, /* DODKEY */
147  0, /* DOZIP */
148  0, 0, 0}
149 };
150 
151 void ratbox_set_umode(User * user, int ac, char **av)
152 {
153  int add = 1; /* 1 if adding modes, 0 if deleting */
154  char *modes = av[0];
155 
156  ac--;
157 
158  if (debug)
159  alog("debug: Changing mode for %s to %s", user->nick, modes);
160 
161  while (*modes) {
162 
163  /* This looks better, much better than "add ? (do_add) : (do_remove)".
164  * At least this is readable without paying much attention :) -GD
165  */
166  if (add)
167  user->mode |= umodes[(int) *modes];
168  else
169  user->mode &= ~umodes[(int) *modes];
170 
171  switch (*modes++) {
172  case '+':
173  add = 1;
174  break;
175  case '-':
176  add = 0;
177  break;
178  case 'o':
179  if (add) {
180  opcnt++;
181 
182  if (WallOper)
184  "\2%s\2 is now an IRC operator.",
185  user->nick);
186  display_news(user, NEWS_OPER);
187 
188  } else {
189  opcnt--;
190  }
191  break;
192  }
193  }
194 }
195 
196 unsigned long umodes[128] = {
197  0, 0, 0, /* Unused */
198  0, 0, 0, /* Unused */
199  0, 0, 0, /* Unused, Unused, Horzontal Tab */
200  0, 0, 0, /* Line Feed, Unused, Unused */
201  0, 0, 0, /* Carriage Return, Unused, Unused */
202  0, 0, 0, /* Unused */
203  0, 0, 0, /* Unused */
204  0, 0, 0, /* Unused */
205  0, 0, 0, /* Unused */
206  0, 0, 0, /* Unused */
207  0, 0, 0, /* Unused, Unused, Space */
208  0, 0, 0, /* ! " # */
209  0, 0, 0, /* $ % & */
210  0, 0, 0, /* ! ( ) */
211  0, 0, 0, /* * + , */
212  0, 0, 0, /* - . / */
213  0, 0, /* 0 1 */
214  0, 0, /* 2 3 */
215  0, 0, /* 4 5 */
216  0, 0, /* 6 7 */
217  0, 0, /* 8 9 */
218  0, 0, /* : ; */
219  0, 0, 0, /* < = > */
220  0, 0, /* ? @ */
221  0, 0, 0, /* A B C */
222  0, 0, 0, /* D E F */
223  0, 0, 0, /* G H I */
224  0, 0, 0, /* J K L */
225  0, 0, 0, /* M N O */
226  0, 0, 0, /* P Q R */
227  0, 0, 0, /* S T U */
228  0, 0, 0, /* V W X */
229  0, /* Y */
230  0, /* Z */
231  0, 0, 0, /* [ \ ] */
232  0, 0, 0, /* ^ _ ` */
233  UMODE_a, UMODE_b, 0, /* a b c */
234  UMODE_d, 0, 0, /* d e f */
235  UMODE_g, 0, UMODE_i, /* g h i */
236  0, 0, UMODE_l, /* j k l */
237  0, UMODE_n, UMODE_o, /* m n o */
238  0, 0, 0, /* p q r */
239  0, 0, UMODE_u, /* s t u */
240  0, UMODE_w, UMODE_x, /* v w x */
241  0, /* y */
242  0, /* z */
243  0, 0, 0, /* { | } */
244  0, 0 /* ~ � */
245 };
246 
247 
248 char myCsmodes[128] = {
249  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
250  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
251 
252  0,
253  0,
254  0, 0, 0,
255  0,
256  0, 0, 0, 0,
257  0,
258 
259  'v', 0, 0, 0, 0,
260  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
261 
262  'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
263  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
264 
265  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
266  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
267 };
268 
270  {NULL}, {NULL}, {NULL},
271  {NULL}, {NULL}, {NULL},
272  {NULL}, {NULL}, {NULL},
273  {NULL}, {NULL}, {NULL},
274  {NULL}, {NULL}, {NULL},
275  {NULL}, {NULL}, {NULL},
276  {NULL}, {NULL}, {NULL},
277  {NULL}, {NULL}, {NULL},
278  {NULL}, {NULL}, {NULL},
279  {NULL}, {NULL}, {NULL},
280  {NULL}, {NULL}, {NULL},
281  {NULL}, {NULL}, {NULL},
282  {NULL}, {NULL}, {NULL},
283  {NULL}, {NULL}, {NULL},
284  {NULL}, {NULL}, {NULL},
285  {NULL}, {NULL}, {NULL},
286  {NULL}, {NULL}, {NULL},
287  {NULL}, {NULL}, {NULL},
288  {NULL}, {NULL}, {NULL},
289  {NULL}, {NULL}, {NULL},
290  {NULL}, {NULL}, {NULL},
291  {NULL}, {NULL}, {NULL},
292  {NULL}, {NULL}, {NULL}, /* BCD */
293  {NULL}, {NULL}, {NULL}, /* EFG */
294  {NULL}, /* H */
296  {NULL}, /* J */
297  {NULL}, {NULL}, {NULL}, /* KLM */
298  {NULL}, {NULL}, {NULL}, /* NOP */
299  {NULL}, {NULL}, {NULL}, /* QRS */
300  {NULL}, {NULL}, {NULL}, /* TUV */
301  {NULL}, {NULL}, {NULL}, /* WXY */
302  {NULL}, /* Z */
303  {NULL}, {NULL}, /* (char 91 - 92) */
304  {NULL}, {NULL}, {NULL}, /* (char 93 - 95) */
305  {NULL}, /* ` (char 96) */
306  {NULL}, /* a (char 97) */
307  {add_ban, del_ban},
308  {NULL},
309  {NULL},
311  {NULL},
312  {NULL},
313  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
314  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
315  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}
316 };
317 
318 
320  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
321  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
322  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
323  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
324  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
325  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
326  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
327  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
328  {0},
329  {0}, /* A */
330  {0}, /* B */
331  {0}, /* C */
332  {0}, /* D */
333  {0}, /* E */
334  {0}, /* F */
335  {0}, /* G */
336  {0}, /* H */
337  {0}, /* I */
338  {0}, /* J */
339  {0}, /* K */
340  {0}, /* L */
341  {0}, /* M */
342  {0}, /* N */
343  {0}, /* O */
344  {0}, /* P */
345  {0}, /* Q */
346  {0}, /* R */
347  {0}, /* S */
348  {0}, /* T */
349  {0}, /* U */
350  {0}, /* V */
351  {0}, /* W */
352  {0}, /* X */
353  {0}, /* Y */
354  {0}, /* Z */
355  {0}, {0}, {0}, {0}, {0}, {0},
356  {0},
357  {0}, /* b */
358  {0}, /* c */
359  {0}, /* d */
360  {0}, /* e */
361  {0}, /* f */
362  {0}, /* g */
363  {0}, /* h */
364  {CMODE_i, 0, NULL, NULL},
365  {0}, /* j */
368  {CMODE_m, 0, NULL, NULL},
369  {CMODE_n, 0, NULL, NULL},
370  {0}, /* o */
371  {CMODE_p, 0, NULL, NULL},
372  {0}, /* q */
373  {0},
374  {CMODE_s, 0, NULL, NULL},
375  {CMODE_t, 0, NULL, NULL},
376  {0},
377  {0}, /* v */
378  {0}, /* w */
379  {0}, /* x */
380  {0}, /* y */
381  {0}, /* z */
382  {0}, {0}, {0}, {0}
383 };
384 
386  {'i', CMODE_i, 0, NULL, NULL},
387  {'k', CMODE_k, 0, get_key, cs_get_key},
389  {'m', CMODE_m, 0, NULL, NULL},
390  {'n', CMODE_n, 0, NULL, NULL},
391  {'p', CMODE_p, 0, NULL, NULL},
392  {'s', CMODE_s, 0, NULL, NULL},
393  {'t', CMODE_t, 0, NULL, NULL},
394  {0}
395 };
396 
397 
399  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
400  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
401  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
402  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
403 
404  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
405  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
406  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
407  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
408 
409  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
410  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
411  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
412  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
413 
414  {0},
415 
416  {0}, /* a */
417  {0}, /* b */
418  {0}, /* c */
419  {0}, /* d */
420  {0}, /* e */
421  {0}, /* f */
422  {0}, /* g */
423  {0},
424  {0}, /* i */
425  {0}, /* j */
426  {0}, /* k */
427  {0}, /* l */
428  {0}, /* m */
429  {0}, /* n */
431  {0}, /* p */
432  {0}, /* q */
433  {0}, /* r */
434  {0}, /* s */
435  {0}, /* t */
436  {0}, /* u */
437  {CUS_VOICE, 0, NULL},
438  {0}, /* w */
439  {0}, /* x */
440  {0}, /* y */
441  {0}, /* z */
442  {0}, {0}, {0}, {0}, {0}
443 };
444 
445 
446 
447 void ratbox_cmd_notice(char *source, char *dest, char *buf)
448 {
449  Uid *ud;
450  User *u;
451 
452  if (!buf) {
453  return;
454  }
455 
456  if (NSDefFlags & NI_MSG) {
457  ratbox_cmd_privmsg2(source, dest, buf);
458  } else {
459  ud = find_uid(source);
460  u = finduser(dest);
461  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source),
462  "NOTICE %s :%s", (UseTS6 ? (u ? u->uid : dest) : dest),
463  buf);
464  }
465 }
466 
467 void ratbox_cmd_notice2(char *source, char *dest, char *msg)
468 {
469  Uid *ud;
470  User *u;
471 
472  ud = find_uid(source);
473  u = finduser(dest);
474  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "NOTICE %s :%s",
475  (UseTS6 ? (u ? u->uid : dest) : dest), msg);
476 }
477 
478 void ratbox_cmd_privmsg(char *source, char *dest, char *buf)
479 {
480  Uid *ud, *ud2;
481 
482  if (!buf) {
483  return;
484  }
485  ud = find_uid(source);
486  ud2 = find_uid(dest);
487 
488  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "PRIVMSG %s :%s",
489  (UseTS6 ? (ud2 ? ud2->uid : dest) : dest), buf);
490 }
491 
492 void ratbox_cmd_privmsg2(char *source, char *dest, char *msg)
493 {
494  Uid *ud, *ud2;
495 
496  ud = find_uid(source);
497  ud2 = find_uid(dest);
498 
499  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "PRIVMSG %s :%s",
500  (UseTS6 ? (ud2 ? ud2->uid : dest) : dest), msg);
501 }
502 
503 void ratbox_cmd_serv_notice(char *source, char *dest, char *msg)
504 {
505  send_cmd(source, "NOTICE $$%s :%s", dest, msg);
506 }
507 
508 void ratbox_cmd_serv_privmsg(char *source, char *dest, char *msg)
509 {
510  send_cmd(source, "PRIVMSG $$%s :%s", dest, msg);
511 }
512 
513 
514 void ratbox_cmd_global(char *source, char *buf)
515 {
516  Uid *u;
517 
518  if (!buf) {
519  return;
520  }
521 
522  if (source) {
523  u = find_uid(source);
524  if (u) {
525  send_cmd((UseTS6 ? u->uid : source), "OPERWALL :%s", buf);
526  } else {
527  send_cmd((UseTS6 ? TS6SID : ServerName), "OPERWALL :%s", buf);
528  }
529  } else {
530  send_cmd((UseTS6 ? TS6SID : ServerName), "OPERWALL :%s", buf);
531  }
532 }
533 
534 /* GLOBOPS - to handle old WALLOPS */
535 void ratbox_cmd_global_legacy(char *source, char *fmt)
536 {
537  Uid *u;
538 
539  if (source) {
540  u = find_uid(source);
541  if (u) {
542  send_cmd((UseTS6 ? u->uid : source), "OPERWALL :%s", fmt);
543  } else {
544  send_cmd((UseTS6 ? TS6SID : ServerName), "OPERWALL :%s", fmt);
545  }
546  } else {
547  send_cmd((UseTS6 ? TS6SID : ServerName), "OPERWALL :%s", fmt);
548  }
549 
550  send_cmd(source ? source : ServerName, "OPERWALL :%s", fmt);
551 }
552 
553 int ratbox_login(int argc, char **argv)
554 {
555  send_cmd((UseTS6 ? TS6SID : ServerName), "ENCAP * SU %s :%s", argv[0], argv[0]);
556 
557  return MOD_CONT;
558 }
559 
560 int ratbox_logout(int argc, char **argv)
561 {
562  send_cmd((UseTS6 ? TS6SID : ServerName), "ENCAP * SU %s", argv[0]);
563 
564  return MOD_CONT;
565 }
566 
567 int anope_event_sjoin(char *source, int ac, char **av)
568 {
569  do_sjoin(source, ac, av);
570  return MOD_CONT;
571 }
572 
573 /*
574  Non TS6
575 
576  av[0] = nick
577  av[1] = hop
578  av[2] = ts
579  av[3] = modes
580  av[4] = user
581  av[5] = host
582  av[6] = server
583  av[7] = info
584 
585  TS6
586  av[0] = nick
587  av[1] = hop
588  av[2] = ts
589  av[3] = modes
590  av[4] = user
591  av[5] = host
592  av[6] = IP
593  av[7] = UID
594  av[8] = info
595 
596 */
597 int anope_event_nick(char *source, int ac, char **av)
598 {
599  Server *s;
600  User *user;
601 
602  if (UseTS6 && ac == 9) {
603  s = findserver_uid(servlist, source);
604  /* Source is always the server */
605  *source = '\0';
606  user = do_nick(source, av[0], av[4], av[5], s->name, av[8],
607  strtoul(av[2], NULL, 10), 0, 0, "*", av[7]);
608  if (user) {
609  anope_set_umode(user, 1, &av[3]);
610  }
611  } else {
612  if (ac != 2) {
613  user = do_nick(source, av[0], av[4], av[5], av[6], av[7],
614  strtoul(av[2], NULL, 10), 0, 0, "*", NULL);
615  if (user)
616  anope_set_umode(user, 1, &av[3]);
617  } else {
618  do_nick(source, av[0], NULL, NULL, NULL, NULL,
619  strtoul(av[1], NULL, 10), 0, 0, NULL, NULL);
620  }
621  }
622  return MOD_CONT;
623 }
624 
625 int anope_event_topic(char *source, int ac, char **av)
626 {
627  User *u;
628 
629  if (ac == 4) {
630  do_topic(source, ac, av);
631  } else {
632  Channel *c = findchan(av[0]);
633  time_t topic_time = time(NULL);
634 
635  if (!c) {
636  if (debug) {
637  alog("debug: TOPIC %s for nonexistent channel %s",
638  merge_args(ac - 1, av + 1), av[0]);
639  }
640  return MOD_CONT;
641  }
642 
643  if (check_topiclock(c, topic_time))
644  return MOD_CONT;
645 
646  if (c->topic) {
647  free(c->topic);
648  c->topic = NULL;
649  }
650  if (ac > 1 && *av[1])
651  c->topic = sstrdup(av[1]);
652 
653  if (UseTS6) {
654  u = find_byuid(source);
655  if (u) {
656  strscpy(c->topic_setter, u->nick, sizeof(c->topic_setter));
657  } else {
658  strscpy(c->topic_setter, source, sizeof(c->topic_setter));
659  }
660  } else {
661  strscpy(c->topic_setter, source, sizeof(c->topic_setter));
662  }
663  c->topic_time = topic_time;
664 
665  record_topic(av[0]);
666 
667  if (ac > 1 && *av[1])
668  send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[1]);
669  else
670  send_event(EVENT_TOPIC_UPDATED, 2, av[0], "");
671  }
672  return MOD_CONT;
673 }
674 
675 int anope_event_tburst(char *source, int ac, char **av)
676 {
677  char *setter;
678  Channel *c;
679  time_t topic_time;
680 
681  if (ac != 4) {
682  return MOD_CONT;
683  }
684 
685  setter = myStrGetToken(av[2], '!', 0);
686 
687  c = findchan(av[0]);
688  topic_time = strtol(av[1], NULL, 10);
689 
690  if (!c) {
691  if (debug) {
692  alog("debug: TOPIC %s for nonexistent channel %s",
693  merge_args(ac - 1, av + 1), av[0]);
694  }
695  if (setter)
696  free(setter);
697  return MOD_CONT;
698  }
699 
700  if (check_topiclock(c, topic_time)) {
701  if (setter)
702  free(setter);
703  return MOD_CONT;
704  }
705 
706  if (c->topic) {
707  free(c->topic);
708  c->topic = NULL;
709  }
710  if (ac > 1 && *av[3])
711  c->topic = sstrdup(av[3]);
712 
713  strscpy(c->topic_setter, setter, sizeof(c->topic_setter));
714  c->topic_time = topic_time;
715 
716  record_topic(av[0]);
717  if (setter)
718  free(setter);
719  return MOD_CONT;
720 }
721 
722 int anope_event_436(char *source, int ac, char **av)
723 {
724  if (ac < 1)
725  return MOD_CONT;
726 
727  m_nickcoll(av[0]);
728  return MOD_CONT;
729 }
730 
731 
732 /* *INDENT-OFF* */
733 void moduleAddIRCDMsgs(void)
734 {
735  Message *m;
736 
737  updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+","-");
738 
739  if (UseTS6) {
741  UseTSMODE = 1; /* TMODE */
742  }
743 
781 }
782 
783 /* *INDENT-ON* */
784 
785 
786 void ratbox_cmd_sqline(char *mask, char *reason)
787 {
788  Uid *ud;
789 
790  ud = find_uid(s_OperServ);
791  send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
792  "RESV * %s :%s", mask, reason);
793 }
794 
795 void ratbox_cmd_unsgline(char *mask)
796 {
797  Uid *ud;
798 
799  ud = find_uid(s_OperServ);
800  send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
801  "UNXLINE * %s", mask);
802 }
803 
804 void ratbox_cmd_unszline(char *mask)
805 {
806  /* Does not support */
807 }
808 
809 void ratbox_cmd_szline(char *mask, char *reason, char *whom)
810 {
811  /* Does not support */
812 }
813 
814 void ratbox_cmd_svsnoop(char *server, int set)
815 {
816  /* does not support */
817 }
818 
819 void ratbox_cmd_svsadmin(char *server, int set)
820 {
821  ratbox_cmd_svsnoop(server, set);
822 }
823 
824 void ratbox_cmd_sgline(char *mask, char *reason)
825 {
826  Uid *ud;
827 
828  ud = find_uid(s_OperServ);
829  send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
830  "XLINE * %s 0 :%s", mask, reason);
831 }
832 
833 void ratbox_cmd_remove_akill(char *user, char *host)
834 {
835  Uid *ud;
836 
837  ud = find_uid(s_OperServ);
838  send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
839  "UNKLINE * %s %s", user, host);
840 }
841 
842 void ratbox_cmd_topic(char *whosets, char *chan, char *whosetit,
843  char *topic, time_t when)
844 {
845  Uid *ud;
846 
847  ud = find_uid(whosets);
848  send_cmd((UseTS6 ? (ud ? ud->uid : whosets) : whosets), "TOPIC %s :%s",
849  chan, topic);
850 }
851 
853 {
854  /* not supported */
855 }
856 
857 void ratbox_cmd_vhost_on(char *nick, char *vIdent, char *vhost)
858 {
859  /* not supported */
860 }
861 
862 void ratbox_cmd_unsqline(char *user)
863 {
864  Uid *ud;
865 
866  ud = find_uid(s_OperServ);
867  send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
868  "UNRESV * %s", user);
869 }
870 
871 void ratbox_cmd_join(char *user, char *channel, time_t chantime)
872 {
873  Uid *ud;
874 
875  ud = find_uid(user);
876  send_cmd(NULL, "SJOIN %ld %s + :%s", (long int) chantime,
877  channel, (UseTS6 ? (ud ? ud->uid : user) : user));
878 }
879 
880 /*
881 oper: the nick of the oper performing the kline
882 target.server: the server(s) this kline is destined for
883 duration: the duration if a tkline, 0 if permanent.
884 user: the 'user' portion of the kline
885 host: the 'host' portion of the kline
886 reason: the reason for the kline.
887 */
888 
889 void ratbox_cmd_akill(char *user, char *host, char *who, time_t when,
890  time_t expires, char *reason)
891 {
892  Uid *ud;
893 
894  ud = find_uid(s_OperServ);
895 
896  send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
897  "KLINE * %ld %s %s :%s",
898  (long int) (expires - (long) time(NULL)), user, host, reason);
899 }
900 
901 void ratbox_cmd_svskill(char *source, char *user, char *buf)
902 {
903  Uid *ud, *ud2;
904 
905  if (!buf) {
906  return;
907  }
908 
909  if (!source || !user) {
910  return;
911  }
912 
913  ud = find_uid(source);
914  ud2 = find_uid(user);
915  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "KILL %s :%s",
916  (UseTS6 ? (ud2 ? ud2->uid : user) : user), buf);
917 }
918 
919 void ratbox_cmd_svsmode(User * u, int ac, char **av)
920 {
921  send_cmd((UseTS6 ? TS6SID : ServerName), "SVSMODE %s %s", u->nick,
922  av[0]);
923 }
924 
925 /*
926  * SVINFO
927  * parv[0] = sender prefix
928  * parv[1] = TS_CURRENT for the server
929  * parv[2] = TS_MIN for the server
930  * parv[3] = server is standalone or connected to non-TS only
931  * parv[4] = server's idea of UTC time
932  */
934 {
935  send_cmd(NULL, "SVINFO 6 3 0 :%ld", (long int) time(NULL));
936 }
937 
939 {
940 
941 }
942 
943 /* CAPAB */
944 /*
945  QS - Can handle quit storm removal
946  EX - Can do channel +e exemptions
947  CHW - Can do channel wall @#
948  LL - Can do lazy links
949  IE - Can do invite exceptions
950  EOB - Can do EOB message
951  KLN - Can do KLINE message
952  GLN - Can do GLINE message
953  HUB - This server is a HUB
954  UID - Can do UIDs
955  ZIP - Can do ZIPlinks
956  ENC - Can do ENCrypted links
957  KNOCK - supports KNOCK
958  TBURST - supports TBURST
959  PARA - supports invite broadcasting for +p
960  ENCAP - ?
961 */
963 {
964  send_cmd(NULL,
965  "CAPAB :QS EX CHW IE KLN GLN KNOCK TB UNKLN CLUSTER ENCAP");
966 }
967 
968 /* PASS */
969 void ratbox_cmd_pass(char *pass)
970 {
971  if (UseTS6) {
972  send_cmd(NULL, "PASS %s TS 6 :%s", pass, TS6SID);
973  } else {
974  send_cmd(NULL, "PASS %s :TS", pass);
975  }
976 }
977 
978 /* SERVER name hop descript */
979 void ratbox_cmd_server(char *servname, int hop, char *descript)
980 {
981  send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript);
982 }
983 
985 {
986  /* Make myself known to myself in the serverlist */
987  if (UseTS6) {
988  me_server =
990  } else {
991  me_server =
993  }
994  if (servernum == 1)
996  else if (servernum == 2)
998  else if (servernum == 3)
1000 
1001  ratbox_cmd_capab();
1004 }
1005 
1007 {
1008  /* Not used */
1009 }
1010 
1011 void ratbox_cmd_bot_nick(char *nick, char *user, char *host, char *real,
1012  char *modes)
1013 {
1014  EnforceQlinedNick(nick, NULL);
1015  if (UseTS6) {
1016  char *uidbuf = ts6_uid_retrieve();
1017  send_cmd(TS6SID, "UID %s 1 %ld %s %s %s 0 %s :%s", nick,
1018  (long int) time(NULL), modes, user, host, uidbuf,
1019  real);
1020  new_uid(nick, uidbuf);
1021  } else {
1022  send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s :%s", nick,
1023  (long int) time(NULL), modes, user, host, ServerName,
1024  real);
1025  }
1026  ratbox_cmd_sqline(nick, "Reserved for services");
1027 }
1028 
1029 void ratbox_cmd_part(char *nick, char *chan, char *buf)
1030 {
1031  Uid *ud;
1032 
1033  ud = find_uid(nick);
1034 
1035  if (buf) {
1036  send_cmd((UseTS6 ? ud->uid : nick), "PART %s :%s", chan, buf);
1037  } else {
1038  send_cmd((UseTS6 ? ud->uid : nick), "PART %s", chan);
1039  }
1040 }
1041 
1042 int anope_event_ping(char *source, int ac, char **av)
1043 {
1044  if (ac < 1)
1045  return MOD_CONT;
1046  ratbox_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]);
1047  return MOD_CONT;
1048 }
1049 
1050 int anope_event_away(char *source, int ac, char **av)
1051 {
1052  User *u = NULL;
1053 
1054  if (UseTS6) {
1055  u = find_byuid(source);
1056  }
1057 
1058  m_away((UseTS6 ? (u ? u->nick : source) : source),
1059  (ac ? av[0] : NULL));
1060  return MOD_CONT;
1061 }
1062 
1063 int anope_event_kill(char *source, int ac, char **av)
1064 {
1065  User *u = NULL;
1066  Uid *ud = NULL;
1067 
1068  if (ac != 2)
1069  return MOD_CONT;
1070 
1071  if (UseTS6) {
1072  u = find_byuid(source);
1073  ud = find_nickuid(av[0]);
1074  }
1075 
1076  m_kill(u ? u->nick : (ud ? ud->nick : av[0]), av[1]);
1077  return MOD_CONT;
1078 }
1079 
1080 int anope_event_kick(char *source, int ac, char **av)
1081 {
1082  if (ac != 3)
1083  return MOD_CONT;
1084  do_kick(source, ac, av);
1085  return MOD_CONT;
1086 }
1087 
1089 {
1090  /* doesn't support EOB */
1091 }
1092 
1093 int anope_event_join(char *source, int ac, char **av)
1094 {
1095  if (ac != 1) {
1096  do_sjoin(source, ac, av);
1097  return MOD_CONT;
1098  } else {
1099  do_join(source, ac, av);
1100  }
1101  return MOD_CONT;
1102 }
1103 
1104 int anope_event_motd(char *source, int ac, char **av)
1105 {
1106  if (!source) {
1107  return MOD_CONT;
1108  }
1109 
1110  m_motd(source);
1111  return MOD_CONT;
1112 }
1113 
1114 int anope_event_privmsg(char *source, int ac, char **av)
1115 {
1116  User *u;
1117  Uid *ud;
1118 
1119  if (ac != 2) {
1120  return MOD_CONT;
1121  }
1122 
1123  u = find_byuid(source);
1124  ud = find_nickuid(av[0]);
1125  m_privmsg((UseTS6 ? (u ? u->nick : source) : source),
1126  (UseTS6 ? (ud ? ud->nick : av[0]) : av[0]), av[1]);
1127  return MOD_CONT;
1128 }
1129 
1130 int anope_event_part(char *source, int ac, char **av)
1131 {
1132  User *u;
1133 
1134  if (ac < 1 || ac > 2) {
1135  return MOD_CONT;
1136  }
1137 
1138  u = find_byuid(source);
1139  do_part((UseTS6 ? (u ? u->nick : source) : source), ac, av);
1140 
1141  return MOD_CONT;
1142 }
1143 
1144 int anope_event_whois(char *source, int ac, char **av)
1145 {
1146  Uid *ud;
1147 
1148  if (source && ac >= 1) {
1149  ud = find_nickuid(av[0]);
1150  m_whois(source, (UseTS6 ? (ud ? ud->nick : av[0]) : av[0]));
1151  }
1152  return MOD_CONT;
1153 }
1154 
1155 /* EVENT: SERVER */
1156 int anope_event_server(char *source, int ac, char **av)
1157 {
1158  if (!stricmp(av[1], "1")) {
1159  uplink = sstrdup(av[0]);
1160  if (UseTS6 && TS6UPLINK) {
1161  do_server(source, av[0], av[1], av[2], TS6UPLINK);
1162  } else {
1163  do_server(source, av[0], av[1], av[2], NULL);
1164  }
1165  } else {
1166  do_server(source, av[0], av[1], av[2], NULL);
1167  }
1168  return MOD_CONT;
1169 }
1170 
1171 int anope_event_encap(char *source, int ac, char **av)
1172 {
1173  if (ac > 2 && !strcmp(av[1], "LOGIN"))
1174  {
1175  User *u = NULL;
1176  if (UseTS6)
1177  u = find_byuid(source);
1178  if (!u)
1179  u = finduser(source);
1180  if (u && u->na && !nick_identified(u) && !strcmp(u->nick, av[2]))
1181  {
1182  u->na->status |= NS_IDENTIFIED;
1183  check_memos(u);
1184 
1185  if (NSNickTracking)
1187 
1188  u->na->last_seen = time(NULL);
1189  if (u->na->last_usermask)
1190  free(u->na->last_usermask);
1191  u->na->last_usermask = smalloc(strlen(common_get_vident(u)) + strlen(common_get_vhost(u)) + 2);
1192  sprintf(u->na->last_usermask, "%s@%s", common_get_vident(u), common_get_vhost(u));
1193 
1194  alog("%s: %s!%s@%s automatically identified for nick %s", s_NickServ, u->nick, u->username, u->host, u->nick);
1195  }
1196  }
1197 
1198  return MOD_CONT;
1199 }
1200 
1201 int anope_event_sid(char *source, int ac, char **av)
1202 {
1203  Server *s;
1204 
1205  /* :42X SID trystan.nomadirc.net 2 43X :ircd-ratbox test server */
1206 
1207  s = findserver_uid(servlist, source);
1208 
1209  do_server(s->name, av[0], av[1], av[3], av[2]);
1210  return MOD_CONT;
1211 }
1212 
1213 int anope_event_squit(char *source, int ac, char **av)
1214 {
1215  if (ac != 2)
1216  return MOD_CONT;
1217  do_squit(source, ac, av);
1218  return MOD_CONT;
1219 }
1220 
1221 int anope_event_quit(char *source, int ac, char **av)
1222 {
1223  User *u;
1224 
1225  if (ac != 1) {
1226  return MOD_CONT;
1227  }
1228 
1229  u = find_byuid(source);
1230 
1231  do_quit((UseTS6 ? (u ? u->nick : source) : source), ac, av);
1232  return MOD_CONT;
1233 }
1234 
1235 void ratbox_cmd_372(char *source, char *msg)
1236 {
1237  send_cmd((UseTS6 ? TS6SID : ServerName), "372 %s :- %s", source, msg);
1238 }
1239 
1240 void ratbox_cmd_372_error(char *source)
1241 {
1243  "422 %s :- MOTD file not found! Please "
1244  "contact your IRC administrator.", source);
1245 }
1246 
1247 void ratbox_cmd_375(char *source)
1248 {
1250  "375 %s :- %s Message of the Day", source, ServerName);
1251 }
1252 
1253 void ratbox_cmd_376(char *source)
1254 {
1256  "376 %s :End of /MOTD command.", source);
1257 }
1258 
1259 /* 391 */
1260 void ratbox_cmd_391(char *source, char *timestr)
1261 {
1262  if (!timestr) {
1263  return;
1264  }
1265  send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr);
1266 }
1267 
1268 /* 250 */
1269 void ratbox_cmd_250(char *buf)
1270 {
1271  if (!buf) {
1272  return;
1273  }
1274 
1275  send_cmd(NULL, "250 %s", buf);
1276 }
1277 
1278 /* 307 */
1279 void ratbox_cmd_307(char *buf)
1280 {
1281  if (!buf) {
1282  return;
1283  }
1284 
1285  send_cmd((UseTS6 ? TS6SID : ServerName), "307 %s", buf);
1286 }
1287 
1288 /* 311 */
1289 void ratbox_cmd_311(char *buf)
1290 {
1291  if (!buf) {
1292  return;
1293  }
1294 
1295  send_cmd((UseTS6 ? TS6SID : ServerName), "311 %s", buf);
1296 }
1297 
1298 /* 312 */
1299 void ratbox_cmd_312(char *buf)
1300 {
1301  if (!buf) {
1302  return;
1303  }
1304 
1305  send_cmd((UseTS6 ? TS6SID : ServerName), "312 %s", buf);
1306 }
1307 
1308 /* 317 */
1309 void ratbox_cmd_317(char *buf)
1310 {
1311  if (!buf) {
1312  return;
1313  }
1314 
1315  send_cmd((UseTS6 ? TS6SID : ServerName), "317 %s", buf);
1316 }
1317 
1318 /* 219 */
1319 void ratbox_cmd_219(char *source, char *letter)
1320 {
1321  if (!source) {
1322  return;
1323  }
1324 
1325  if (letter) {
1326  send_cmd(NULL, "219 %s %c :End of /STATS report.", source,
1327  *letter);
1328  } else {
1329  send_cmd(NULL, "219 %s l :End of /STATS report.", source);
1330  }
1331 }
1332 
1333 /* 401 */
1334 void ratbox_cmd_401(char *source, char *who)
1335 {
1336  if (!source || !who) {
1337  return;
1338  }
1339  send_cmd((UseTS6 ? TS6SID : ServerName), "401 %s %s :No such service.",
1340  source, who);
1341 }
1342 
1343 /* 318 */
1344 void ratbox_cmd_318(char *source, char *who)
1345 {
1346  if (!source || !who) {
1347  return;
1348  }
1349 
1351  "318 %s %s :End of /WHOIS list.", source, who);
1352 }
1353 
1354 /* 242 */
1355 void ratbox_cmd_242(char *buf)
1356 {
1357  if (!buf) {
1358  return;
1359  }
1360 
1361  send_cmd(NULL, "242 %s", buf);
1362 }
1363 
1364 /* 243 */
1365 void ratbox_cmd_243(char *buf)
1366 {
1367  if (!buf) {
1368  return;
1369  }
1370 
1371  send_cmd(NULL, "243 %s", buf);
1372 }
1373 
1374 /* 211 */
1375 void ratbox_cmd_211(char *buf)
1376 {
1377  if (!buf) {
1378  return;
1379  }
1380 
1381  send_cmd(NULL, "211 %s", buf);
1382 }
1383 
1384 void ratbox_cmd_mode(char *source, char *dest, char *buf)
1385 {
1386  Uid *ud;
1387  if (!buf) {
1388  return;
1389  }
1390 
1391  if (source) {
1392  ud = find_uid(source);
1393  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "MODE %s %s",
1394  dest, buf);
1395  } else {
1396  send_cmd(source, "MODE %s %s", dest, buf);
1397  }
1398 }
1399 
1400 void ratbox_cmd_tmode(char *source, char *dest, const char *fmt, ...)
1401 {
1402  va_list args;
1403  char buf[BUFSIZE];
1404  *buf = '\0';
1405 
1406  if (fmt) {
1407  va_start(args, fmt);
1408  vsnprintf(buf, BUFSIZE - 1, fmt, args);
1409  va_end(args);
1410  }
1411  if (!*buf) {
1412  return;
1413  }
1414 
1415  send_cmd(NULL, "MODE %s %s", dest, buf);
1416 }
1417 
1418 void ratbox_cmd_nick(char *nick, char *name, char *mode)
1419 {
1420  EnforceQlinedNick(nick, NULL);
1421  if (UseTS6) {
1422  char *uidbuf = ts6_uid_retrieve();
1423  send_cmd(TS6SID, "UID %s 1 %ld %s %s %s 0 %s :%s", nick,
1424  (long int) time(NULL), mode, ServiceUser, ServiceHost,
1425  uidbuf, name);
1426  new_uid(nick, uidbuf);
1427  } else {
1428  send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s :%s", nick,
1429  (long int) time(NULL), mode, ServiceUser, ServiceHost,
1430  ServerName, name);
1431  }
1432  ratbox_cmd_sqline(nick, "Reserved for services");
1433 }
1434 
1435 void ratbox_cmd_kick(char *source, char *chan, char *user, char *buf)
1436 {
1437  Uid *ud;
1438  User *u;
1439 
1440  ud = find_uid(source);
1441  u = finduser(user);
1442 
1443  if (buf) {
1444  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source),
1445  "KICK %s %s :%s", chan,
1446  (UseTS6 ? (u ? u->uid : user) : user), buf);
1447  } else {
1448  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "KICK %s %s",
1449  chan, (UseTS6 ? (u ? u->uid : user) : user));
1450  }
1451 }
1452 
1453 void ratbox_cmd_notice_ops(char *source, char *dest, char *buf)
1454 {
1455  if (!buf) {
1456  return;
1457  }
1458 
1459  send_cmd(NULL, "NOTICE @%s :%s", dest, buf);
1460 }
1461 
1462 void ratbox_cmd_bot_chan_mode(char *nick, char *chan)
1463 {
1464  Uid *u;
1465 
1466  if (UseTS6) {
1467  u = find_uid(nick);
1468  ratbox_cmd_tmode(nick, chan, "%s %s", ircd->botchanumode,
1469  (u ? u->uid : nick));
1470  } else {
1471  /* Ratbox does not allow *any* client to op itself - use ChanServ */
1472  anope_cmd_mode(s_ChanServ, chan, "%s %s", ircd->botchanumode, nick);
1473  }
1474 }
1475 
1476 /* QUIT */
1477 void ratbox_cmd_quit(char *source, char *buf)
1478 {
1479  Uid *ud;
1480  ud = find_uid(source);
1481 
1482  if (buf) {
1483  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "QUIT :%s",
1484  buf);
1485  } else {
1486  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "QUIT");
1487  }
1488 }
1489 
1490 /* PONG */
1491 void ratbox_cmd_pong(char *servname, char *who)
1492 {
1493  if (UseTS6) {
1494  send_cmd(TS6SID, "PONG %s", who);
1495  } else {
1496  send_cmd(servname, "PONG %s", who);
1497  }
1498 }
1499 
1500 /* INVITE */
1501 void ratbox_cmd_invite(char *source, char *chan, char *nick)
1502 {
1503  Uid *ud;
1504  User *u;
1505 
1506  if (!source || !chan || !nick) {
1507  return;
1508  }
1509 
1510  ud = find_uid(source);
1511  u = finduser(nick);
1512 
1513  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "INVITE %s %s",
1514  (UseTS6 ? (u ? u->uid : nick) : nick), chan);
1515 }
1516 
1517 /* SQUIT */
1518 void ratbox_cmd_squit(char *servname, char *message)
1519 {
1520  if (!servname || !message) {
1521  return;
1522  }
1523 
1524  send_cmd(NULL, "SQUIT %s :%s", servname, message);
1525 }
1526 
1527 int anope_event_mode(char *source, int ac, char **av)
1528 {
1529  User *u, *u2;
1530 
1531  if (ac < 2) {
1532  return MOD_CONT;
1533  }
1534 
1535  if (*av[0] == '#' || *av[0] == '&') {
1536  do_cmode(source, ac, av);
1537  } else {
1538  if (UseTS6) {
1539  u = find_byuid(source);
1540  u2 = find_byuid(av[0]);
1541  av[0] = u2->nick;
1542  do_umode(u->nick, ac, av);
1543  } else {
1544  do_umode(source, ac, av);
1545  }
1546  }
1547  return MOD_CONT;
1548 }
1549 
1550 int anope_event_tmode(char *source, int ac, char **av)
1551 {
1552  if (*av[1] == '#' || *av[1] == '&') {
1553  do_cmode(source, ac, av);
1554  }
1555  return MOD_CONT;
1556 }
1557 
1558 void ratbox_cmd_351(char *source)
1559 {
1561  "351 %s Anope-%s %s :%s - %s (%s) -- %s", source, version_number,
1562  ServerName, ircd->name, version_flags, EncModule, version_build);
1563 
1564 }
1565 
1566 /* Event: PROTOCTL */
1567 int anope_event_capab(char *source, int ac, char **av)
1568 {
1569  int argvsize = 8;
1570  int argc;
1571  char **argv;
1572  char *str;
1573 
1574  if (ac < 1)
1575  return MOD_CONT;
1576 
1577  /* We get the params as one arg, we should split it for capab_parse */
1578  argv = scalloc(argvsize, sizeof(char *));
1579  argc = 0;
1580  while ((str = myStrGetToken(av[0], ' ', argc))) {
1581  if (argc == argvsize) {
1582  argvsize += 8;
1583  argv = srealloc(argv, argvsize * sizeof(char *));
1584  }
1585  argv[argc] = str;
1586  argc++;
1587  }
1588 
1589  capab_parse(argc, argv);
1590 
1591  /* Free our built ac/av */
1592  for (argvsize = 0; argvsize < argc; argvsize++) {
1593  free(argv[argvsize]);
1594  }
1595  free(argv);
1596 
1597  return MOD_CONT;
1598 }
1599 
1600 /* SVSHOLD - set */
1601 void ratbox_cmd_svshold(char *nick)
1602 {
1603  /* Not supported by this IRCD */
1604 }
1605 
1606 /* SVSHOLD - release */
1608 {
1609  /* Not Supported by this IRCD */
1610 }
1611 
1612 /* SVSNICK */
1613 void ratbox_cmd_svsnick(char *nick, char *newnick, time_t when)
1614 {
1615  /* not supported */
1616 }
1617 
1618 void ratbox_cmd_guest_nick(char *nick, char *user, char *host, char *real,
1619  char *modes)
1620 {
1621  /* not supported */
1622 }
1623 
1624 void ratbox_cmd_svso(char *source, char *nick, char *flag)
1625 {
1626  /* Not Supported by this IRCD */
1627 }
1628 
1629 void ratbox_cmd_unban(char *name, char *nick)
1630 {
1631  /* Not Supported by this IRCD */
1632 }
1633 
1634 /* SVSMODE channel modes */
1635 
1636 void ratbox_cmd_svsmode_chan(char *name, char *mode, char *nick)
1637 {
1638  /* Not Supported by this IRCD */
1639 }
1640 
1641 /* SVSMODE +d */
1642 /* sent if svid is something weird */
1643 void ratbox_cmd_svid_umode(char *nick, time_t ts)
1644 {
1645  /* not supported */
1646 }
1647 
1648 /* SVSMODE +d */
1649 /* nc_change was = 1, and there is no na->status */
1651 {
1652  /* not supported */
1653 }
1654 
1655 /* SVSMODE +d */
1656 void ratbox_cmd_svid_umode2(User * u, char *ts)
1657 {
1658  /* not supported */
1659 }
1660 
1661 void ratbox_cmd_svid_umode3(User * u, char *ts)
1662 {
1663  /* not used */
1664 }
1665 
1666 /* NICK <newnick> */
1667 void ratbox_cmd_chg_nick(char *oldnick, char *newnick)
1668 {
1669  Uid *ud;
1670 
1671  if (!oldnick || !newnick) {
1672  return;
1673  }
1674 
1675  ud = find_uid(oldnick);
1676  if (ud)
1677  strscpy(ud->nick, newnick, NICKMAX);
1678 
1679  send_cmd(oldnick, "NICK %s", newnick);
1680 }
1681 
1682 /*
1683  * SVINFO
1684  * parv[0] = sender prefix
1685  * parv[1] = TS_CURRENT for the server
1686  * parv[2] = TS_MIN for the server
1687  * parv[3] = server is standalone or connected to non-TS only
1688  * parv[4] = server's idea of UTC time
1689  */
1690 int anope_event_svinfo(char *source, int ac, char **av)
1691 {
1692  /* currently not used but removes the message : unknown message from server */
1693  return MOD_CONT;
1694 }
1695 
1696 int anope_event_pass(char *source, int ac, char **av)
1697 {
1698  if (UseTS6) {
1699  TS6UPLINK = sstrdup(av[3]);
1700  }
1701  return MOD_CONT;
1702 }
1703 
1704 void ratbox_cmd_svsjoin(char *source, char *nick, char *chan, char *param)
1705 {
1706  /* Not Supported by this IRCD */
1707 }
1708 
1709 void ratbox_cmd_svspart(char *source, char *nick, char *chan)
1710 {
1711  /* Not Supported by this IRCD */
1712 }
1713 
1714 void ratbox_cmd_swhois(char *source, char *who, char *mask)
1715 {
1716  /* not supported */
1717 }
1718 
1719 int anope_event_notice(char *source, int ac, char **av)
1720 {
1721  return MOD_CONT;
1722 }
1723 
1724 int anope_event_admin(char *source, int ac, char **av)
1725 {
1726  return MOD_CONT;
1727 }
1728 
1729 int anope_event_invite(char *source, int ac, char **av)
1730 {
1731  return MOD_CONT;
1732 }
1733 
1734 int anope_event_bmask(char *source, int ac, char **av)
1735 {
1736  Channel *c;
1737  char *bans;
1738  char *b;
1739  int count, i;
1740 
1741  /* :42X BMASK 1106409026 #ircops b :*!*@*.aol.com */
1742  /* 0 1 2 3 */
1743  c = findchan(av[1]);
1744 
1745  if (c) {
1746  bans = sstrdup(av[3]);
1747  count = myNumToken(bans, ' ');
1748  for (i = 0; i <= count - 1; i++) {
1749  b = myStrGetToken(bans, ' ', i);
1750  if (!stricmp(av[2], "b")) {
1751  add_ban(c, b);
1752  }
1753  if (!stricmp(av[2], "e")) {
1754  add_exception(c, b);
1755  }
1756  if (!stricmp(av[2], "I")) {
1757  add_invite(c, b);
1758  }
1759  if (b)
1760  free(b);
1761  }
1762  free(bans);
1763  }
1764  return MOD_CONT;
1765 }
1766 
1767 int ratbox_flood_mode_check(char *value)
1768 {
1769  return 0;
1770 }
1771 
1772 int anope_event_error(char *source, int ac, char **av)
1773 {
1774  if (ac >= 1) {
1775  if (debug) {
1776  alog("debug: %s", av[0]);
1777  }
1778  }
1779  return MOD_CONT;
1780 }
1781 
1782 void ratbox_cmd_jupe(char *jserver, char *who, char *reason)
1783 {
1784  char rbuf[256];
1785 
1786  snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who,
1787  reason ? ": " : "", reason ? reason : "");
1788 
1789  if (findserver(servlist, jserver))
1790  ratbox_cmd_squit(jserver, rbuf);
1791  ratbox_cmd_server(jserver, 2, rbuf);
1792  new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL);
1793 }
1794 
1795 /*
1796  1 = valid nick
1797  0 = nick is in valid
1798 */
1799 int ratbox_valid_nick(char *nick)
1800 {
1801  /* TS6 Save extension -Certus */
1802  if (isdigit(*nick))
1803  return 0;
1804  return 1;
1805 }
1806 
1807 /*
1808  1 = valid chan
1809  0 = chan is in valid
1810 */
1811 int ratbox_valid_chan(char *chan)
1812 {
1813  /* no hard coded invalid chans */
1814  return 1;
1815 }
1816 
1817 
1818 void ratbox_cmd_ctcp(char *source, char *dest, char *buf)
1819 {
1820  char *s;
1821 
1822  if (!buf) {
1823  return;
1824  } else {
1825  s = normalizeBuffer(buf);
1826  }
1827 
1828  send_cmd(source, "NOTICE %s :\1%s \1", dest, s);
1829  free(s);
1830 }
1831 
1832 
1838 {
1914 }
1915 
1919 int AnopeInit(int argc, char **argv)
1920 {
1921  EvtHook *hk;
1922 
1923  moduleAddAuthor("Anope");
1924  moduleAddVersion(VERSION_STRING);
1926 
1927  pmodule_ircd_version("Ratbox IRCD 2.0+");
1928  pmodule_ircd_cap(myIrcdcap);
1929  pmodule_ircd_var(myIrcd);
1930  pmodule_ircd_cbmodeinfos(myCbmodeinfos);
1931  pmodule_ircd_cumodes(myCumodes);
1934  pmodule_ircd_cbmodes(myCbmodes);
1935  pmodule_ircd_cmmodes(myCmmodes);
1938 
1948 
1951 
1953  moduleAddEventHook(hk);
1954 
1956  moduleAddEventHook(hk);
1957 
1959  moduleAddEventHook(hk);
1960 
1961  return MOD_CONT;
1962 }
E void pmodule_cmd_vhost_off(void(*func)(User *u))
Definition: ircd.c:713
void ratbox_cmd_372(char *source, char *msg)
Definition: ratbox.c:1235
E void pmodule_permchan_mode(int mode)
Definition: ircd.c:1206
int AnopeInit(int argc, char **argv)
Definition: ratbox.c:1919
E Uid * find_uid(const char *nick)
Definition: users.c:453
int anope_event_sjoin(char *source, int ac, char **av)
Definition: ratbox.c:567
int anope_event_whois(char *source, int ac, char **av)
Definition: ratbox.c:1144
E int32 opcnt
Definition: extern.h:1140
E char * RemotePassword3
Definition: extern.h:270
void ratbox_cmd_jupe(char *jserver, char *who, char *reason)
Definition: ratbox.c:1782
E void pmodule_cmd_svspart(void(*func)(char *source, char *nick, char *chan))
Definition: ircd.c:1056
E void do_topic(const char *source, int ac, char **av)
Definition: channels.c:1249
void ratbox_cmd_join(char *user, char *channel, time_t chantime)
Definition: ratbox.c:871
#define EVENT_NICK_REGISTERED
Definition: events.h:43
#define EVENT_NICK_IDENTIFY
Definition: events.h:55
E void do_server(const char *source, char *servername, char *hops, char *descript, char *numeric)
Definition: servers.c:360
E void pmodule_cmd_notice2(void(*func)(char *source, char *dest, char *msg))
Definition: ircd.c:798
void ratbox_cmd_svid_umode3(User *u, char *ts)
Definition: ratbox.c:1661
E char * RemotePassword
Definition: extern.h:264
#define CAPAB_UID
Definition: services.h:1381
int anope_event_squit(char *source, int ac, char **av)
Definition: ratbox.c:1213
int anope_event_ping(char *source, int ac, char **av)
Definition: ratbox.c:1042
void ratbox_cmd_serv_notice(char *source, char *dest, char *msg)
Definition: ratbox.c:503
E void pmodule_cmd_bot_chan_mode(void(*func)(char *nick, char *chan))
Definition: ircd.c:827
void ratbox_cmd_tmode(char *source, char *dest, const char *fmt,...)
Definition: ratbox.c:1400
void ratbox_cmd_notice2(char *source, char *dest, char *msg)
Definition: ratbox.c:467
int anope_event_436(char *source, int ac, char **av)
Definition: ratbox.c:722
char nick[NICKMAX]
Definition: services.h:875
E void do_squit(const char *source, int ac, char **av)
Definition: servers.c:398
E int snprintf(char *buf, size_t size, const char *fmt,...)
Definition: compat.c:37
void ratbox_cmd_invite(char *source, char *chan, char *nick)
Definition: ratbox.c:1501
E int anope_event_null(char *source, int ac, char **av)
Definition: messages.c:441
E void pmodule_cmd_351(void(*func)(char *source))
Definition: ircd.c:832
void ratbox_cmd_sqline(char *mask, char *reason)
Definition: ratbox.c:786
MDE void updateProtectDetails(char *level_info_protect_word, char *level_info_protectme_word, char *fant_protect_add, char *fant_protect_del, char *level_protect_word, char *protect_set_mode, char *protect_unset_mode)
Definition: modules.c:2512
E char * TS6UPLINK
Definition: extern.h:1159
#define UMODE_w
Definition: bahamut.h:21
#define CBM_MINUS_NO_ARG
Definition: services.h:928
void ratbox_cmd_swhois(char *source, char *who, char *mask)
Definition: ratbox.c:1714
E IRCDVar * ircd
Definition: extern.h:39
unsigned long umodes[128]
Definition: ratbox.c:196
void ratbox_cmd_svsinfo()
Definition: ratbox.c:938
void ratbox_cmd_guest_nick(char *nick, char *user, char *host, char *real, char *modes)
Definition: ratbox.c:1618
void ratbox_cmd_privmsg(char *source, char *dest, char *buf)
Definition: ratbox.c:478
void ratbox_cmd_remove_akill(char *user, char *host)
Definition: ratbox.c:833
E void pmodule_cmd_nick(void(*func)(char *nick, char *name, char *modes))
Definition: ircd.c:756
E void chan_set_key(Channel *chan, char *value)
Definition: channels.c:1998
int anope_event_error(char *source, int ac, char **av)
Definition: ratbox.c:1772
E void pmodule_ircd_cmmodes(CMMode modes[128])
Definition: ircd.c:1143
void ratbox_cmd_pong(char *servname, char *who)
Definition: ratbox.c:1491
E void do_kick(const char *source, int ac, char **av)
Definition: channels.c:638
E void pmodule_cmd_372_error(void(*func)(char *source))
Definition: ircd.c:741
#define CMODE_p
Definition: bahamut.h:47
MDE int addCoreMessage(MessageHash *msgTable[], Message *m)
Definition: modules.c:1597
void ratbox_cmd_szline(char *mask, char *reason, char *whom)
Definition: ratbox.c:809
E void pmodule_valid_nick(int(*func)(char *nick))
Definition: ircd.c:1082
void ratbox_cmd_svsadmin(char *server, int set)
Definition: ratbox.c:819
E void cs_set_limit(ChannelInfo *ci, char *value)
Definition: chanserv.c:2558
int ratbox_valid_chan(char *chan)
Definition: ratbox.c:1811
E int nick_identified(User *u)
Definition: nickserv.c:1111
IRCDVar myIrcd[]
Definition: ratbox.c:19
CBModeInfo myCbmodeinfos[]
Definition: ratbox.c:385
int anope_event_kill(char *source, int ac, char **av)
Definition: ratbox.c:1063
void ratbox_cmd_chg_nick(char *oldnick, char *newnick)
Definition: ratbox.c:1667
E void pmodule_cmd_kick(void(*func)(char *source, char *chan, char *user, char *buf))
Definition: ircd.c:780
E void send_cmd(const char *source, const char *fmt,...) FORMAT(printf
void ratbox_cmd_243(char *buf)
Definition: ratbox.c:1365
E void send_event(const char *name, int argc,...)
Definition: events.c:37
E void pmodule_cmd_vhost_on(void(*func)(char *nick, char *vIdent, char *vhost))
Definition: ircd.c:966
E void pmodule_cmd_svsjoin(void(*func)(char *source, char *nick, char *chan, char *param))
Definition: ircd.c:1048
E void pmodule_cmd_swhois(void(*func)(char *source, char *who, char *mask))
Definition: ircd.c:1061
E void pmodule_cmd_pong(void(*func)(char *servname, char *who))
Definition: ircd.c:842
E void pmodule_cmd_307(void(*func)(char *buf))
Definition: ircd.c:879
E char * get_limit(Channel *chan)
Definition: channels.c:1881
E void pmodule_cmd_211(void(*func)(char *buf))
Definition: ircd.c:924
E int NSNickTracking
Definition: extern.h:399
void ratbox_cmd_eob()
Definition: ratbox.c:1088
int anope_event_tburst(char *source, int ac, char **av)
Definition: ratbox.c:675
int anope_event_server(char *source, int ac, char **av)
Definition: ratbox.c:1156
E void pmodule_cmd_unsqline(void(*func)(char *user))
Definition: ircd.c:853
int ratbox_flood_mode_check(char *value)
Definition: ratbox.c:1767
E void pmodule_cmd_sgline(void(*func)(char *mask, char *reason))
Definition: ircd.c:1007
E int stricmp(const char *s1, const char *s2)
Definition: compat.c:58
void ratbox_cmd_376(char *source)
Definition: ratbox.c:1253
E void pmodule_set_umode(void(*func)(User *user, int ac, char **av))
Definition: ircd.c:1077
E void pmodule_ircd_cap(IRCDCAPAB *cap)
Definition: ircd.c:1102
int anope_event_nick(char *source, int ac, char **av)
Definition: ratbox.c:597
#define CMODE_l
Definition: bahamut.h:51
int anope_event_away(char *source, int ac, char **av)
Definition: ratbox.c:1050
char * name
Definition: services.h:277
void ratbox_cmd_bot_chan_mode(char *nick, char *chan)
Definition: ratbox.c:1462
E void pmodule_cmd_nc_change(void(*func)(User *u))
Definition: ircd.c:1028
E void pmodule_cmd_372(void(*func)(char *source, char *msg))
Definition: ircd.c:736
void ratbox_cmd_svsmode(User *u, int ac, char **av)
Definition: ratbox.c:919
void moduleAddAnopeCmds()
Definition: ratbox.c:1837
void ratbox_cmd_svspart(char *source, char *nick, char *chan)
Definition: ratbox.c:1709
E char * ServerDesc
Definition: extern.h:275
E void pmodule_cmd_bob(void(*func)())
Definition: ircd.c:976
E void pmodule_ircd_flood_mode_char_remove(char *mode)
Definition: ircd.c:1130
int anope_event_encap(char *source, int ac, char **av)
Definition: ratbox.c:1171
void ratbox_cmd_release_svshold(char *nick)
Definition: ratbox.c:1607
E void del_invite(Channel *chan, char *mask)
Definition: channels.c:1833
E User * find_byuid(const char *uid)
Definition: users.c:378
E void pmodule_cmd_ctcp(void(*func)(char *source, char *dest, char *buf))
Definition: ircd.c:1043
char topic_setter[NICKMAX]
Definition: services.h:1004
E void pmodule_cmd_invite(void(*func)(char *source, char *chan, char *nick))
Definition: ircd.c:859
char * host
Definition: services.h:878
E void pmodule_ircd_var(IRCDVar *ircdvar)
Definition: ircd.c:1097
E void do_umode(const char *source, int ac, char **av)
Definition: users.c:816
#define UMODE_l
Definition: charybdis.h:24
void ratbox_cmd_svsnoop(char *server, int set)
Definition: ratbox.c:814
MDE Message * createMessage(const char *name, int(*func)(char *source, int ac, char **av))
Definition: modules.c:1470
void ratbox_cmd_privmsg2(char *source, char *dest, char *msg)
Definition: ratbox.c:492
E Uid * find_nickuid(const char *uid)
Definition: users.c:468
E void add_invite(Channel *chan, char *mask)
Definition: channels.c:1402
#define CUS_VOICE
Definition: services.h:1342
#define IRCD
Definition: modules.h:63
#define UMODE_g
Definition: bahamut.h:35
#define UMODE_i
Definition: bahamut.h:18
void ratbox_cmd_kick(char *source, char *chan, char *user, char *buf)
Definition: ratbox.c:1435
E void pmodule_cmd_svsnoop(void(*func)(char *server, int set))
Definition: ircd.c:696
void ratbox_cmd_ctcp(char *source, char *dest, char *buf)
Definition: ratbox.c:1818
E void pmodule_cmd_squit(void(*func)(char *servname, char *message))
Definition: ircd.c:944
#define CMODE_n
Definition: bahamut.h:46
E void check_memos(User *u)
Definition: memoserv.c:86
E char * strscpy(char *d, const char *s, size_t len)
Definition: db-merger.c:1886
E void pmodule_cmd_unsgline(void(*func)(char *mask))
Definition: ircd.c:991
void ratbox_cmd_unszline(char *mask)
Definition: ratbox.c:804
int anope_event_join(char *source, int ac, char **av)
Definition: ratbox.c:1093
char * uid
Definition: services.h:419
MDE void moduleAddAuthor(const char *author)
Definition: modules.c:1772
E void EnforceQlinedNick(char *nick, char *killer)
Definition: misc.c:837
void ratbox_cmd_svsnick(char *nick, char *newnick, time_t when)
Definition: ratbox.c:1613
#define CMODE_t
Definition: bahamut.h:49
void ratbox_cmd_svid_umode2(User *u, char *ts)
Definition: ratbox.c:1656
E char * cs_get_key(ChannelInfo *ci)
Definition: chanserv.c:2447
MDE void moduleSetType(MODType type)
Definition: modules.c:818
int ratbox_logout(int argc, char **argv)
Definition: ratbox.c:560
E void pmodule_cmd_jupe(void(*func)(char *jserver, char *who, char *reason))
Definition: ircd.c:1072
char * botchanumode
Definition: services.h:299
void ratbox_cmd_375(char *source)
Definition: ratbox.c:1247
E void pmodule_cmd_243(void(*func)(char *buf))
Definition: ircd.c:919
void ratbox_set_umode(User *user, int ac, char **av)
Definition: ratbox.c:151
E Channel * findchan(const char *chan)
Definition: channels.c:394
E void do_sjoin(const char *source, int ac, char **av)
Definition: channels.c:803
E void anope_set_umode(User *user, int ac, char **av)
Definition: ircd.c:130
E char * sstrdup(const char *s)
Definition: memory.c:105
E void do_join(const char *source, int ac, char **av)
Definition: channels.c:556
void ratbox_cmd_312(char *buf)
Definition: ratbox.c:1299
E void * scalloc(long elsize, long els)
Definition: memory.c:55
E Uid * new_uid(const char *nick, char *uid)
Definition: users.c:435
char * uid
Definition: services.h:890
E int m_nickcoll(char *user)
Definition: messages.c:20
E void pmodule_cmd_375(void(*func)(char *source))
Definition: ircd.c:746
E void pmodule_key_mode(int mode)
Definition: ircd.c:1196
E void pmodule_cmd_svsnick(void(*func)(char *source, char *guest, time_t when))
Definition: ircd.c:960
void ratbox_cmd_global_legacy(char *source, char *fmt)
Definition: ratbox.c:535
E char * s_OperServ
Definition: extern.h:289
void ratbox_cmd_372_error(char *source)
Definition: ratbox.c:1240
E void pmodule_invis_umode(int mode)
Definition: ircd.c:1171
E void pmodule_cmd_svid_umode2(void(*func)(User *u, char *ts))
Definition: ircd.c:1033
E void pmodule_cmd_chg_nick(void(*func)(char *oldnick, char *newnick))
Definition: ircd.c:954
void ratbox_cmd_unban(char *name, char *nick)
Definition: ratbox.c:1629
void ratbox_cmd_vhost_on(char *nick, char *vIdent, char *vhost)
Definition: ratbox.c:857
E char * ServiceHost
Definition: extern.h:277
#define UMODE_x
Definition: bahamut.h:23
#define UMODE_b
Definition: bahamut.h:36
E void record_topic(const char *chan)
Definition: chanserv.c:1645
E char * EncModule
Definition: extern.h:580
void ratbox_cmd_global(char *source, char *buf)
Definition: ratbox.c:514
void ratbox_cmd_svskill(char *source, char *user, char *buf)
Definition: ratbox.c:901
E void pmodule_invite_cmode(int mode)
Definition: ircd.c:1181
E int myNumToken(const char *str, const char dilim)
Definition: misc.c:1112
E void pmodule_cmd_eob(void(*func)())
Definition: ircd.c:1066
void ratbox_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes)
Definition: ratbox.c:1011
E void pmodule_cmd_svid_umode3(void(*func)(User *u, char *ts))
Definition: ircd.c:1038
E void pmodule_cmd_376(void(*func)(char *source))
Definition: ircd.c:751
void ratbox_cmd_server(char *servname, int hop, char *descript)
Definition: ratbox.c:979
void ratbox_cmd_quit(char *source, char *buf)
Definition: ratbox.c:1477
E char * uplink
Definition: extern.h:35
E char * ts6_uid_retrieve(void)
Definition: servers.c:617
E User * finduser(const char *nick)
Definition: users.c:323
void ratbox_cmd_307(char *buf)
Definition: ratbox.c:1279
E int m_kill(char *nick, char *msg)
Definition: messages.c:49
int anope_event_admin(char *source, int ac, char **av)
Definition: ratbox.c:1724
E void pmodule_cmd_part(void(*func)(char *nick, char *chan, char *buf))
Definition: ircd.c:864
E int m_away(char *source, char *msg)
Definition: messages.c:29
uint16 status
Definition: services.h:532
IRCDCAPAB myIrcdcap[]
Definition: ratbox.c:118
MDE void moduleAddVersion(const char *version)
Definition: modules.c:1760
#define UMODE_a
Definition: bahamut.h:16
int anope_event_kick(char *source, int ac, char **av)
Definition: ratbox.c:1080
E void add_ban(Channel *chan, char *mask)
Definition: channels.c:1338
E void do_part(const char *source, int ac, char **av)
Definition: channels.c:710
E void del_ban(Channel *chan, char *mask)
Definition: channels.c:1779
void ratbox_cmd_351(char *source)
Definition: ratbox.c:1558
char * name
Definition: services.h:854
E char * merge_args(int argc, char **argv)
Definition: misc.c:180
#define CAPAB_QS
Definition: services.h:1378
void ratbox_cmd_notice(char *source, char *dest, char *buf)
Definition: ratbox.c:447
E void pmodule_ircd_cumodes(CUMode modes[128])
Definition: ircd.c:1117
MDE EvtHook * createEventHook(char *name, int(*func)(int argc, char **argv))
Definition: events.c:305
E const char version_flags[]
Definition: extern.h:771
int ratbox_valid_nick(char *nick)
Definition: ratbox.c:1799
Command * c
Definition: ns_recover.c:17
void ratbox_cmd_317(char *buf)
Definition: ratbox.c:1309
int anope_event_svinfo(char *source, int ac, char **av)
Definition: ratbox.c:1690
E char * TS6SID
Definition: extern.h:1158
E void alog(const char *fmt,...) FORMAT(printf
E int servernum
Definition: extern.h:615
#define UMODE_u
Definition: hybrid.h:27
int anope_event_mode(char *source, int ac, char **av)
Definition: ratbox.c:1527
void ratbox_cmd_401(char *source, char *who)
Definition: ratbox.c:1334
#define MOD_CONT
Definition: modules.h:54
E int UseTS6
Definition: extern.h:364
E int m_motd(char *source)
Definition: messages.c:97
E void pmodule_cmd_svsmode(void(*func)(User *u, int ac, char **av))
Definition: ircd.c:731
E void do_quit(const char *source, int ac, char **av)
Definition: users.c:854
E void pmodule_cmd_bot_nick(void(*func)(char *nick, char *user, char *host, char *real, char *modes))
Definition: ircd.c:773
E void pmodule_private_cmode(int mode)
Definition: ircd.c:1191
void ratbox_cmd_akill(char *user, char *host, char *who, time_t when, time_t expires, char *reason)
Definition: ratbox.c:889
E void display_news(User *u, int16 type)
Definition: news.c:269
void ratbox_cmd_notice_ops(char *source, char *dest, char *buf)
Definition: ratbox.c:1453
void ratbox_cmd_topic(char *whosets, char *chan, char *whosetit, char *topic, time_t when)
Definition: ratbox.c:842
CMMode myCmmodes[128]
Definition: ratbox.c:269
void ratbox_cmd_250(char *buf)
Definition: ratbox.c:1269
void ratbox_cmd_squit(char *servname, char *message)
Definition: ratbox.c:1518
E Server * findserver(Server *s, const char *name)
Definition: servers.c:261
E void pmodule_cmd_svid_umode(void(*func)(char *nick, time_t ts))
Definition: ircd.c:1023
E int m_privmsg(char *source, char *receiver, char *msg)
Definition: messages.c:130
E void pmodule_ircd_csmodes(char mode[128])
Definition: ircd.c:1151
void ratbox_cmd_242(char *buf)
Definition: ratbox.c:1355
E void pmodule_cmd_242(void(*func)(char *buf))
Definition: ircd.c:914
#define NI_MSG
Definition: services.h:1292
char nick[NICKMAX]
Definition: services.h:418
E int debug
Definition: extern.h:775
void ratbox_cmd_connect(int servernum)
Definition: ratbox.c:984
#define EVENT_TOPIC_UPDATED
Definition: events.h:30
E void set_limit(Channel *chan, char *value)
Definition: channels.c:2011
void ratbox_cmd_211(char *buf)
Definition: ratbox.c:1375
E void pmodule_cmd_311(void(*func)(char *buf))
Definition: ircd.c:884
E void pmodule_cmd_join(void(*func)(char *user, char *channel, time_t chantime))
Definition: ircd.c:848
E int NSDefFlags
Definition: extern.h:377
E void del_exception(Channel *chan, char *mask)
Definition: channels.c:1808
E void pmodule_cmd_318(void(*func)(char *source, char *who))
Definition: ircd.c:909
E void pmodule_cmd_250(void(*func)(char *buf))
Definition: ircd.c:874
char * username
Definition: services.h:877
int anope_event_pass(char *source, int ac, char **av)
Definition: ratbox.c:1696
void ratbox_cmd_unsqline(char *user)
Definition: ratbox.c:862
char * topic
Definition: services.h:1003
void ratbox_cmd_sgline(char *mask, char *reason)
Definition: ratbox.c:824
E void pmodule_ircd_version(char *version)
Definition: ircd.c:1107
int anope_event_invite(char *source, int ac, char **av)
Definition: ratbox.c:1729
void ratbox_cmd_pass(char *pass)
Definition: ratbox.c:969
E const char version_number[]
Definition: extern.h:767
int anope_event_bmask(char *source, int ac, char **av)
Definition: ratbox.c:1734
#define CMODE_m
Definition: bahamut.h:45
E void pmodule_cmd_unszline(void(*func)(char *mask))
Definition: ircd.c:996
E int check_topiclock(Channel *c, time_t topic_time)
Definition: chanserv.c:1721
E void cs_set_key(ChannelInfo *ci, char *value)
Definition: chanserv.c:2538
E void anope_cmd_mode(char *source, char *dest, const char *fmt,...)
Definition: ircd.c:211
E void pmodule_cmd_401(void(*func)(char *source, char *who))
Definition: ircd.c:904
int anope_event_tmode(char *source, int ac, char **av)
Definition: ratbox.c:1550
E int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
E int WallOper
Definition: extern.h:448
E void pmodule_cmd_svso(void(*func)(char *source, char *nick, char *flag))
Definition: ircd.c:949
void ratbox_cmd_serv_privmsg(char *source, char *dest, char *msg)
Definition: ratbox.c:508
E void pmodule_cmd_serv_privmsg(void(*func)(char *source, char *dest, char *msg))
Definition: ircd.c:821
E void pmodule_cmd_317(void(*func)(char *buf))
Definition: ircd.c:894
E void do_cmode(const char *source, int ac, char **av)
Definition: channels.c:1183
E void pmodule_secret_cmode(int mode)
Definition: ircd.c:1186
E void pmodule_cmd_391(void(*func)(char *source, char *timestr))
Definition: ircd.c:869
#define NICKMAX
Definition: config.h:62
E void pmodule_cmd_remove_akill(void(*func)(char *user, char *host))
Definition: ircd.c:701
E void pmodule_ircd_cbmodes(CBMode modes[128])
Definition: ircd.c:1135
#define SERVER_JUPED
Definition: services.h:866
int anope_event_motd(char *source, int ac, char **av)
Definition: ratbox.c:1104
time_t topic_time
Definition: services.h:1005
void ratbox_cmd_318(char *source, char *who)
Definition: ratbox.c:1344
void ratbox_cmd_nc_change(User *u)
Definition: ratbox.c:1650
void moduleAddIRCDMsgs(void)
Definition: ratbox.c:733
E void pmodule_cmd_szline(void(*func)(char *mask, char *reason, char *whom))
Definition: ircd.c:1002
E char * myStrGetToken(const char *str, const char dilim, int token_number)
Definition: misc.c:654
#define NS_IDENTIFIED
Definition: services.h:1275
E void pmodule_cmd_notice_ops(void(*func)(char *source, char *dest, char *buf))
Definition: ircd.c:787
E void pmodule_cmd_release_svshold(void(*func)(char *nick))
Definition: ircd.c:986
void ratbox_cmd_svinfo()
Definition: ratbox.c:933
E void add_exception(Channel *chan, char *mask)
Definition: channels.c:1377
#define CAPAB_TS5
Definition: services.h:1374
int anope_event_topic(char *source, int ac, char **av)
Definition: ratbox.c:625
int anope_event_notice(char *source, int ac, char **av)
Definition: ratbox.c:1719
#define CMODE_k
Definition: bahamut.h:50
E Server * findserver_uid(Server *s, const char *name)
Definition: servers.c:298
E void * srealloc(void *oldptr, long newsize)
Definition: memory.c:80
void ratbox_cmd_part(char *nick, char *chan, char *buf)
Definition: ratbox.c:1029
void ratbox_cmd_219(char *source, char *letter)
Definition: ratbox.c:1319
int ratbox_login(int argc, char **argv)
Definition: ratbox.c:553
E void pmodule_cmd_unban(void(*func)(char *name, char *nick))
Definition: ircd.c:1012
E void pmodule_cmd_notice(void(*func)(char *source, char *dest, char *buf))
Definition: ircd.c:792
void ratbox_cmd_svso(char *source, char *nick, char *flag)
Definition: ratbox.c:1624
E Server * servlist
Definition: extern.h:1051
void ratbox_cmd_311(char *buf)
Definition: ratbox.c:1289
Definition: services.h:416
void ratbox_cmd_391(char *source, char *timestr)
Definition: ratbox.c:1260
#define DEFAULT_MLOCK
Definition: bahamut.h:59
E void pmodule_cmd_akill(void(*func)(char *user, char *host, char *who, time_t when, time_t expires, char *reason))
Definition: ircd.c:718
E void capab_parse(int ac, char **av)
Definition: servers.c:451
E int check_valid_op(User *user, Channel *chan, int servermode)
Definition: chanserv.c:1290
E char * cs_get_limit(ChannelInfo *ci)
Definition: chanserv.c:2458
void ratbox_cmd_mode(char *source, char *dest, char *buf)
Definition: ratbox.c:1384
#define UMODE_n
Definition: bahamut.h:37
uint32 mode
Definition: services.h:889
E void pmodule_cmd_guest_nick(void(*func)(char *nick, char *user, char *host, char *real, char *modes))
Definition: ircd.c:761
E void * smalloc(long size)
Definition: memory.c:30
E char * ServerName
Definition: extern.h:274
void ratbox_cmd_svsjoin(char *source, char *nick, char *chan, char *param)
Definition: ratbox.c:1704
char myCsmodes[128]
Definition: ratbox.c:248
void ratbox_cmd_svsmode_chan(char *name, char *mode, char *nick)
Definition: ratbox.c:1636
time_t last_seen
Definition: services.h:531
E void pmodule_valid_chan(int(*func)(char *chan))
Definition: ircd.c:1087
E void pmodule_cmd_privmsg(void(*func)(char *source, char *dest, char *buf))
Definition: ircd.c:804
E char * s_ChanServ
Definition: extern.h:285
E void pmodule_cmd_svshold(void(*func)(char *nick))
Definition: ircd.c:981
CBMode myCbmodes[128]
Definition: ratbox.c:319
#define SERVER_ISME
Definition: services.h:865
E void pmodule_cmd_serv_notice(void(*func)(char *source, char *dest, char *msg))
Definition: ircd.c:816
E char * s_NickServ
Definition: extern.h:284
E char * get_key(Channel *chan)
Definition: channels.c:1874
E int m_whois(char *source, char *who)
Definition: messages.c:366
E char * RemotePassword2
Definition: extern.h:267
E void pmodule_cmd_topic(void(*func)(char *whosets, char *chan, char *whosetit, char *topic, time_t when))
Definition: ircd.c:706
E void pmodule_cmd_quit(void(*func)(char *source, char *buf))
Definition: ircd.c:837
E char * ServiceUser
Definition: extern.h:276
E Server * me_server
Definition: extern.h:1052
void ratbox_cmd_vhost_off(User *u)
Definition: ratbox.c:852
char * last_usermask
Definition: services.h:529
E void pmodule_ircd_useTSMode(int use)
Definition: ircd.c:1164
void ratbox_cmd_nick(char *nick, char *name, char *mode)
Definition: ratbox.c:1418
E void pmodule_oper_umode(int mode)
Definition: ircd.c:1176
E Server * new_server(Server *uplink, const char *name, const char *desc, uint16 flags, char *suid)
Definition: servers.c:119
int anope_event_privmsg(char *source, int ac, char **av)
Definition: ratbox.c:1114
E void pmodule_flood_mode_check(int(*func)(char *value))
Definition: ircd.c:1092
#define NEWS_OPER
Definition: services.h:1050
E void pmodule_ircd_cbmodeinfos(CBModeInfo *modeinfos)
Definition: ircd.c:1112
#define EVENT_NICK_LOGOUT
Definition: events.h:67
void ratbox_cmd_unsgline(char *mask)
Definition: ratbox.c:795
E void pmodule_cmd_sqline(void(*func)(char *mask, char *reason))
Definition: ircd.c:939
E void pmodule_cmd_privmsg2(void(*func)(char *source, char *dest, char *msg))
Definition: ircd.c:810
E User * do_nick(const char *source, char *nick, char *username, char *host, char *server, char *realname, time_t ts, uint32 svid, uint32 ip, char *vhost, char *uid)
Definition: users.c:500
E void pmodule_cmd_connect(void(*func)(int servernum))
Definition: ircd.c:971
E void pmodule_cmd_global_legacy(void(*func)(char *source, char *fmt))
Definition: ircd.c:934
void ratbox_cmd_capab()
Definition: ratbox.c:962
E void pmodule_cmd_mode(void(*func)(char *source, char *dest, char *buf))
Definition: ircd.c:768
E char * common_get_vhost(User *u)
Definition: actions.c:251
#define CAPAB_ZIP
Definition: services.h:1371
E void pmodule_limit_mode(int mode)
Definition: ircd.c:1201
#define CMODE_i
Definition: bahamut.h:44
E int UseTSMODE
Definition: extern.h:43
E char * Numeric
Definition: extern.h:362
E void pmodule_cmd_svskill(void(*func)(char *source, char *user, char *buf))
Definition: ircd.c:726
E void pmodule_cmd_svsmode_chan(void(*func)(char *name, char *mode, char *nick))
Definition: ircd.c:1018
int anope_event_sid(char *source, int ac, char **av)
Definition: ratbox.c:1201
E void pmodule_ircd_flood_mode_char_set(char *mode)
Definition: ircd.c:1125
int anope_event_part(char *source, int ac, char **av)
Definition: ratbox.c:1130
#define BUFSIZE
Definition: config.h:47
MDE int moduleAddEventHook(EvtHook *evh)
Definition: events.c:528
E void pmodule_cmd_312(void(*func)(char *buf))
Definition: ircd.c:889
E const char version_build[]
Definition: extern.h:769
int anope_event_quit(char *source, int ac, char **av)
Definition: ratbox.c:1221
int anope_event_capab(char *source, int ac, char **av)
Definition: ratbox.c:1567
#define CMODE_s
Definition: bahamut.h:48
#define CUS_OP
Definition: services.h:1341
E char * normalizeBuffer(char *)
Definition: botserv.c:1101
E char * common_get_vident(User *u)
Definition: actions.c:272
CUMode myCumodes[128]
Definition: ratbox.c:398
void ratbox_cmd_bob()
Definition: ratbox.c:1006
NickAlias * na
Definition: services.h:892
E void anope_cmd_global(char *source, const char *fmt,...)
Definition: ircd.c:506
E void pmodule_cmd_global(void(*func)(char *source, char *buf))
Definition: ircd.c:929
#define UMODE_d
Definition: bahamut.h:34
#define CUF_PROTECT_BOTSERV
Definition: services.h:956
E void nsStartNickTracking(User *u)
Definition: nickserv.c:1962
void ratbox_cmd_svshold(char *nick)
Definition: ratbox.c:1601
void ratbox_cmd_svid_umode(char *nick, time_t ts)
Definition: ratbox.c:1643
#define UMODE_o
Definition: bahamut.h:19
E void pmodule_cmd_219(void(*func)(char *source, char *letter))
Definition: ircd.c:899
#define CAPAB_KNOCK
Definition: services.h:1382