Anope IRC Services  Version 1.8
charybdis.c
Go to the documentation of this file.
1 /* Charybdis IRCD functions
2  *
3  * (C) 2006 William Pitcock <nenolod -at- charybdis.be>
4  * (C) 2003-2014 Anope Team
5  * Contact us at team@anope.org
6  *
7  * Please read COPYING and README for further details.
8  *
9  * Based on the original code of Epona by Lara.
10  * Based on the original code of Services by Andy Church.
11  */
12 
13 #include "services.h"
14 #include "pseudo.h"
15 #include "charybdis.h"
16 #include "version.h"
17 
19  {"Charybdis 1.0+", /* ircd name */
20  "+oiS", /* nickserv mode */
21  "+oiS", /* chanserv mode */
22  "+oiS", /* memoserv mode */
23  "+oiS", /* hostserv mode */
24  "+oaiS", /* operserv mode */
25  "+oiS", /* botserv mode */
26  "+oiS", /* helpserv mode */
27  "+oiS", /* Dev/Null mode */
28  "+oiS", /* Global mode */
29  "+oiS", /* nickserv alias mode */
30  "+oiS", /* chanserv alias mode */
31  "+oiS", /* memoserv alias mode */
32  "+oiS", /* hostserv alias mode */
33  "+oaiS", /* operserv alias mode */
34  "+oiS", /* botserv alias mode */
35  "+oiS", /* helpserv alias mode */
36  "+oiS", /* Dev/Null alias mode */
37  "+oiS", /* Global alias mode */
38  "+oiS", /* Used by BotServ Bots */
39  2, /* Chan Max Symbols */
40  "-cijlmnpstrgzQF", /* Modes to Remove */
41  "+o", /* Channel Umode used by Botserv bots */
42  1, /* SVSNICK */
43  1, /* Vhost */
44  0, /* Has Owner */
45  NULL, /* Mode to set for an owner */
46  NULL, /* Mode to unset for an owner */
47  NULL, /* Mode to set for chan admin */
48  NULL, /* Mode to unset for chan admin */
49  NULL, /* Mode On Reg */
50  NULL, /* Mode on ID for Roots */
51  NULL, /* Mode on ID for Admins */
52  NULL, /* Mode on ID for Opers */
53  NULL, /* Mode on UnReg */
54  NULL, /* Mode on Nick Change */
55  1, /* Supports SGlines */
56  1, /* Supports SQlines */
57  1, /* Supports SZlines */
58  0, /* Supports Halfop +h */
59  3, /* Number of server args */
60  1, /* Join 2 Set */
61  1, /* Join 2 Message */
62  1, /* Has exceptions +e */
63  0, /* TS Topic Forward */
64  0, /* TS Topci Backward */
65  0, /* Protected Umode */
66  0, /* Has Admin */
67  1, /* Chan SQlines */
68  0, /* Quit on Kill */
69  0, /* SVSMODE unban */
70  0, /* Has Protect */
71  0, /* Reverse */
72  0, /* Chan Reg */
73  0, /* Channel Mode */
74  0, /* vidents */
75  1, /* svshold */
76  0, /* time stamp on mode */
77  0, /* NICKIP */
78  0, /* UMODE */
79  0, /* O:LINE */
80  1, /* VHOST ON NICK */
81  0, /* Change RealName */
82  CMODE_p, /* No Knock */
83  0, /* Admin Only */
84  DEFAULT_MLOCK, /* Default MLOCK */
85  0, /* Vhost Mode */
86  1, /* +f */
87  1, /* +L */
88  CMODE_j, /* +f Mode */
89  CMODE_f, /* +L Mode (+f <target>) */
90  1, /* On nick change check if they could be identified */
91  0, /* No Knock requires +i */
92  NULL, /* CAPAB Chan Modes */
93  0, /* We support TOKENS */
94  1, /* TOKENS are CASE inSensitive */
95  0, /* TIME STAMPS are BASE64 */
96  1, /* +I support */
97  0, /* SJOIN ban char */
98  0, /* SJOIN except char */
99  0, /* SJOIN invite char */
100  0, /* Can remove User Channel Modes with SVSMODE */
101  0, /* Sglines are not enforced until user reconnects */
102  NULL, /* vhost char */
103  1, /* ts6 */
104  0, /* support helper umode */
105  0, /* p10 */
106  NULL, /* character set */
107  0, /* reports sync state */
108  1, /* CIDR channelbans */
109  0, /* +j */
110  0, /* +j Mode */
111  0, /* Use delayed client introduction. */
112  }
113  ,
114  {NULL}
115 };
116 
118  {
119  0, /* NOQUIT */
120  0, /* TSMODE */
121  0, /* UNCONNECT */
122  0, /* NICKIP */
123  0, /* SJOIN */
124  CAPAB_ZIP, /* ZIP */
125  0, /* BURST */
126  CAPAB_TS5, /* TS5 */
127  0, /* TS3 */
128  0, /* DKEY */
129  0, /* PT4 */
130  0, /* SCS */
131  CAPAB_QS, /* QS */
132  CAPAB_UID, /* UID */
133  CAPAB_KNOCK, /* KNOCK */
134  0, /* CLIENT */
135  0, /* IPV6 */
136  0, /* SSJ5 */
137  0, /* SN2 */
138  0, /* TOKEN */
139  0, /* VHOST */
140  0, /* SSJ3 */
141  0, /* NICK2 */
142  0, /* UMODE2 */
143  0, /* VL */
144  0, /* TLKEXT */
145  0, /* DODKEY */
146  0, /* DOZIP */
147  0, 0, 0}
148 };
149 
150 /*******************************************************************/
151 
152 void charybdis_set_umode(User * user, int ac, char **av)
153 {
154  int add = 1; /* 1 if adding modes, 0 if deleting */
155  char *modes = av[0];
156 
157  ac--;
158 
159  if (debug)
160  alog("debug: Changing mode for %s to %s", user->nick, modes);
161 
162  while (*modes) {
163 
164  /* This looks better, much better than "add ? (do_add) : (do_remove)".
165  * At least this is readable without paying much attention :) -GD
166  */
167  if (add)
168  user->mode |= umodes[(int) *modes];
169  else
170  user->mode &= ~umodes[(int) *modes];
171 
172  switch (*modes++) {
173  case '+':
174  add = 1;
175  break;
176  case '-':
177  add = 0;
178  break;
179  case 'o':
180  if (add) {
181  opcnt++;
182 
183  if (WallOper)
185  "\2%s\2 is now an IRC operator.",
186  user->nick);
187  display_news(user, NEWS_OPER);
188 
189  } else {
190  opcnt--;
191  }
192  break;
193  }
194  }
195 }
196 
197 unsigned long umodes[128] = {
198  0, 0, 0, /* Unused */
199  0, 0, 0, /* Unused */
200  0, 0, 0, /* Unused, Unused, Horzontal Tab */
201  0, 0, 0, /* Line Feed, Unused, Unused */
202  0, 0, 0, /* Carriage Return, Unused, 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 */
208  0, 0, 0, /* Unused, Unused, Space */
209  0, 0, 0, /* ! " # */
210  0, 0, 0, /* $ % & */
211  0, 0, 0, /* ! ( ) */
212  0, 0, 0, /* * + , */
213  0, 0, 0, /* - . / */
214  0, 0, /* 0 1 */
215  0, 0, /* 2 3 */
216  0, 0, /* 4 5 */
217  0, 0, /* 6 7 */
218  0, 0, /* 8 9 */
219  0, 0, /* : ; */
220  0, 0, 0, /* < = > */
221  0, 0, /* ? @ */
222  0, 0, 0, /* A B C */
223  0, 0, 0, /* D E F */
224  0, 0, 0, /* G H I */
225  0, 0, 0, /* J K L */
226  0, 0, 0, /* M N O */
227  0, UMODE_Q, UMODE_R, /* P Q R */
228  UMODE_S, 0, 0, /* S T U */
229  0, 0, 0, /* V W X */
230  0, /* Y */
231  0, /* Z */
232  0, 0, 0, /* [ \ ] */
233  0, 0, 0, /* ^ _ ` */
234  UMODE_a, 0, 0, /* a b c */
235  0, 0, 0, /* d e f */
236  UMODE_g, 0, UMODE_i, /* g h i */
237  0, 0, UMODE_l, /* j k l */
238  0, 0, UMODE_o, /* m n o */
239  0, 0, 0, /* p q r */
240  UMODE_s, 0, 0, /* s t u */
241  0, UMODE_w, 0, /* v w x */
242  0, /* y */
243  UMODE_z, /* z */
244  0, 0, 0, /* { | } */
245  0, 0 /* ~ � */
246 };
247 
248 
249 char myCsmodes[128] = {
250  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
251  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
252 
253  0,
254  0,
255  0, 0, 0,
256  0,
257  0, 0, 0, 0,
258  0,
259 
260  'v', 0, 0, 0, 0,
261  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
262 
263  'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
264  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
265 
266  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
267  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
268 };
269 
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},
293  {NULL}, {NULL}, {NULL}, /* BCD */
294  {NULL}, {NULL}, {NULL}, /* EFG */
295  {NULL}, /* H */
297  {NULL}, /* J */
298  {NULL}, {NULL}, {NULL}, /* KLM */
299  {NULL}, {NULL}, {NULL}, /* NOP */
300  {NULL}, {NULL}, {NULL}, /* QRS */
301  {NULL}, {NULL}, {NULL}, /* TUV */
302  {NULL}, {NULL}, {NULL}, /* WXY */
303  {NULL}, /* Z */
304  {NULL}, {NULL}, /* (char 91 - 92) */
305  {NULL}, {NULL}, {NULL}, /* (char 93 - 95) */
306  {NULL}, /* ` (char 96) */
307  {NULL}, /* a (char 97) */
308  {add_ban, del_ban},
309  {NULL},
310  {NULL},
312  {NULL},
313  {NULL},
314  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
315  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
316  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}
317 };
318 
319 
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}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
329  {0},
330  {0}, /* A */
331  {0}, /* B */
332  {0}, /* C */
333  {0}, /* D */
334  {0}, /* E */
335  {CMODE_F, 0, NULL, NULL}, /* F */
336  {0}, /* G */
337  {0}, /* H */
338  {0}, /* I */
339  {0}, /* J */
340  {0}, /* K */
341  {CMODE_L, CBM_NO_USER_MLOCK, NULL, NULL}, /* L */
342  {0}, /* M */
343  {0}, /* N */
344  {0}, /* O */
345  {CMODE_P, CBM_NO_USER_MLOCK, NULL, NULL}, /* P */
346  {CMODE_Q, 0, NULL, NULL}, /* Q */
347  {0}, /* R */
348  {0}, /* S */
349  {0}, /* T */
350  {0}, /* U */
351  {0}, /* V */
352  {0}, /* W */
353  {0}, /* X */
354  {0}, /* Y */
355  {0}, /* Z */
356  {0}, {0}, {0}, {0}, {0}, {0},
357  {0},
358  {0}, /* b */
359  {CMODE_c, 0, NULL, NULL}, /* c */
360  {0}, /* d */
361  {0}, /* e */
362  {CMODE_f, 0, set_redirect, cs_set_redirect}, /* f */
363  {CMODE_g, 0, NULL, NULL}, /* g */
364  {0}, /* h */
365  {CMODE_i, 0, NULL, NULL},
366  {CMODE_j, 0, set_flood, cs_set_flood}, /* j */
369  {CMODE_m, 0, NULL, NULL},
370  {CMODE_n, 0, NULL, NULL},
371  {0}, /* o */
372  {CMODE_p, 0, NULL, NULL},
373  {0}, /* q */
374  {CMODE_r, 0, NULL, NULL},
375  {CMODE_s, 0, NULL, NULL},
376  {CMODE_t, 0, NULL, NULL},
377  {0},
378  {0}, /* v */
379  {0}, /* w */
380  {0}, /* x */
381  {0}, /* y */
382  {CMODE_z, 0, NULL, NULL}, /* z */
383  {0}, {0}, {0}, {0}
384 };
385 
387  {'c', CMODE_c, 0, NULL, NULL},
389  {'g', CMODE_g, 0, NULL, NULL},
390  {'i', CMODE_i, 0, NULL, NULL},
392  {'k', CMODE_k, 0, get_key, cs_get_key},
394  {'m', CMODE_m, 0, NULL, NULL},
395  {'n', CMODE_n, 0, NULL, NULL},
396  {'p', CMODE_p, 0, NULL, NULL},
397  {'r', CMODE_r, 0, NULL, NULL},
398  {'s', CMODE_s, 0, NULL, NULL},
399  {'t', CMODE_t, 0, NULL, NULL},
400  {'z', CMODE_z, 0, NULL, NULL},
401  {'F', CMODE_F, 0, NULL, NULL},
402  {'L', CMODE_L, 0, NULL, NULL},
403  {'P', CMODE_P, 0, NULL, NULL},
404  {'Q', CMODE_Q, 0, NULL, NULL},
405  {0}
406 };
407 
408 
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  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
414 
415  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
416  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
417  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
418  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
419 
420  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
421  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
422  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
423  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
424 
425  {0},
426 
427  {0}, /* a */
428  {0}, /* b */
429  {0}, /* c */
430  {0}, /* d */
431  {0}, /* e */
432  {0}, /* f */
433  {0}, /* g */
434  {0},
435  {0}, /* i */
436  {0}, /* j */
437  {0}, /* k */
438  {0}, /* l */
439  {0}, /* m */
440  {0}, /* n */
442  {0}, /* p */
443  {0}, /* q */
444  {0}, /* r */
445  {0}, /* s */
446  {0}, /* t */
447  {0}, /* u */
448  {CUS_VOICE, 0, NULL},
449  {0}, /* w */
450  {0}, /* x */
451  {0}, /* y */
452  {0}, /* z */
453  {0}, {0}, {0}, {0}, {0}
454 };
455 
456 
457 
458 void charybdis_cmd_notice(char *source, char *dest, char *buf)
459 {
460  Uid *ud;
461  User *u;
462 
463  if (!buf) {
464  return;
465  }
466 
467  if (NSDefFlags & NI_MSG) {
468  charybdis_cmd_privmsg2(source, dest, buf);
469  } else {
470  ud = find_uid(source);
471  u = finduser(dest);
472  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source),
473  "NOTICE %s :%s", (UseTS6 ? (u ? u->uid : dest) : dest),
474  buf);
475  }
476 }
477 
478 void charybdis_cmd_notice2(char *source, char *dest, char *msg)
479 {
480  Uid *ud;
481  User *u;
482 
483  ud = find_uid(source);
484  u = finduser(dest);
485  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "NOTICE %s :%s",
486  (UseTS6 ? (u ? u->uid : dest) : dest), msg);
487 }
488 
489 void charybdis_cmd_privmsg(char *source, char *dest, char *buf)
490 {
491  Uid *ud, *ud2;
492 
493  if (!buf) {
494  return;
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), buf);
501 }
502 
503 void charybdis_cmd_privmsg2(char *source, char *dest, char *msg)
504 {
505  Uid *ud, *ud2;
506 
507  ud = find_uid(source);
508  ud2 = find_uid(dest);
509 
510  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "PRIVMSG %s :%s",
511  (UseTS6 ? (ud2 ? ud2->uid : dest) : dest), msg);
512 }
513 
514 void charybdis_cmd_serv_notice(char *source, char *dest, char *msg)
515 {
516  send_cmd(source, "NOTICE $$%s :%s", dest, msg);
517 }
518 
519 void charybdis_cmd_serv_privmsg(char *source, char *dest, char *msg)
520 {
521  send_cmd(source, "PRIVMSG $$%s :%s", dest, msg);
522 }
523 
524 
525 void charybdis_cmd_global(char *source, char *buf)
526 {
527  Uid *u;
528 
529  if (!buf) {
530  return;
531  }
532 
533  if (source) {
534  u = find_uid(source);
535  if (u) {
536  send_cmd((UseTS6 ? u->uid : source), "OPERWALL :%s", buf);
537  } else {
538  send_cmd((UseTS6 ? TS6SID : ServerName), "WALLOPS :%s", buf);
539  }
540  } else {
541  send_cmd((UseTS6 ? TS6SID : ServerName), "WALLOPS :%s", buf);
542  }
543 }
544 
545 /* GLOBOPS - to handle old WALLOPS */
546 void charybdis_cmd_global_legacy(char *source, char *fmt)
547 {
548  Uid *u;
549 
550  if (source) {
551  u = find_uid(source);
552  if (u) {
553  send_cmd((UseTS6 ? u->uid : source), "OPERWALL :%s", fmt);
554  } else {
555  send_cmd((UseTS6 ? TS6SID : ServerName), "WALLOPS :%s", fmt);
556  }
557  } else {
558  send_cmd((UseTS6 ? TS6SID : ServerName), "WALLOPS :%s", fmt);
559  }
560 
561  send_cmd(source ? source : ServerName, "OPERWALL :%s", fmt);
562 }
563 
564 int anope_event_sjoin(char *source, int ac, char **av)
565 {
566  do_sjoin(source, ac, av);
567  return MOD_CONT;
568 }
569 
570 /*
571  Non TS6
572 
573  av[0] = nick
574  av[1] = hop
575  av[2] = ts
576  av[3] = modes
577  av[4] = user
578  av[5] = host
579  av[6] = server
580  av[7] = info
581 
582  TS6
583  av[0] = nick
584  av[1] = hop
585  av[2] = ts
586  av[3] = modes
587  av[4] = user
588  av[5] = host
589  av[6] = IP
590  av[7] = UID
591  av[8] = info
592 
593 */
594 int anope_event_nick(char *source, int ac, char **av)
595 {
596  Server *s;
597  User *user;
598 
599  if (UseTS6 && ac == 9) {
600  s = findserver_uid(servlist, source);
601  /* Source is always the server */
602  *source = '\0';
603  user = do_nick(source, av[0], av[4], av[5], s->name, av[8],
604  strtoul(av[2], NULL, 10), 0, 0, NULL, av[7]);
605  if (user) {
606  anope_set_umode(user, 1, &av[3]);
607  }
608  } else {
609  if (ac != 2) {
610  user = do_nick(source, av[0], av[4], av[5], av[6], av[7],
611  strtoul(av[2], NULL, 10), 0, 0, NULL, NULL);
612  if (user)
613  anope_set_umode(user, 1, &av[3]);
614  } else {
615  do_nick(source, av[0], NULL, NULL, NULL, NULL,
616  strtoul(av[1], NULL, 10), 0, 0, NULL, NULL);
617  }
618  }
619  return MOD_CONT;
620 }
621 
622 /*
623  TS6
624  av[0] = nick
625  av[1] = hop
626  av[2] = ts
627  av[3] = modes
628  av[4] = user
629  av[5] = vhost
630  av[6] = IP
631  av[7] = UID
632  ac[8] = host or *
633  ac[9] = services login
634  av[10] = info
635 
636 */
637 int anope_event_euid(char *source, int ac, char **av)
638 {
639  Server *s;
640  User *user;
641  time_t ts;
642 
643  if (UseTS6 && ac == 11) {
644  s = findserver_uid(servlist, source);
645  /* Source is always the server */
646  *source = '\0';
647  ts = strtoul(av[2], NULL, 10);
648  user = do_nick(source, av[0], av[4], !strcmp(av[8], "*") ? av[5] : av[8], s->name, av[10],
649  ts, !stricmp(av[0], av[9]) ? ts : 0, 0, av[5], av[7]);
650  if (user) {
651  anope_set_umode(user, 1, &av[3]);
652  }
653  }
654  return MOD_CONT;
655 }
656 
657 int anope_event_topic(char *source, int ac, char **av)
658 {
659  User *u;
660 
661  if (ac == 4) {
662  do_topic(source, ac, av);
663  } else {
664  Channel *c = findchan(av[0]);
665  time_t topic_time = time(NULL);
666 
667  if (!c) {
668  if (debug) {
669  alog("debug: TOPIC %s for nonexistent channel %s",
670  merge_args(ac - 1, av + 1), av[0]);
671  }
672  return MOD_CONT;
673  }
674 
675  if (check_topiclock(c, topic_time))
676  return MOD_CONT;
677 
678  if (c->topic) {
679  free(c->topic);
680  c->topic = NULL;
681  }
682  if (ac > 1 && *av[1])
683  c->topic = sstrdup(av[1]);
684 
685  if (UseTS6) {
686  u = find_byuid(source);
687  if (u) {
688  strscpy(c->topic_setter, u->nick, sizeof(c->topic_setter));
689  } else {
690  strscpy(c->topic_setter, source, sizeof(c->topic_setter));
691  }
692  } else {
693  strscpy(c->topic_setter, source, sizeof(c->topic_setter));
694  }
695  c->topic_time = topic_time;
696 
697  record_topic(av[0]);
698 
699  if (ac > 1 && *av[1])
700  send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[1]);
701  else
702  send_event(EVENT_TOPIC_UPDATED, 2, av[0], "");
703  }
704  return MOD_CONT;
705 }
706 
707 int anope_event_tburst(char *source, int ac, char **av)
708 {
709  char *setter;
710  Channel *c;
711  time_t topic_time;
712 
713  if (ac != 4) {
714  return MOD_CONT;
715  }
716 
717  setter = myStrGetToken(av[2], '!', 0);
718 
719  c = findchan(av[0]);
720  topic_time = strtol(av[1], NULL, 10);
721 
722  if (!c) {
723  if (debug) {
724  alog("debug: TOPIC %s for nonexistent channel %s",
725  merge_args(ac - 1, av + 1), av[0]);
726  }
727  if (setter)
728  free(setter);
729  return MOD_CONT;
730  }
731 
732  if (check_topiclock(c, topic_time)) {
733  if (setter)
734  free(setter);
735  return MOD_CONT;
736  }
737 
738  if (c->topic) {
739  free(c->topic);
740  c->topic = NULL;
741  }
742  if (ac > 1 && *av[3])
743  c->topic = sstrdup(av[3]);
744 
745  strscpy(c->topic_setter, setter, sizeof(c->topic_setter));
746  c->topic_time = topic_time;
747 
748  record_topic(av[0]);
749 
750  if (ac > 1 && *av[3])
751  send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[3]);
752  else
753  send_event(EVENT_TOPIC_UPDATED, 2, av[0], "");
754 
755  if (setter)
756  free(setter);
757 
758  return MOD_CONT;
759 }
760 
761 int anope_event_436(char *source, int ac, char **av)
762 {
763  if (ac < 1)
764  return MOD_CONT;
765 
766  m_nickcoll(av[0]);
767  return MOD_CONT;
768 }
769 
770 
771 /* *INDENT-OFF* */
772 void moduleAddIRCDMsgs(void)
773 {
774  Message *m;
775 
776  updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+","-");
777 
778  if (UseTS6) {
780  }
781 
820 }
821 
822 /* *INDENT-ON* */
823 
824 
825 void charybdis_cmd_sqline(char *mask, char *reason)
826 {
827  Uid *ud;
828 
829  ud = find_uid(s_OperServ);
830  send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
831  "RESV * %s :%s", mask, reason);
832 }
833 
834 void charybdis_cmd_unsgline(char *mask)
835 {
836  Uid *ud;
837 
838  ud = find_uid(s_OperServ);
839  send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
840  "UNXLINE * %s", mask);
841 }
842 
843 void charybdis_cmd_unszline(char *mask)
844 {
845  /* not supported */
846 }
847 
848 void charybdis_cmd_szline(char *mask, char *reason, char *whom)
849 {
850  /* not supported */
851 }
852 
853 void charybdis_cmd_svsnoop(char *server, int set)
854 {
855  /* does not support */
856 }
857 
858 void charybdis_cmd_svsadmin(char *server, int set)
859 {
860  charybdis_cmd_svsnoop(server, set);
861 }
862 
863 void charybdis_cmd_sgline(char *mask, char *reason)
864 {
865  Uid *ud;
866 
867  ud = find_uid(s_OperServ);
868  send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
869  "XLINE * %s 0 :%s", mask, reason);
870 }
871 
872 void charybdis_cmd_remove_akill(char *user, char *host)
873 {
874  Uid *ud;
875 
876  if (!user || !*user || !host || !*host)
877  return;
878 
879  ud = find_uid(s_OperServ);
880  send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
881  "UNKLINE * %s %s", user, host);
882 }
883 
884 void charybdis_cmd_topic(char *whosets, char *chan, char *whosetit,
885  char *topic, time_t when)
886 {
887  Uid *ud;
888 
889  ud = find_uid(whosets);
890  send_cmd((UseTS6 ? (ud ? ud->uid : whosets) : whosets), "TOPIC %s :%s",
891  chan, topic);
892 }
893 
895 {
896  send_cmd((UseTS6 ? TS6SID : ServerName), "ENCAP * CHGHOST %s :%s",
897  u->nick, u->host);
898 }
899 
900 void charybdis_cmd_vhost_on(char *nick, char *vIdent, char *vhost)
901 {
902  send_cmd((UseTS6 ? TS6SID : ServerName), "ENCAP * CHGHOST %s :%s",
903  nick, vhost);
904 }
905 
906 void charybdis_cmd_unsqline(char *user)
907 {
908  Uid *ud;
909 
910  ud = find_uid(s_OperServ);
911  send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
912  "UNRESV * %s", user);
913 }
914 
915 void charybdis_cmd_join(char *user, char *channel, time_t chantime)
916 {
917  Uid *ud;
918 
919  ud = find_uid(user);
920  send_cmd(NULL, "SJOIN %ld %s + :%s", (long int) chantime,
921  channel, (UseTS6 ? (ud ? ud->uid : user) : user));
922 }
923 
924 /*
925 oper: the nick of the oper performing the kline
926 target.server: the server(s) this kline is destined for
927 duration: the duration if a tkline, 0 if permanent.
928 user: the 'user' portion of the kline
929 host: the 'host' portion of the kline
930 reason: the reason for the kline.
931 */
932 
933 void charybdis_cmd_akill(char *user, char *host, char *who, time_t when,
934  time_t expires, char *reason)
935 {
936  Uid *ud;
937 
938  ud = find_uid(s_OperServ);
939 
940  send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
941  "KLINE * %ld %s %s :%s",
942  (long int) (expires - (long) time(NULL)), user, host, reason);
943 }
944 
945 void charybdis_cmd_svskill(char *source, char *user, char *buf)
946 {
947  Uid *ud, *ud2;
948 
949  if (!buf) {
950  return;
951  }
952 
953  if (!source || !user) {
954  return;
955  }
956 
957  ud = find_uid(source);
958  ud2 = find_uid(user);
959  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "KILL %s :%s",
960  (UseTS6 ? (ud2 ? ud2->uid : user) : user), buf);
961 }
962 
963 void charybdis_cmd_svsmode(User * u, int ac, char **av)
964 {
965  send_cmd((UseTS6 ? TS6SID : ServerName), "SVSMODE %s %s", u->nick,
966  av[0]);
967 }
968 
969 /*
970  * SVINFO
971  * parv[0] = sender prefix
972  * parv[1] = TS_CURRENT for the server
973  * parv[2] = TS_MIN for the server
974  * parv[3] = server is standalone or connected to non-TS only
975  * parv[4] = server's idea of UTC time
976  */
978 {
979  send_cmd(NULL, "SVINFO 6 3 0 :%ld", (long int) time(NULL));
980 }
981 
983 {
984 
985 }
986 
987 /* CAPAB */
988 /*
989  QS - Can handle quit storm removal
990  EX - Can do channel +e exemptions
991  CHW - Can do channel wall @#
992  LL - Can do lazy links
993  IE - Can do invite exceptions
994  EOB - Can do EOB message
995  KLN - Can do KLINE message
996  GLN - Can do GLINE message
997  HUB - This server is a HUB
998  UID - Can do UIDs
999  ZIP - Can do ZIPlinks
1000  ENC - Can do ENCrypted links
1001  KNOCK - supports KNOCK
1002  TBURST - supports TBURST
1003  PARA - supports invite broadcasting for +p
1004  ENCAP - supports message encapsulation
1005  SERVICES - supports services-oriented TS6 extensions
1006  EUID - supports EUID and non-ENCAP CHGHOST
1007 */
1009 {
1010  send_cmd(NULL,
1011  "CAPAB :QS EX CHW IE KLN GLN KNOCK TB UNKLN CLUSTER ENCAP SERVICES EUID");
1012 }
1013 
1014 /* PASS */
1015 void charybdis_cmd_pass(char *pass)
1016 {
1017  if (UseTS6) {
1018  send_cmd(NULL, "PASS %s TS 6 :%s", pass, TS6SID);
1019  } else {
1020  send_cmd(NULL, "PASS %s :TS", pass);
1021  }
1022 }
1023 
1024 /* SERVER name hop descript */
1025 void charybdis_cmd_server(char *servname, int hop, char *descript)
1026 {
1027  send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript);
1028 }
1029 
1031 {
1032  /* Make myself known to myself in the serverlist */
1033  if (UseTS6) {
1034  me_server =
1036  } else {
1037  me_server =
1039  }
1040  if (servernum == 1)
1042  else if (servernum == 2)
1044  else if (servernum == 3)
1046 
1050 }
1051 
1053 {
1054  /* Not used */
1055 }
1056 
1057 void charybdis_cmd_bot_nick(char *nick, char *user, char *host, char *real,
1058  char *modes)
1059 {
1060  EnforceQlinedNick(nick, NULL);
1061  if (UseTS6) {
1062  char *uidbuf = ts6_uid_retrieve();
1063  send_cmd(TS6SID, "UID %s 1 %ld %s %s %s 0 %s :%s", nick,
1064  (long int) time(NULL), modes, user, host, uidbuf,
1065  real);
1066  new_uid(nick, uidbuf);
1067  } else {
1068  send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s :%s", nick,
1069  (long int) time(NULL), modes, user, host, ServerName,
1070  real);
1071  }
1072  charybdis_cmd_sqline(nick, "Reserved for services");
1073 }
1074 
1075 void charybdis_cmd_part(char *nick, char *chan, char *buf)
1076 {
1077  Uid *ud;
1078 
1079  ud = find_uid(nick);
1080 
1081  if (buf) {
1082  send_cmd((UseTS6 ? ud->uid : nick), "PART %s :%s", chan, buf);
1083  } else {
1084  send_cmd((UseTS6 ? ud->uid : nick), "PART %s", chan);
1085  }
1086 }
1087 
1088 int anope_event_ping(char *source, int ac, char **av)
1089 {
1090  if (ac < 1)
1091  return MOD_CONT;
1092  charybdis_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]);
1093  return MOD_CONT;
1094 }
1095 
1096 int anope_event_away(char *source, int ac, char **av)
1097 {
1098  User *u = NULL;
1099 
1100  if (UseTS6) {
1101  u = find_byuid(source);
1102  }
1103 
1104  m_away((UseTS6 ? (u ? u->nick : source) : source),
1105  (ac ? av[0] : NULL));
1106  return MOD_CONT;
1107 }
1108 
1109 int anope_event_kill(char *source, int ac, char **av)
1110 {
1111  User *u = NULL;
1112  Uid *ud = NULL;
1113 
1114  if (ac != 2)
1115  return MOD_CONT;
1116 
1117  if (UseTS6) {
1118  u = find_byuid(av[0]);
1119  ud = find_nickuid(av[0]);
1120  }
1121 
1122  m_kill(u ? u->nick : (ud ? ud->nick : av[0]), av[1]);
1123  return MOD_CONT;
1124 }
1125 
1126 int anope_event_kick(char *source, int ac, char **av)
1127 {
1128  if (ac != 3)
1129  return MOD_CONT;
1130  do_kick(source, ac, av);
1131  return MOD_CONT;
1132 }
1133 
1135 {
1136  /* doesn't support EOB */
1137 }
1138 
1139 int anope_event_join(char *source, int ac, char **av)
1140 {
1141  if (ac != 1) {
1142  /* ignore cmodes in JOIN as per TS6 v8 */
1143  do_sjoin(source, ac > 2 ? 2 : ac, av);
1144  return MOD_CONT;
1145  } else {
1146  do_join(source, ac, av);
1147  }
1148  return MOD_CONT;
1149 }
1150 
1151 int anope_event_motd(char *source, int ac, char **av)
1152 {
1153  if (!source) {
1154  return MOD_CONT;
1155  }
1156 
1157  m_motd(source);
1158  return MOD_CONT;
1159 }
1160 
1161 int anope_event_privmsg(char *source, int ac, char **av)
1162 {
1163  User *u;
1164  Uid *ud;
1165 
1166  if (ac != 2) {
1167  return MOD_CONT;
1168  }
1169 
1170  u = find_byuid(source);
1171  ud = find_nickuid(av[0]);
1172  m_privmsg((UseTS6 ? (u ? u->nick : source) : source),
1173  (UseTS6 ? (ud ? ud->nick : av[0]) : av[0]), av[1]);
1174  return MOD_CONT;
1175 }
1176 
1177 int anope_event_part(char *source, int ac, char **av)
1178 {
1179  User *u;
1180 
1181  if (ac < 1 || ac > 2) {
1182  return MOD_CONT;
1183  }
1184 
1185  u = find_byuid(source);
1186  do_part((UseTS6 ? (u ? u->nick : source) : source), ac, av);
1187 
1188  return MOD_CONT;
1189 }
1190 
1191 int anope_event_whois(char *source, int ac, char **av)
1192 {
1193  Uid *ud;
1194 
1195  if (source && ac >= 1) {
1196  ud = find_nickuid(av[0]);
1197  m_whois(source, (UseTS6 ? (ud ? ud->nick : av[0]) : av[0]));
1198  }
1199  return MOD_CONT;
1200 }
1201 
1202 /* EVENT: SERVER */
1203 int anope_event_server(char *source, int ac, char **av)
1204 {
1205  if (!stricmp(av[1], "1")) {
1206  uplink = sstrdup(av[0]);
1207  if (UseTS6 && TS6UPLINK) {
1208  do_server(source, av[0], av[1], av[2], TS6UPLINK);
1209  } else {
1210  do_server(source, av[0], av[1], av[2], NULL);
1211  }
1212  } else {
1213  do_server(source, av[0], av[1], av[2], NULL);
1214  }
1215  return MOD_CONT;
1216 }
1217 
1218 int anope_event_sid(char *source, int ac, char **av)
1219 {
1220  Server *s;
1221 
1222  /* :42X SID trystan.nomadirc.net 2 43X :ircd-charybdis test server */
1223 
1224  s = findserver_uid(servlist, source);
1225 
1226  do_server(s->name, av[0], av[1], av[3], av[2]);
1227  return MOD_CONT;
1228 }
1229 
1230 int anope_event_squit(char *source, int ac, char **av)
1231 {
1232  if (ac != 2)
1233  return MOD_CONT;
1234  do_squit(source, ac, av);
1235  return MOD_CONT;
1236 }
1237 
1238 int anope_event_quit(char *source, int ac, char **av)
1239 {
1240  User *u;
1241 
1242  if (ac != 1) {
1243  return MOD_CONT;
1244  }
1245 
1246  u = find_byuid(source);
1247 
1248  do_quit((UseTS6 ? (u ? u->nick : source) : source), ac, av);
1249  return MOD_CONT;
1250 }
1251 
1252 void charybdis_cmd_372(char *source, char *msg)
1253 {
1254  send_cmd((UseTS6 ? TS6SID : ServerName), "372 %s :- %s", source, msg);
1255 }
1256 
1257 void charybdis_cmd_372_error(char *source)
1258 {
1260  "422 %s :- MOTD file not found! Please "
1261  "contact your IRC administrator.", source);
1262 }
1263 
1264 void charybdis_cmd_375(char *source)
1265 {
1267  "375 %s :- %s Message of the Day", source, ServerName);
1268 }
1269 
1270 void charybdis_cmd_376(char *source)
1271 {
1273  "376 %s :End of /MOTD command.", source);
1274 }
1275 
1276 /* 391 */
1277 void charybdis_cmd_391(char *source, char *timestr)
1278 {
1279  if (!timestr) {
1280  return;
1281  }
1282  send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr);
1283 }
1284 
1285 /* 250 */
1286 void charybdis_cmd_250(char *buf)
1287 {
1288  if (!buf) {
1289  return;
1290  }
1291 
1292  send_cmd(NULL, "250 %s", buf);
1293 }
1294 
1295 /* 307 */
1296 void charybdis_cmd_307(char *buf)
1297 {
1298  if (!buf) {
1299  return;
1300  }
1301 
1302  send_cmd((UseTS6 ? TS6SID : ServerName), "307 %s", buf);
1303 }
1304 
1305 /* 311 */
1306 void charybdis_cmd_311(char *buf)
1307 {
1308  if (!buf) {
1309  return;
1310  }
1311 
1312  send_cmd((UseTS6 ? TS6SID : ServerName), "311 %s", buf);
1313 }
1314 
1315 /* 312 */
1316 void charybdis_cmd_312(char *buf)
1317 {
1318  if (!buf) {
1319  return;
1320  }
1321 
1322  send_cmd((UseTS6 ? TS6SID : ServerName), "312 %s", buf);
1323 }
1324 
1325 /* 317 */
1326 void charybdis_cmd_317(char *buf)
1327 {
1328  if (!buf) {
1329  return;
1330  }
1331 
1332  send_cmd((UseTS6 ? TS6SID : ServerName), "317 %s", buf);
1333 }
1334 
1335 /* 219 */
1336 void charybdis_cmd_219(char *source, char *letter)
1337 {
1338  if (!source) {
1339  return;
1340  }
1341 
1342  if (letter) {
1343  send_cmd(NULL, "219 %s %c :End of /STATS report.", source,
1344  *letter);
1345  } else {
1346  send_cmd(NULL, "219 %s l :End of /STATS report.", source);
1347  }
1348 }
1349 
1350 /* 401 */
1351 void charybdis_cmd_401(char *source, char *who)
1352 {
1353  if (!source || !who) {
1354  return;
1355  }
1356  send_cmd((UseTS6 ? TS6SID : ServerName), "401 %s %s :No such service.",
1357  source, who);
1358 }
1359 
1360 /* 318 */
1361 void charybdis_cmd_318(char *source, char *who)
1362 {
1363  if (!source || !who) {
1364  return;
1365  }
1366 
1368  "318 %s %s :End of /WHOIS list.", source, who);
1369 }
1370 
1371 /* 242 */
1372 void charybdis_cmd_242(char *buf)
1373 {
1374  if (!buf) {
1375  return;
1376  }
1377 
1378  send_cmd(NULL, "242 %s", buf);
1379 }
1380 
1381 /* 243 */
1382 void charybdis_cmd_243(char *buf)
1383 {
1384  if (!buf) {
1385  return;
1386  }
1387 
1388  send_cmd(NULL, "243 %s", buf);
1389 }
1390 
1391 /* 211 */
1392 void charybdis_cmd_211(char *buf)
1393 {
1394  if (!buf) {
1395  return;
1396  }
1397 
1398  send_cmd(NULL, "211 %s", buf);
1399 }
1400 
1401 void charybdis_cmd_mode(char *source, char *dest, char *buf)
1402 {
1403  Uid *ud;
1404  if (!buf) {
1405  return;
1406  }
1407 
1408  if (source) {
1409  ud = find_uid(source);
1410  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "MODE %s %s",
1411  dest, buf);
1412  } else {
1413  send_cmd(NULL, "MODE %s %s", dest, buf);
1414  }
1415 }
1416 
1417 void charybdis_cmd_tmode(char *source, char *dest, const char *fmt, ...)
1418 {
1419  va_list args;
1420  char buf[BUFSIZE];
1421  *buf = '\0';
1422 
1423  if (fmt) {
1424  va_start(args, fmt);
1425  vsnprintf(buf, BUFSIZE - 1, fmt, args);
1426  va_end(args);
1427  }
1428  if (!*buf) {
1429  return;
1430  }
1431 
1432  send_cmd(NULL, "MODE %s %s", dest, buf);
1433 }
1434 
1435 void charybdis_cmd_nick(char *nick, char *name, char *mode)
1436 {
1437  EnforceQlinedNick(nick, NULL);
1438  if (UseTS6) {
1439  char *uidbuf = ts6_uid_retrieve();
1440  send_cmd(TS6SID, "UID %s 1 %ld %s %s %s 0 %s :%s", nick,
1441  (long int) time(NULL), mode, ServiceUser, ServiceHost,
1442  uidbuf, name);
1443  new_uid(nick, uidbuf);
1444  } else {
1445  send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s :%s", nick,
1446  (long int) time(NULL), mode, ServiceUser, ServiceHost,
1447  ServerName, name);
1448  }
1449  charybdis_cmd_sqline(nick, "Reserved for services");
1450 }
1451 
1452 void charybdis_cmd_kick(char *source, char *chan, char *user, char *buf)
1453 {
1454  Uid *ud;
1455  User *u;
1456 
1457  ud = find_uid(source);
1458  u = finduser(user);
1459 
1460  if (buf) {
1461  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source),
1462  "KICK %s %s :%s", chan,
1463  (UseTS6 ? (u ? u->uid : user) : user), buf);
1464  } else {
1465  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "KICK %s %s",
1466  chan, (UseTS6 ? (u ? u->uid : user) : user));
1467  }
1468 }
1469 
1470 void charybdis_cmd_notice_ops(char *source, char *dest, char *buf)
1471 {
1472  Uid *ud;
1473  ud = find_uid(source);
1474 
1475  if (!buf) {
1476  return;
1477  }
1478 
1479  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "NOTICE @%s :%s", dest, buf);
1480 }
1481 
1482 void charybdis_cmd_bot_chan_mode(char *nick, char *chan)
1483 {
1484  Uid *u;
1485 
1486  if (UseTS6) {
1487  u = find_uid(nick);
1488  charybdis_cmd_tmode(nick, chan, "%s %s", ircd->botchanumode,
1489  (u ? u->uid : nick));
1490  } else {
1491  anope_cmd_mode(ServerName, chan, "%s %s", ircd->botchanumode, nick);
1492  }
1493 }
1494 
1495 /* QUIT */
1496 void charybdis_cmd_quit(char *source, char *buf)
1497 {
1498  Uid *ud;
1499  ud = find_uid(source);
1500 
1501  if (buf) {
1502  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "QUIT :%s",
1503  buf);
1504  } else {
1505  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "QUIT");
1506  }
1507 }
1508 
1509 /* PONG */
1510 void charybdis_cmd_pong(char *servname, char *who)
1511 {
1512  if (UseTS6) {
1513  /* deliberately no SID in the first parameter -- jilles */
1514  send_cmd(TS6SID, "PONG %s :%s", servname, who);
1515  } else {
1516  send_cmd(servname, "PONG %s :%s", servname, who);
1517  }
1518 }
1519 
1520 /* INVITE */
1521 void charybdis_cmd_invite(char *source, char *chan, char *nick)
1522 {
1523  Uid *ud;
1524  User *u;
1525 
1526  if (!source || !chan || !nick) {
1527  return;
1528  }
1529 
1530  ud = find_uid(source);
1531  u = finduser(nick);
1532 
1533  send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "INVITE %s %s",
1534  (UseTS6 ? (u ? u->uid : nick) : nick), chan);
1535 }
1536 
1537 /* SQUIT */
1538 void charybdis_cmd_squit(char *servname, char *message)
1539 {
1540  if (!servname || !message) {
1541  return;
1542  }
1543 
1544  send_cmd(NULL, "SQUIT %s :%s", servname, message);
1545 }
1546 
1547 int anope_event_mode(char *source, int ac, char **av)
1548 {
1549  User *u, *u2;
1550 
1551  if (ac < 2) {
1552  return MOD_CONT;
1553  }
1554 
1555  if (*av[0] == '#' || *av[0] == '&') {
1556  do_cmode(source, ac, av);
1557  } else {
1558  if (UseTS6) {
1559  u = find_byuid(source);
1560  u2 = find_byuid(av[0]);
1561  av[0] = u2->nick;
1562  do_umode(u->nick, ac, av);
1563  } else {
1564  do_umode(source, ac, av);
1565  }
1566  }
1567  return MOD_CONT;
1568 }
1569 
1570 int anope_event_tmode(char *source, int ac, char **av)
1571 {
1572  if (ac > 2 && (*av[1] == '#' || *av[1] == '&')) {
1573  do_cmode(source, ac, av);
1574  }
1575  return MOD_CONT;
1576 }
1577 
1578 void charybdis_cmd_351(char *source)
1579 {
1581  "351 %s Anope-%s %s :%s - %s (%s) -- %s", source, version_number,
1582  ServerName, ircd->name, version_flags, EncModule, version_build);
1583 }
1584 
1585 /* Event: PROTOCTL */
1586 int anope_event_capab(char *source, int ac, char **av)
1587 {
1588  int argvsize = 8;
1589  int argc;
1590  char **argv;
1591  char *str;
1592 
1593  if (ac < 1)
1594  return MOD_CONT;
1595 
1596  /* We get the params as one arg, we should split it for capab_parse */
1597  argv = scalloc(argvsize, sizeof(char *));
1598  argc = 0;
1599  while ((str = myStrGetToken(av[0], ' ', argc))) {
1600  if (argc == argvsize) {
1601  argvsize += 8;
1602  argv = srealloc(argv, argvsize * sizeof(char *));
1603  }
1604  argv[argc] = str;
1605  argc++;
1606  }
1607 
1608  capab_parse(argc, argv);
1609 
1610  /* Free our built ac/av */
1611  for (argvsize = 0; argvsize < argc; argvsize++) {
1612  free(argv[argvsize]);
1613  }
1614  free(argv);
1615 
1616  return MOD_CONT;
1617 }
1618 
1619 /* SVSHOLD - set */
1620 void charybdis_cmd_svshold(char *nick)
1621 {
1622  send_cmd(NULL, "ENCAP * NICKDELAY 300 %s", nick);
1623 }
1624 
1625 /* SVSHOLD - release */
1627 {
1628  send_cmd(NULL, "ENCAP * NICKDELAY 0 %s", nick);
1629 }
1630 
1631 /* SVSNICK */
1632 void charybdis_cmd_svsnick(char *nick, char *newnick, time_t when)
1633 {
1634  User *u;
1635 
1636  if (!nick || !newnick) {
1637  return;
1638  }
1639 
1640  u = finduser(nick);
1641  if (!u)
1642  return;
1643  send_cmd(NULL, "ENCAP %s RSFNC %s %s %ld %ld", u->server->name,
1644  u->nick, newnick, (long int)when, (long int)u->timestamp);
1645 }
1646 
1647 void charybdis_cmd_guest_nick(char *nick, char *user, char *host, char *real,
1648  char *modes)
1649 {
1650  /* not supported */
1651 }
1652 
1653 void charybdis_cmd_svso(char *source, char *nick, char *flag)
1654 {
1655  /* Not Supported by this IRCD */
1656 }
1657 
1658 void charybdis_cmd_unban(char *name, char *nick)
1659 {
1660  /* Not Supported by this IRCD */
1661 }
1662 
1663 /* SVSMODE channel modes */
1664 
1665 void charybdis_cmd_svsmode_chan(char *name, char *mode, char *nick)
1666 {
1667  /* Not Supported by this IRCD */
1668 }
1669 
1670 /* SVSMODE +d */
1671 /* sent if svid is something weird */
1672 void charybdis_cmd_svid_umode(char *nick, time_t ts)
1673 {
1674  /* not supported */
1675 }
1676 
1677 /* SVSMODE +d */
1678 /* nc_change was = 1, and there is no na->status */
1680 {
1681  /* not supported */
1682 }
1683 
1684 /* SVSMODE +d */
1685 void charybdis_cmd_svid_umode2(User * u, char *ts)
1686 {
1687  /* not supported */
1688 }
1689 
1690 void charybdis_cmd_svid_umode3(User * u, char *ts)
1691 {
1692  /* not used */
1693 }
1694 
1695 /* NICK <newnick> */
1696 void charybdis_cmd_chg_nick(char *oldnick, char *newnick)
1697 {
1698  Uid *ud;
1699 
1700  if (!oldnick || !newnick) {
1701  return;
1702  }
1703 
1704  ud = find_uid(oldnick);
1705  if (ud)
1706  strscpy(ud->nick, newnick, NICKMAX);
1707 
1708  send_cmd(oldnick, "NICK %s", newnick);
1709 }
1710 
1711 /*
1712  * SVINFO
1713  * parv[0] = sender prefix
1714  * parv[1] = TS_CURRENT for the server
1715  * parv[2] = TS_MIN for the server
1716  * parv[3] = server is standalone or connected to non-TS only
1717  * parv[4] = server's idea of UTC time
1718  */
1719 int anope_event_svinfo(char *source, int ac, char **av)
1720 {
1721  /* currently not used but removes the message : unknown message from server */
1722  return MOD_CONT;
1723 }
1724 
1725 int anope_event_pass(char *source, int ac, char **av)
1726 {
1727  if (UseTS6) {
1728  TS6UPLINK = sstrdup(av[3]);
1729  }
1730  return MOD_CONT;
1731 }
1732 
1733 void charybdis_cmd_svsjoin(char *source, char *nick, char *chan, char *param)
1734 {
1735  /* Not Supported by this IRCD */
1736 }
1737 
1738 void charybdis_cmd_svspart(char *source, char *nick, char *chan)
1739 {
1740  /* Not Supported by this IRCD */
1741 }
1742 
1743 void charybdis_cmd_swhois(char *source, char *who, char *mask)
1744 {
1745  /* not supported */
1746 }
1747 
1748 int anope_event_notice(char *source, int ac, char **av)
1749 {
1750  return MOD_CONT;
1751 }
1752 
1753 int anope_event_admin(char *source, int ac, char **av)
1754 {
1755  return MOD_CONT;
1756 }
1757 
1758 int anope_event_invite(char *source, int ac, char **av)
1759 {
1760  return MOD_CONT;
1761 }
1762 
1763 int anope_event_bmask(char *source, int ac, char **av)
1764 {
1765  Channel *c;
1766  char *bans;
1767  char *b;
1768  int count, i;
1769 
1770  /* :42X BMASK 1106409026 #ircops b :*!*@*.aol.com */
1771  /* 0 1 2 3 */
1772  c = findchan(av[1]);
1773 
1774  if (c) {
1775  bans = sstrdup(av[3]);
1776  count = myNumToken(bans, ' ');
1777  for (i = 0; i <= count - 1; i++) {
1778  b = myStrGetToken(bans, ' ', i);
1779  if (!stricmp(av[2], "b")) {
1780  add_ban(c, b);
1781  }
1782  if (!stricmp(av[2], "e")) {
1783  add_exception(c, b);
1784  }
1785  if (!stricmp(av[2], "I")) {
1786  add_invite(c, b);
1787  }
1788  if (b)
1789  free(b);
1790  }
1791  free(bans);
1792  }
1793  return MOD_CONT;
1794 }
1795 
1797 {
1798  char *dp, *end;
1799 
1800  if (value && *value != ':'
1801  && (strtoul((*value == '*' ? value + 1 : value), &dp, 10) > 0)
1802  && (*dp == ':') && (*(++dp) != 0) && (strtoul(dp, &end, 10) > 0)
1803  && (*end == 0)) {
1804  return 1;
1805  } else {
1806  return 0;
1807  }
1808 
1809  return 0;
1810 }
1811 
1812 int anope_event_error(char *source, int ac, char **av)
1813 {
1814  if (ac >= 1) {
1815  if (debug) {
1816  alog("debug: %s", av[0]);
1817  }
1818  }
1819  return MOD_CONT;
1820 }
1821 
1822 void charybdis_cmd_jupe(char *jserver, char *who, char *reason)
1823 {
1824  char rbuf[256];
1825 
1826  snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who,
1827  reason ? ": " : "", reason ? reason : "");
1828 
1829  if (findserver(servlist, jserver))
1830  charybdis_cmd_squit(jserver, rbuf);
1831  charybdis_cmd_server(jserver, 2, rbuf);
1832  new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL);
1833 }
1834 
1835 /*
1836  1 = valid nick
1837  0 = nick is in valid
1838 */
1839 int charybdis_valid_nick(char *nick)
1840 {
1841  /* TS6 Save extension -Certus */
1842  if (isdigit(*nick))
1843  return 0;
1844  return 1;
1845 }
1846 
1847 /*
1848  1 = valid chan
1849  0 = chan is invalid
1850 */
1851 int charybdis_valid_chan(char *chan)
1852 {
1853  /* no hard coded invalid chan */
1854  return 1;
1855 }
1856 
1857 
1858 void charybdis_cmd_ctcp(char *source, char *dest, char *buf)
1859 {
1860  char *s;
1861 
1862  if (!buf) {
1863  return;
1864  } else {
1865  s = normalizeBuffer(buf);
1866  }
1867 
1868  send_cmd(source, "NOTICE %s :\1%s \1", dest, s);
1869  free(s);
1870 }
1871 
1872 int charybdis_send_account(int argc, char **argv)
1873 {
1874  send_cmd((UseTS6 ? TS6SID : ServerName), "ENCAP * SU %s :%s",
1875  argv[0], argv[0]);
1876 
1877  return MOD_CONT;
1878 }
1879 
1880 /* XXX: We need a hook on /ns logout before this is useful! --nenolod */
1881 /* We have one now! -GD */
1882 int charybdis_send_deaccount(int argc, char **argv)
1883 {
1884  send_cmd((UseTS6 ? TS6SID : ServerName), "ENCAP * SU %s",
1885  argv[0]);
1886 
1887  return MOD_CONT;
1888 }
1889 
1895 {
1971 }
1972 
1976 int AnopeInit(int argc, char **argv)
1977 {
1978  EvtHook *hk;
1979 
1980  moduleAddAuthor("Anope");
1981  moduleAddVersion(VERSION_STRING);
1983 
1984  pmodule_ircd_version("Charybdis 1.0/1.1+");
1985  pmodule_ircd_cap(myIrcdcap);
1986  pmodule_ircd_var(myIrcd);
1987  pmodule_ircd_cbmodeinfos(myCbmodeinfos);
1988  pmodule_ircd_cumodes(myCumodes);
1991  pmodule_ircd_cbmodes(myCbmodes);
1992  pmodule_ircd_cmmodes(myCmmodes);
1995 
2005 
2008 
2010  moduleAddEventHook(hk);
2011 
2013  moduleAddEventHook(hk);
2014 
2015  /* XXX: It'd be nice if we could have an event like this, but it's not there yet :( */
2016  /* It's there now! Trystan said so! -GD */
2018  moduleAddEventHook(hk);
2019 
2020  return MOD_CONT;
2021 }
2022 
2023 /* Clean up allocated things in here */
2024 void AnopeFini(void)
2025 {
2026  if (UseTS6)
2027  free(TS6SID);
2028 }
2029 
2030 /* EOF */
void charybdis_cmd_mode(char *source, char *dest, char *buf)
Definition: charybdis.c:1401
E void pmodule_cmd_vhost_off(void(*func)(User *u))
Definition: ircd.c:713
E void pmodule_permchan_mode(int mode)
Definition: ircd.c:1206
E void set_redirect(Channel *chan, char *value)
Definition: channels.c:2022
E Uid * find_uid(const char *nick)
Definition: users.c:453
void AnopeFini(void)
Definition: charybdis.c:2024
int charybdis_send_account(int argc, char **argv)
Definition: charybdis.c:1872
E int32 opcnt
Definition: extern.h:1140
E char * RemotePassword3
Definition: extern.h:270
int anope_event_notice(char *source, int ac, char **av)
Definition: charybdis.c:1748
void charybdis_cmd_svsmode(User *u, int ac, char **av)
Definition: charybdis.c:963
int anope_event_euid(char *source, int ac, char **av)
Definition: charybdis.c:637
E void pmodule_cmd_svspart(void(*func)(char *source, char *nick, char *chan))
Definition: ircd.c:1056
int anope_event_mode(char *source, int ac, char **av)
Definition: charybdis.c:1547
int anope_event_server(char *source, int ac, char **av)
Definition: charybdis.c:1203
E void do_topic(const char *source, int ac, char **av)
Definition: channels.c:1249
void charybdis_cmd_jupe(char *jserver, char *who, char *reason)
Definition: charybdis.c:1822
#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
int anope_event_sid(char *source, int ac, char **av)
Definition: charybdis.c:1218
int anope_event_svinfo(char *source, int ac, char **av)
Definition: charybdis.c:1719
E void pmodule_cmd_notice2(void(*func)(char *source, char *dest, char *msg))
Definition: ircd.c:798
void charybdis_cmd_372_error(char *source)
Definition: charybdis.c:1257
#define CMODE_z
Definition: charybdis.h:40
E char * RemotePassword
Definition: extern.h:264
#define CAPAB_UID
Definition: services.h:1381
void charybdis_cmd_quit(char *source, char *buf)
Definition: charybdis.c:1496
void charybdis_cmd_unsgline(char *mask)
Definition: charybdis.c:834
E void pmodule_cmd_bot_chan_mode(void(*func)(char *nick, char *chan))
Definition: ircd.c:827
#define UMODE_R
Definition: bahamut.h:42
int anope_event_kick(char *source, int ac, char **av)
Definition: charybdis.c:1126
char nick[NICKMAX]
Definition: services.h:875
E void do_squit(const char *source, int ac, char **av)
Definition: servers.c:398
void charybdis_cmd_pong(char *servname, char *who)
Definition: charybdis.c:1510
E int snprintf(char *buf, size_t size, const char *fmt,...)
Definition: compat.c:37
void charybdis_cmd_unban(char *name, char *nick)
Definition: charybdis.c:1658
void charybdis_cmd_351(char *source)
Definition: charybdis.c:1578
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
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
CMMode myCmmodes[128]
Definition: charybdis.c:270
E char * TS6UPLINK
Definition: extern.h:1159
int anope_event_error(char *source, int ac, char **av)
Definition: charybdis.c:1812
void charybdis_cmd_global_legacy(char *source, char *fmt)
Definition: charybdis.c:546
#define UMODE_w
Definition: bahamut.h:21
#define CBM_MINUS_NO_ARG
Definition: services.h:928
E IRCDVar * ircd
Definition: extern.h:39
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
void charybdis_cmd_serv_privmsg(char *source, char *dest, char *msg)
Definition: charybdis.c:519
E void pmodule_ircd_cmmodes(CMMode modes[128])
Definition: ircd.c:1143
E void do_kick(const char *source, int ac, char **av)
Definition: channels.c:638
void charybdis_cmd_topic(char *whosets, char *chan, char *whosetit, char *topic, time_t when)
Definition: charybdis.c:884
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
E void pmodule_valid_nick(int(*func)(char *nick))
Definition: ircd.c:1082
E void cs_set_limit(ChannelInfo *ci, char *value)
Definition: chanserv.c:2558
void charybdis_cmd_311(char *buf)
Definition: charybdis.c:1306
int anope_event_pass(char *source, int ac, char **av)
Definition: charybdis.c:1725
#define CMODE_F
Definition: charybdis.h:42
void charybdis_cmd_svsadmin(char *server, int set)
Definition: charybdis.c:858
void charybdis_cmd_svshold(char *nick)
Definition: charybdis.c:1620
void charybdis_cmd_317(char *buf)
Definition: charybdis.c:1326
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
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
CBModeInfo myCbmodeinfos[]
Definition: charybdis.c:386
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
void charybdis_cmd_vhost_off(User *u)
Definition: charybdis.c:894
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
void charybdis_cmd_242(char *buf)
Definition: charybdis.c:1372
E void pmodule_cmd_211(void(*func)(char *buf))
Definition: ircd.c:924
void charybdis_cmd_connect(int servernum)
Definition: charybdis.c:1030
int charybdis_flood_mode_check(char *value)
Definition: charybdis.c:1796
int anope_event_nick(char *source, int ac, char **av)
Definition: charybdis.c:594
void charybdis_cmd_svsjoin(char *source, char *nick, char *chan, char *param)
Definition: charybdis.c:1733
E void pmodule_cmd_unsqline(void(*func)(char *user))
Definition: ircd.c:853
void charybdis_cmd_svskill(char *source, char *user, char *buf)
Definition: charybdis.c:945
int anope_event_quit(char *source, int ac, char **av)
Definition: charybdis.c:1238
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
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
#define CMODE_l
Definition: bahamut.h:51
char * name
Definition: services.h:277
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
int charybdis_valid_nick(char *nick)
Definition: charybdis.c:1839
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
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
int anope_event_privmsg(char *source, int ac, char **av)
Definition: charybdis.c:1161
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 charybdis_cmd_svsnick(char *nick, char *newnick, time_t when)
Definition: charybdis.c:1632
void charybdis_cmd_sqline(char *mask, char *reason)
Definition: charybdis.c:825
MDE Message * createMessage(const char *name, int(*func)(char *source, int ac, char **av))
Definition: modules.c:1470
E Uid * find_nickuid(const char *uid)
Definition: users.c:468
void charybdis_cmd_svid_umode2(User *u, char *ts)
Definition: charybdis.c:1685
int anope_event_capab(char *source, int ac, char **av)
Definition: charybdis.c:1586
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
void moduleAddIRCDMsgs(void)
Definition: charybdis.c:772
#define UMODE_g
Definition: bahamut.h:35
#define UMODE_i
Definition: bahamut.h:18
E void pmodule_cmd_svsnoop(void(*func)(char *server, int set))
Definition: ircd.c:696
E void pmodule_cmd_squit(void(*func)(char *servname, char *message))
Definition: ircd.c:944
#define CMODE_n
Definition: bahamut.h:46
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
#define UMODE_s
Definition: bahamut.h:29
void charybdis_set_umode(User *user, int ac, char **av)
Definition: charybdis.c:152
char * uid
Definition: services.h:419
void charybdis_cmd_privmsg(char *source, char *dest, char *buf)
Definition: charybdis.c:489
int anope_event_part(char *source, int ac, char **av)
Definition: charybdis.c:1177
MDE void moduleAddAuthor(const char *author)
Definition: modules.c:1772
E void EnforceQlinedNick(char *nick, char *killer)
Definition: misc.c:837
void charybdis_cmd_bob()
Definition: charybdis.c:1052
void charybdis_cmd_svid_umode3(User *u, char *ts)
Definition: charybdis.c:1690
#define CMODE_t
Definition: bahamut.h:49
void charybdis_cmd_nc_change(User *u)
Definition: charybdis.c:1679
int anope_event_tmode(char *source, int ac, char **av)
Definition: charybdis.c:1570
E char * cs_get_key(ChannelInfo *ci)
Definition: chanserv.c:2447
E void cs_set_redirect(ChannelInfo *ci, char *value)
Definition: chanserv.c:2572
MDE void moduleSetType(MODType type)
Definition: modules.c:818
void charybdis_cmd_pass(char *pass)
Definition: charybdis.c:1015
#define CMODE_j
Definition: bahamut.h:56
E void pmodule_cmd_jupe(void(*func)(char *jserver, char *who, char *reason))
Definition: ircd.c:1072
char * botchanumode
Definition: services.h:299
E void pmodule_cmd_243(void(*func)(char *buf))
Definition: ircd.c:919
void charybdis_cmd_swhois(char *source, char *who, char *mask)
Definition: charybdis.c:1743
int anope_event_join(char *source, int ac, char **av)
Definition: charybdis.c:1139
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
void charybdis_cmd_211(char *buf)
Definition: charybdis.c:1392
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
CBMode myCbmodes[128]
Definition: charybdis.c:320
void charybdis_cmd_vhost_on(char *nick, char *vIdent, char *vhost)
Definition: charybdis.c:900
int anope_event_bmask(char *source, int ac, char **av)
Definition: charybdis.c:1763
E void do_join(const char *source, int ac, char **av)
Definition: channels.c:556
E void * scalloc(long elsize, long els)
Definition: memory.c:55
int charybdis_send_deaccount(int argc, char **argv)
Definition: charybdis.c:1882
E Uid * new_uid(const char *nick, char *uid)
Definition: users.c:435
#define CMODE_Q
Definition: charybdis.h:44
char * uid
Definition: services.h:890
void charybdis_cmd_capab()
Definition: charybdis.c:1008
unsigned long umodes[128]
Definition: charybdis.c:197
E int m_nickcoll(char *user)
Definition: messages.c:20
E char * cs_get_redirect(ChannelInfo *ci)
Definition: chanserv.c:2476
E void pmodule_cmd_375(void(*func)(char *source))
Definition: ircd.c:746
int anope_event_whois(char *source, int ac, char **av)
Definition: charybdis.c:1191
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
E char * s_OperServ
Definition: extern.h:289
void charybdis_cmd_svsnoop(char *server, int set)
Definition: charybdis.c:853
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
E char * ServiceHost
Definition: extern.h:277
E void record_topic(const char *chan)
Definition: chanserv.c:1645
E char * EncModule
Definition: extern.h:580
void charybdis_cmd_312(char *buf)
Definition: charybdis.c:1316
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 cs_set_flood(ChannelInfo *ci, char *value)
Definition: chanserv.c:2500
#define CMODE_r
Definition: bahamut.h:53
E void pmodule_cmd_eob(void(*func)())
Definition: ircd.c:1066
void charybdis_cmd_notice_ops(char *source, char *dest, char *buf)
Definition: charybdis.c:1470
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 charybdis_cmd_notice2(char *source, char *dest, char *msg)
Definition: charybdis.c:478
void charybdis_cmd_svsinfo()
Definition: charybdis.c:982
void charybdis_cmd_guest_nick(char *nick, char *user, char *host, char *real, char *modes)
Definition: charybdis.c:1647
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
int anope_event_topic(char *source, int ac, char **av)
Definition: charybdis.c:657
E int m_kill(char *nick, char *msg)
Definition: messages.c:49
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
void charybdis_cmd_notice(char *source, char *dest, char *buf)
Definition: charybdis.c:458
E void set_flood(Channel *chan, char *value)
Definition: channels.c:1972
MDE void moduleAddVersion(const char *version)
Definition: modules.c:1760
char myCsmodes[128]
Definition: charybdis.c:249
#define UMODE_a
Definition: bahamut.h:16
int AnopeInit(int argc, char **argv)
Definition: charybdis.c:1976
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 charybdis_cmd_tmode(char *source, char *dest, const char *fmt,...)
Definition: charybdis.c:1417
void charybdis_cmd_server(char *servname, int hop, char *descript)
Definition: charybdis.c:1025
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 charybdis_cmd_part(char *nick, char *chan, char *buf)
Definition: charybdis.c:1075
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
#define CMODE_f
Definition: charybdis.h:35
Command * c
Definition: ns_recover.c:17
void charybdis_cmd_svinfo()
Definition: charybdis.c:977
int charybdis_valid_chan(char *chan)
Definition: charybdis.c:1851
void charybdis_cmd_375(char *source)
Definition: charybdis.c:1264
int anope_event_squit(char *source, int ac, char **av)
Definition: charybdis.c:1230
Server * server
Definition: services.h:884
E char * TS6SID
Definition: extern.h:1158
E void alog(const char *fmt,...) FORMAT(printf
E int servernum
Definition: extern.h:615
int anope_event_invite(char *source, int ac, char **av)
Definition: charybdis.c:1758
int anope_event_436(char *source, int ac, char **av)
Definition: charybdis.c:761
void charybdis_cmd_release_svshold(char *nick)
Definition: charybdis.c:1626
E char * get_redirect(Channel *chan)
Definition: channels.c:1894
#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
E char * cs_get_flood(ChannelInfo *ci)
Definition: chanserv.c:2417
E void display_news(User *u, int16 type)
Definition: news.c:269
E Server * findserver(Server *s, const char *name)
Definition: servers.c:261
void charybdis_cmd_376(char *source)
Definition: charybdis.c:1270
void charybdis_cmd_global(char *source, char *buf)
Definition: charybdis.c:525
#define UMODE_z
Definition: charybdis.h:18
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
void charybdis_cmd_squit(char *servname, char *message)
Definition: charybdis.c:1538
CUMode myCumodes[128]
Definition: charybdis.c:409
E void pmodule_ircd_csmodes(char mode[128])
Definition: ircd.c:1151
void charybdis_cmd_372(char *source, char *msg)
Definition: charybdis.c:1252
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
#define EVENT_TOPIC_UPDATED
Definition: events.h:30
E void set_limit(Channel *chan, char *value)
Definition: channels.c:2011
#define CMODE_L
Definition: charybdis.h:43
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
void charybdis_cmd_243(char *buf)
Definition: charybdis.c:1382
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
void charybdis_cmd_318(char *source, char *who)
Definition: charybdis.c:1361
void charybdis_cmd_eob()
Definition: charybdis.c:1134
E void pmodule_cmd_250(void(*func)(char *buf))
Definition: ircd.c:874
char * topic
Definition: services.h:1003
void charybdis_cmd_chg_nick(char *oldnick, char *newnick)
Definition: charybdis.c:1696
E void pmodule_ircd_version(char *version)
Definition: ircd.c:1107
E const char version_number[]
Definition: extern.h:767
E char * get_flood(Channel *chan)
Definition: channels.c:1860
#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_away(char *source, int ac, char **av)
Definition: charybdis.c:1096
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
int anope_event_ping(char *source, int ac, char **av)
Definition: charybdis.c:1088
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
time_t topic_time
Definition: services.h:1005
void charybdis_cmd_privmsg2(char *source, char *dest, char *msg)
Definition: charybdis.c:503
void charybdis_cmd_szline(char *mask, char *reason, char *whom)
Definition: charybdis.c:848
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
int anope_event_tburst(char *source, int ac, char **av)
Definition: charybdis.c:707
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 charybdis_cmd_join(char *user, char *channel, time_t chantime)
Definition: charybdis.c:915
IRCDVar myIrcd[]
Definition: charybdis.c:18
E void add_exception(Channel *chan, char *mask)
Definition: channels.c:1377
int anope_event_motd(char *source, int ac, char **av)
Definition: charybdis.c:1151
#define CAPAB_TS5
Definition: services.h:1374
#define CBM_NO_USER_MLOCK
Definition: services.h:930
#define UMODE_S
Definition: charybdis.h:23
#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
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
E Server * servlist
Definition: extern.h:1051
void charybdis_cmd_kick(char *source, char *chan, char *user, char *buf)
Definition: charybdis.c:1452
Definition: services.h:416
#define CMODE_g
Definition: charybdis.h:39
#define DEFAULT_MLOCK
Definition: bahamut.h:59
void charybdis_cmd_ctcp(char *source, char *dest, char *buf)
Definition: charybdis.c:1858
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
void charybdis_cmd_serv_notice(char *source, char *dest, char *msg)
Definition: charybdis.c:514
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
uint32 mode
Definition: services.h:889
void charybdis_cmd_svsmode_chan(char *name, char *mode, char *nick)
Definition: charybdis.c:1665
E void pmodule_cmd_guest_nick(void(*func)(char *nick, char *user, char *host, char *real, char *modes))
Definition: ircd.c:761
void charybdis_cmd_svso(char *source, char *nick, char *flag)
Definition: charybdis.c:1653
E char * ServerName
Definition: extern.h:274
void charybdis_cmd_nick(char *nick, char *name, char *mode)
Definition: charybdis.c:1435
#define CMODE_c
Definition: bahamut.h:54
void moduleAddAnopeCmds()
Definition: charybdis.c:1894
void charybdis_cmd_akill(char *user, char *host, char *who, time_t when, time_t expires, char *reason)
Definition: charybdis.c:933
E void pmodule_valid_chan(int(*func)(char *chan))
Definition: ircd.c:1087
void charybdis_cmd_sgline(char *mask, char *reason)
Definition: charybdis.c:863
E void pmodule_cmd_privmsg(void(*func)(char *source, char *dest, char *buf))
Definition: ircd.c:804
E void pmodule_cmd_svshold(void(*func)(char *nick))
Definition: ircd.c:981
#define SERVER_ISME
Definition: services.h:865
void charybdis_cmd_unsqline(char *user)
Definition: charybdis.c:906
E void pmodule_cmd_serv_notice(void(*func)(char *source, char *dest, char *msg))
Definition: ircd.c:816
E char * get_key(Channel *chan)
Definition: channels.c:1874
E int m_whois(char *source, char *who)
Definition: messages.c:366
void charybdis_cmd_invite(char *source, char *chan, char *nick)
Definition: charybdis.c:1521
void charybdis_cmd_219(char *source, char *letter)
Definition: charybdis.c:1336
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
time_t timestamp
Definition: services.h:886
E void pmodule_ircd_useTSMode(int use)
Definition: ircd.c:1164
E void pmodule_oper_umode(int mode)
Definition: ircd.c:1176
void charybdis_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes)
Definition: charybdis.c:1057
E Server * new_server(Server *uplink, const char *name, const char *desc, uint16 flags, char *suid)
Definition: servers.c:119
void charybdis_cmd_bot_chan_mode(char *nick, char *chan)
Definition: charybdis.c:1482
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 charybdis_cmd_remove_akill(char *user, char *host)
Definition: charybdis.c:872
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
void charybdis_cmd_391(char *source, char *timestr)
Definition: charybdis.c:1277
void charybdis_cmd_250(char *buf)
Definition: charybdis.c:1286
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
E void pmodule_cmd_mode(void(*func)(char *source, char *dest, char *buf))
Definition: ircd.c:768
#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
int anope_event_sjoin(char *source, int ac, char **av)
Definition: charybdis.c:564
E char * Numeric
Definition: extern.h:362
#define UMODE_Q
Definition: charybdis.h:21
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
E void pmodule_ircd_flood_mode_char_set(char *mode)
Definition: ircd.c:1125
IRCDCAPAB myIrcdcap[]
Definition: charybdis.c:117
#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
int anope_event_admin(char *source, int ac, char **av)
Definition: charybdis.c:1753
E const char version_build[]
Definition: extern.h:769
#define CMODE_s
Definition: bahamut.h:48
#define CUS_OP
Definition: services.h:1341
E char * normalizeBuffer(char *)
Definition: botserv.c:1101
void charybdis_cmd_svid_umode(char *nick, time_t ts)
Definition: charybdis.c:1672
void charybdis_cmd_401(char *source, char *who)
Definition: charybdis.c:1351
int anope_event_kill(char *source, int ac, char **av)
Definition: charybdis.c:1109
#define CMODE_P
Definition: charybdis.h:38
E void anope_cmd_global(char *source, const char *fmt,...)
Definition: ircd.c:506
void charybdis_cmd_unszline(char *mask)
Definition: charybdis.c:843
void charybdis_cmd_307(char *buf)
Definition: charybdis.c:1296
E void pmodule_cmd_global(void(*func)(char *source, char *buf))
Definition: ircd.c:929
#define CUF_PROTECT_BOTSERV
Definition: services.h:956
void charybdis_cmd_svspart(char *source, char *nick, char *chan)
Definition: charybdis.c:1738
#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