Anope IRC Services  Version 1.8
inspircd11.c
Go to the documentation of this file.
1 /* inspircd 1.1 beta 6+ functions
2  *
3  * (C) 2005-2007 Craig Edwards <brain@inspircd.org>
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  */
14 
15 /*************************************************************************/
16 
17 #include "services.h"
18 #include "pseudo.h"
19 #include "inspircd11.h"
20 #include "version.h"
21 
22 #ifndef _WIN32
23 #include <sys/socket.h>
24 #include <netinet/in.h>
25 #include <arpa/inet.h>
26 #endif
27 
28 #ifdef _WIN32
29 #include "winsock.h"
30 int inet_aton(const char *name, struct in_addr *addr)
31 {
32  uint32 a = inet_addr(name);
33  addr->s_addr = a;
34  return a != (uint32) - 1;
35 }
36 #endif
37 
39  {"InspIRCd 1.1", /* ircd name */
40  "+I", /* nickserv mode */
41  "+I", /* chanserv mode */
42  "+I", /* memoserv mode */
43  "+I", /* hostserv mode */
44  "+ioI", /* operserv mode */
45  "+I", /* botserv mode */
46  "+I", /* helpserv mode */
47  "+iI", /* Dev/Null mode */
48  "+iI", /* Global mode */
49  "+I", /* nickserv alias mode */
50  "+I", /* chanserv alias mode */
51  "+I", /* memoserv alias mode */
52  "+I", /* hostserv alias mode */
53  "+ioI", /* operserv alias mode */
54  "+I", /* botserv alias mode */
55  "+I", /* helpserv alias mode */
56  "+iI", /* Dev/Null alias mode */
57  "+iI", /* Global alias mode */
58  "+I", /* Used by BotServ Bots */
59  5, /* Chan Max Symbols */
60  "-cijlmnpstuzACGHKNOQRSV", /* Modes to Remove */
61  "+ao", /* Channel Umode used by Botserv bots */
62  1, /* SVSNICK */
63  1, /* Vhost */
64  1, /* Has Owner */
65  "+q", /* Mode to set for an owner */
66  "-q", /* Mode to unset for an owner */
67  "+a", /* Mode to set for channel admin */
68  "-a", /* Mode to unset for channel admin */
69  "+r", /* Mode On Reg */
70  NULL, /* Mode on ID for Roots */
71  NULL, /* Mode on ID for Admins */
72  NULL, /* Mode on ID for Opers */
73  "-r", /* Mode on UnReg */
74  "-r", /* Mode on Nick Change */
75  1, /* Supports SGlines */
76  1, /* Supports SQlines */
77  1, /* Supports SZlines */
78  1, /* Supports Halfop +h */
79  4, /* Number of server args */
80  0, /* Join 2 Set */
81  1, /* Join 2 Message */
82  0, /* Has exceptions +e */
83  1, /* TS Topic Forward */
84  0, /* TS Topci Backward */
85  0, /* Protected Umode */
86  0, /* Has Admin */
87  0, /* Chan SQlines */
88  0, /* Quit on Kill */
89  0, /* SVSMODE unban */
90  1, /* Has Protect */
91  1, /* Reverse */
92  1, /* Chan Reg */
93  CMODE_r, /* Channel Mode */
94  1, /* vidents */
95  0, /* svshold */
96  0, /* time stamp on mode */
97  0, /* NICKIP */
98  1, /* O:LINE */
99  1, /* UMODE */
100  1, /* VHOST ON NICK */
101  0, /* Change RealName */
102  CMODE_K, /* No Knock */
103  0, /* Admin Only */
104  DEFAULT_MLOCK, /* Default MLOCK */
105  UMODE_x, /* Vhost Mode */
106  0, /* +f */
107  1, /* +L */
108  CMODE_f,
109  CMODE_L,
110  0,
111  1, /* No Knock requires +i */
112  NULL, /* CAPAB Chan Modes */
113  0, /* We support inspircd TOKENS */
114  1, /* TOKENS are CASE inSensitive */
115  0, /* TIME STAMPS are BASE64 */
116  0, /* +I support */
117  0, /* SJOIN ban char */
118  0, /* SJOIN except char */
119  0, /* SJOIN invite char */
120  0, /* Can remove User Channel Modes with SVSMODE */
121  0, /* Sglines are not enforced until user reconnects */
122  "x", /* vhost char */
123  0, /* ts6 */
124  1, /* support helper umode */
125  0, /* p10 */
126  NULL, /* character set */
127  0, /* reports sync state */
128  1, /* CIDR channelbans */
129  1, /* +j */
130  CMODE_j, /* +j Mode */
131  0, /* Use delayed client introduction. */
132  }
133  ,
134  {NULL}
135 };
136 
137 
139  {
140  CAPAB_NOQUIT, /* NOQUIT */
141  0, /* TSMODE */
142  1, /* UNCONNECT */
143  0, /* NICKIP */
144  0, /* SJOIN */
145  0, /* ZIP */
146  0, /* BURST */
147  0, /* TS5 */
148  0, /* TS3 */
149  0, /* DKEY */
150  0, /* PT4 */
151  0, /* SCS */
152  0, /* QS */
153  0, /* UID */
154  0, /* KNOCK */
155  0, /* CLIENT */
156  0, /* IPV6 */
157  0, /* SSJ5 */
158  0, /* SN2 */
159  0, /* TOKEN */
160  0, /* VHOST */
161  CAPAB_SSJ3, /* SSJ3 */
162  CAPAB_NICK2, /* NICK2 */
163  0, /* UMODE2 */
164  CAPAB_VL, /* VL */
165  CAPAB_TLKEXT, /* TLKEXT */
166  0, /* DODKEY */
167  0, /* DOZIP */
168  0,
169  0, 0}
170 };
171 
172 unsigned long umodes[128] = {
173  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
174  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
175  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
176  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
177  0, UMODE_A, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
178  0,
179  0,
180  0,
181  0, 0, 0, 0, 0, 0, 0,
182  0,
183  0, 0, 0, 0, 0,
184  0, UMODE_a, 0, 0, 0, 0, 0,
185  UMODE_g,
186  UMODE_h, UMODE_i, 0, 0, 0, 0, 0, UMODE_o,
187  0,
188  0, UMODE_r, 0, 0, 0, 0, UMODE_w,
189  UMODE_x,
190  0,
191  0,
192  0, 0, 0, 0, 0
193 };
194 
195 
196 char myCsmodes[128] = {
197  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
198  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
199 
200  0,
201  0,
202  0, 0, 0,
203  'h', /* (37) % Channel halfops */
204  'a',
205  0, 0, 0, 0,
206 
207  'v', 0, 0, 0, 0,
208  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
209 
210  'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
211  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
212 
213  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
214  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'q', 0
215 };
216 
218  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
219  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
220  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
221  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
222  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
223  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
224  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
225  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
226  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
227  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
228  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
229  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
230  {NULL},
231  {NULL},
232  {add_ban, del_ban},
233  {NULL},
234  {NULL},
235  {NULL, NULL},
236  {NULL},
237  {NULL},
238  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
239  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
240  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}
241 };
242 
243 
244 
246  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
247  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
248  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
249  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
250  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
251  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
252  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
253  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
254  {0},
255  {CMODE_A, CBM_NO_USER_MLOCK, NULL, NULL},
256  {0}, /* B */
257  {CMODE_C, 0, NULL, NULL}, /* C */
258  {0}, /* D */
259  {0}, /* E */
260  {0}, /* F */
261  {CMODE_G, 0, NULL, NULL}, /* G */
262  {CMODE_H, CBM_NO_USER_MLOCK, NULL, NULL},
263  {0}, /* I */
264  {0}, /* J */
265  {CMODE_K, 0, NULL, NULL}, /* K */
267  {0}, /* M */
268  {CMODE_N, 0, NULL, NULL}, /* N */
269  {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL},
270  {0}, /* P */
271  {CMODE_Q, 0, NULL, NULL}, /* Q */
272  {CMODE_R, 0, NULL, NULL}, /* R */
273  {CMODE_S, 0, NULL, NULL}, /* S */
274  {0}, /* T */
275  {0}, /* U */
276  {CMODE_V, 0, NULL, NULL}, /* V */
277  {0}, /* W */
278  {0}, /* X */
279  {0}, /* Y */
280  {0}, /* Z */
281  {0}, {0}, {0}, {0}, {0}, {0},
282  {0}, /* a */
283  {0}, /* b */
284  {CMODE_c, 0, NULL, NULL},
285  {0}, /* d */
286  {0}, /* e */
287  {0}, /* f */
288  {0}, /* g */
289  {0}, /* h */
290  {CMODE_i, 0, NULL, NULL},
294  {CMODE_m, 0, NULL, NULL},
295  {CMODE_n, 0, NULL, NULL},
296  {0}, /* o */
297  {CMODE_p, 0, NULL, NULL},
298  {0}, /* q */
299  {CMODE_r, CBM_NO_MLOCK, NULL, NULL},
300  {CMODE_s, 0, NULL, NULL},
301  {CMODE_t, 0, NULL, NULL},
302  {CMODE_u, 0, NULL, NULL},
303  {0}, /* v */
304  {0}, /* w */
305  {0}, /* x */
306  {0}, /* y */
307  {CMODE_z, 0, NULL, NULL},
308  {0}, {0}, {0}, {0}
309 };
310 
312  {'f', CMODE_f, 0, NULL, NULL},
313  {'c', CMODE_c, 0, NULL, NULL},
314  {'i', CMODE_i, 0, NULL, NULL},
316  {'k', CMODE_k, 0, get_key, cs_get_key},
318  {'m', CMODE_m, 0, NULL, NULL},
319  {'n', CMODE_n, 0, NULL, NULL},
320  {'p', CMODE_p, 0, NULL, NULL},
321  {'r', CMODE_r, 0, NULL, NULL},
322  {'s', CMODE_s, 0, NULL, NULL},
323  {'t', CMODE_t, 0, NULL, NULL},
324  {'u', CMODE_u, 0, NULL, NULL},
325  {'z', CMODE_z, 0, NULL, NULL},
326  {'A', CMODE_A, 0, NULL, NULL},
327  {'C', CMODE_C, 0, NULL, NULL},
328  {'G', CMODE_G, 0, NULL, NULL},
329  {'H', CMODE_H, 0, NULL, NULL},
330  {'K', CMODE_K, 0, NULL, NULL},
332  {'N', CMODE_N, 0, NULL, NULL},
333  {'O', CMODE_O, 0, NULL, NULL},
334  {'Q', CMODE_Q, 0, NULL, NULL},
335  {'R', CMODE_R, 0, NULL, NULL},
336  {'S', CMODE_S, 0, NULL, NULL},
337  {'V', CMODE_V, 0, NULL, NULL},
338  {0}
339 };
340 
342  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
343  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
344  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
345  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
346 
347  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
348  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
349  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
350  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
351 
352  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
353  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
354  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
355  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
356 
357  {0},
358 
360  {0}, /* b */
361  {0}, /* c */
362  {0}, /* d */
363  {0}, /* e */
364  {0}, /* f */
365  {0}, /* g */
367  {0}, /* i */
368  {0}, /* j */
369  {0}, /* k */
370  {0}, /* l */
371  {0}, /* m */
372  {0}, /* n */
374  {0}, /* p */
376  {0}, /* r */
377  {0}, /* s */
378  {0}, /* t */
379  {0}, /* u */
380  {CUS_VOICE, 0, NULL},
381  {0}, /* w */
382  {0}, /* x */
383  {0}, /* y */
384  {0}, /* z */
385  {0}, {0}, {0}, {0}, {0}
386 };
387 
388 static int has_servicesmod = 0;
389 static int has_globopsmod = 0;
390 
391 /* These are sanity checks to insure we are supported.
392  The ircd tends to /squit us if we issue unsupported cmds.
393  - katsklaw */
394 static int has_svsholdmod = 0;
395 static int has_chghostmod = 0;
396 static int has_chgidentmod = 0;
397 static int has_messagefloodmod = 0;
398 static int has_banexceptionmod = 0;
399 static int has_inviteexceptionmod = 0;
400 
401 void inspircd_set_umode(User * user, int ac, char **av)
402 {
403  int add = 1; /* 1 if adding modes, 0 if deleting */
404  char *modes = av[0];
405 
406  ac--;
407 
408  if (debug)
409  alog("debug: Changing mode for %s to %s", user->nick, modes);
410 
411  while (*modes) {
412 
413  /* This looks better, much better than "add ? (do_add) : (do_remove)".
414  * At least this is readable without paying much attention :) -GD
415  */
416  if (add)
417  user->mode |= umodes[(int) *modes];
418  else
419  user->mode &= ~umodes[(int) *modes];
420 
421  switch (*modes++) {
422  case '+':
423  add = 1;
424  break;
425  case '-':
426  add = 0;
427  break;
428  case 'd':
429  if (ac == 0) {
430  break;
431  }
432 
433  ac--;
434  av++;
435  user->svid = strtoul(*av, NULL, 0);
436  break;
437  case 'o':
438  if (add) {
439  opcnt++;
440  if (WallOper) {
442  "\2%s\2 is now an IRC operator.",
443  user->nick);
444  }
445  display_news(user, NEWS_OPER);
446  } else {
447  opcnt--;
448  }
449  break;
450  case 'a':
451  if (UnRestrictSAdmin) {
452  break;
453  }
454  if (add && !is_services_admin(user)) {
455  common_svsmode(user, "-a", NULL);
456  user->mode &= ~UMODE_a;
457  }
458  break;
459  case 'r':
460  user->svid = (add ? user->timestamp : 0);
461  if (add && !nick_identified(user)) {
462  common_svsmode(user, "-r", NULL);
463  user->mode &= ~UMODE_r;
464  }
465  break;
466  case 'x':
467  update_host(user);
468  break;
469  }
470  }
471 }
472 
473 
474 /* *INDENT-OFF* */
475 void moduleAddIRCDMsgs(void) {
476  Message *m;
477 
478  updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+a","-a");
479 
491  m = createMessage("ENDBURST", anope_event_null); addCoreMessage(IRCD,m);
514  m = createMessage("METADATA", anope_event_null); addCoreMessage(IRCD,m);
527 }
528 
529 /* *INDENT-ON* */
530 
531 void inspircd_cmd_svsnoop(char *server, int set)
532 {
533  /* Not Supported by this IRCD */
534 }
535 
536 void inspircd_cmd_svsadmin(char *server, int set)
537 {
538  /* Not Supported by this IRCD */
539 }
540 
541 void inspircd_cmd_remove_akill(char *user, char *host)
542 {
543  send_cmd(s_OperServ, "GLINE %s@%s", user, host);
544 }
545 
546 void
547 inspircd_cmd_topic(char *whosets, char *chan, char *whosetit,
548  char *topic, time_t when)
549 {
550  send_cmd(whosets, "FTOPIC %s %lu %s :%s", chan,
551  (unsigned long int) when, whosetit, topic);
552 }
553 
555 {
556  send_cmd(s_OperServ, "MODE %s -%s", u->nick, myIrcd->vhostchar);
558 
559  if (has_chgidentmod && u->username && u->vident && strcmp(u->username, u->vident) > 0)
560  {
562  }
563 }
564 
565 void
566 inspircd_cmd_akill(char *user, char *host, char *who, time_t when,
567  time_t expires, char *reason)
568 {
569  send_cmd(ServerName, "ADDLINE G %s@%s %s %ld %ld :%s", user, host, who,
570  (long int) time(NULL), (long int) 86400 * 2, reason);
571 }
572 
573 void inspircd_cmd_svskill(char *source, char *user, char *buf)
574 {
575  if (!buf || !source || !user)
576  return;
577 
578  send_cmd(source, "KILL %s :%s", user, buf);
579 }
580 
581 void inspircd_cmd_svsmode(User * u, int ac, char **av)
582 {
583  /* This was originally done using this:
584  send_cmd(s_NickServ, "MODE %s %s%s%s", u->nick, av[0], (ac == 2 ? " " : ""), (ac == 2 ? av[1] : ""));
585  * but that's the dirty way of doing things...
586  */
587  send_cmd(s_NickServ, "MODE %s %s", u->nick, merge_args(ac, av));
588 }
589 
590 
591 void inspircd_cmd_372(char *source, char *msg)
592 {
593  send_cmd(ServerName, "372 %s :- %s", source, msg);
594 }
595 
596 void inspircd_cmd_372_error(char *source)
597 {
598  send_cmd(ServerName, "422 %s :- MOTD file not found! Please "
599  "contact your IRC administrator.", source);
600 }
601 
602 void inspircd_cmd_375(char *source)
603 {
604  send_cmd(ServerName, "375 %s :- %s Message of the Day",
605  source, ServerName);
606 }
607 
608 void inspircd_cmd_376(char *source)
609 {
610  send_cmd(ServerName, "376 %s :End of /MOTD command.", source);
611 }
612 
613 void inspircd_cmd_nick(char *nick, char *name, char *modes)
614 {
615  /* :test.chatspike.net NICK 1133519355 Brain synapse.brainbox.winbot.co.uk netadmin.chatspike.net ~brain +xwsioS 10.0.0.2 :Craig Edwards */
616  send_cmd(ServerName, "NICK %ld %s %s %s %s +%s 0.0.0.0 :%s",
617  (long int) time(NULL), nick, ServiceHost, ServiceHost,
618  ServiceUser, modes, name);
619  if (strchr(modes, 'o') != NULL)
620  /* Don't send ServerName as the source here... -GD */
621  send_cmd(nick, "OPERTYPE Service");
622 }
623 
624 void
625 inspircd_cmd_guest_nick(char *nick, char *user, char *host,
626  char *real, char *modes)
627 {
628  send_cmd(ServerName, "NICK %ld %s %s %s %s +%s 0.0.0.0 :%s",
629  (long int) time(NULL), nick, host, host, user, modes, real);
630 }
631 
632 void inspircd_cmd_mode(char *source, char *dest, char *buf)
633 {
634  Channel *c;
635  if (!buf) {
636  return;
637  }
638 
639  c = findchan(dest);
640  send_cmd(source ? source : s_OperServ, "FMODE %s %u %s", dest, (unsigned int)((c) ? c->creation_time : time(NULL)), buf);
641 }
642 
643 int anope_event_version(char *source, int ac, char **av)
644 {
645  return MOD_CONT;
646 }
647 
648 int anope_event_idle(char *source, int ac, char **av)
649 {
650  if (ac == 1) {
651  send_cmd(av[0], "IDLE %s %ld 0", source, (long int) time(NULL));
652  }
653  return MOD_CONT;
654 }
655 
656 int anope_event_ftopic(char *source, int ac, char **av)
657 {
658  /* :source FTOPIC channel ts setby :topic */
659  char *temp;
660  if (ac < 4)
661  return MOD_CONT;
662  temp = av[1]; /* temp now holds ts */
663  av[1] = av[2]; /* av[1] now holds set by */
664  av[2] = temp; /* av[2] now holds ts */
665  do_topic(source, ac, av);
666  return MOD_CONT;
667 }
668 
669 int anope_event_opertype(char *source, int ac, char **av)
670 {
671  /* opertype is equivalent to mode +o because servers
672  dont do this directly */
673  User *u;
674  u = finduser(source);
675  if (u && !is_oper(u)) {
676  char *newav[2];
677  newav[0] = source;
678  newav[1] = "+o";
679  return anope_event_mode(source, 2, newav);
680  } else
681  return MOD_CONT;
682 }
683 
684 int anope_event_fmode(char *source, int ac, char **av)
685 {
686  char *newav[128];
687  int n, o;
688  Channel *c;
689 
690  /* :source FMODE #test 12345678 +nto foo */
691  if (ac < 3)
692  return MOD_CONT;
693 
694  /* Checking the TS for validity to avoid desyncs */
695  if ((c = findchan(av[0]))) {
696  if (c->creation_time > strtol(av[1], NULL, 10)) {
697  /* Our TS is bigger, we should lower it */
698  c->creation_time = strtol(av[1], NULL, 10);
699  } else if (c->creation_time < strtol(av[1], NULL, 10)) {
700  /* The TS we got is bigger, we should ignore this message. */
701  return MOD_CONT;
702  }
703  } else {
704  /* Got FMODE for a non-existing channel */
705  return MOD_CONT;
706  }
707 
708  /* TS's are equal now, so we can proceed with parsing */
709  n = o = 0;
710  while (n < ac) {
711  if (n != 1) {
712  newav[o] = av[n];
713  o++;
714  if (debug)
715  alog("Param: %s", newav[o - 1]);
716  }
717  n++;
718  }
719 
720  return anope_event_mode(source, ac - 1, newav);
721 }
722 
723 int anope_event_fjoin(char *source, int ac, char **av)
724 {
725  char *newav[10];
726 
727  /* value used for myStrGetToken */
728  int curtoken = 0;
729 
730  /* storing the current nick */
731  char *curnick;
732 
733  /* these are used to generate the final string that is passed to ircservices' core */
734  int nlen = 0;
735  char nicklist[514];
736 
737  /* temporary buffer */
738  char prefixandnick[60];
739 
740  *nicklist = '\0';
741  *prefixandnick = '\0';
742 
743  if (ac < 3)
744  return MOD_CONT;
745 
746  curnick = myStrGetToken(av[2], ' ', curtoken);
747  while (curnick != NULL) {
748  for (; *curnick; curnick++) {
749  /* I bet theres a better way to do this... */
750  if ((*curnick == '&') ||
751  (*curnick == '~') || (*curnick == '@') || (*curnick == '%')
752  || (*curnick == '+')) {
753  prefixandnick[nlen++] = *curnick;
754  continue;
755  } else {
756  if (*curnick == ',') {
757  curnick++;
758  strncpy(prefixandnick + nlen, curnick,
759  sizeof(prefixandnick) - nlen);
760  break;
761  } else {
762  alog("fjoin: unrecognised prefix: %c", *curnick);
763  }
764  }
765  }
766  strncat(nicklist, prefixandnick, 513);
767  strncat(nicklist, " ", 513);
768  curtoken++;
769  curnick = myStrGetToken(av[2], ' ', curtoken);
770  nlen = 0;
771  }
772 
773  newav[0] = av[1]; /* timestamp */
774  newav[1] = av[0]; /* channel name */
775  newav[2] = "+"; /* channel modes */
776  newav[3] = nicklist;
777  do_sjoin(source, 4, newav);
778 
779  return MOD_CONT;
780 }
781 
782 void
783 inspircd_cmd_bot_nick(char *nick, char *user, char *host, char *real,
784  char *modes)
785 {
786  send_cmd(ServerName, "NICK %ld %s %s %s %s +%s 0.0.0.0 :%s",
787  (long int) time(NULL), nick, host, host, user, modes, real);
788  if (strchr(modes, 'o') != NULL)
789  send_cmd(nick, "OPERTYPE Bot");
790 }
791 
792 void inspircd_cmd_kick(char *source, char *chan, char *user, char *buf)
793 {
794  if (buf) {
795  send_cmd(source, "KICK %s %s :%s", chan, user, buf);
796  } else {
797  send_cmd(source, "KICK %s %s :%s", chan, user, user);
798  }
799 }
800 
801 void inspircd_cmd_notice_ops(char *source, char *dest, char *buf)
802 {
803  if (!buf) {
804  return;
805  }
806 
807  send_cmd(ServerName, "NOTICE @%s :%s", dest, buf);
808 }
809 
810 
811 void inspircd_cmd_notice(char *source, char *dest, char *buf)
812 {
813  if (!buf) {
814  return;
815  }
816 
817  if (NSDefFlags & NI_MSG) {
818  inspircd_cmd_privmsg2(source, dest, buf);
819  } else {
820  send_cmd(source, "NOTICE %s :%s", dest, buf);
821  }
822 }
823 
824 void inspircd_cmd_notice2(char *source, char *dest, char *msg)
825 {
826  send_cmd(source, "NOTICE %s :%s", dest, msg);
827 }
828 
829 void inspircd_cmd_privmsg(char *source, char *dest, char *buf)
830 {
831  if (!buf) {
832  return;
833  }
834 
835  send_cmd(source, "PRIVMSG %s :%s", dest, buf);
836 }
837 
838 void inspircd_cmd_privmsg2(char *source, char *dest, char *msg)
839 {
840  send_cmd(source, "PRIVMSG %s :%s", dest, msg);
841 }
842 
843 void inspircd_cmd_serv_notice(char *source, char *dest, char *msg)
844 {
845  send_cmd(source, "NOTICE $%s :%s", dest, msg);
846 }
847 
848 void inspircd_cmd_serv_privmsg(char *source, char *dest, char *msg)
849 {
850  send_cmd(source, "PRIVMSG $%s :%s", dest, msg);
851 }
852 
853 
854 void inspircd_cmd_bot_chan_mode(char *nick, char *chan)
855 {
856  anope_cmd_mode(nick, chan, "%s %s %s", ircd->botchanumode, nick, nick);
857 }
858 
859 void inspircd_cmd_351(char *source)
860 {
861  send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s",
864 }
865 
866 /* QUIT */
867 void inspircd_cmd_quit(char *source, char *buf)
868 {
869  if (buf) {
870  send_cmd(source, "QUIT :%s", buf);
871  } else {
872  send_cmd(source, "QUIT :Exiting");
873  }
874 }
875 
876 /* PROTOCTL */
878 {
879 }
880 
881 static char currentpass[1024];
882 
883 /* PASS */
884 void inspircd_cmd_pass(char *pass)
885 {
886  strncpy(currentpass, pass, 1024);
887 }
888 
889 /* SERVER services-dev.chatspike.net password 0 :Description here */
890 void inspircd_cmd_server(char *servname, int hop, char *descript)
891 {
892  send_cmd(ServerName, "SERVER %s %s %d :%s", servname, currentpass, hop,
893  descript);
894 }
895 
896 /* PONG */
897 void inspircd_cmd_pong(char *servname, char *who)
898 {
899  send_cmd(servname, "PONG %s", who);
900 }
901 
902 /* JOIN */
903 void inspircd_cmd_join(char *user, char *channel, time_t chantime)
904 {
905  send_cmd(user, "JOIN %s %ld", channel, chantime);
906 }
907 
908 /* UNSQLINE */
909 void inspircd_cmd_unsqline(char *user)
910 {
911  if (!user) {
912  return;
913  }
914  send_cmd(s_OperServ, "QLINE %s", user);
915 }
916 
917 /* CHGHOST */
918 void inspircd_cmd_chghost(char *nick, char *vhost)
919 {
920  if (has_chghostmod == 1) {
921  if (!nick || !vhost) {
922  return;
923  }
924  send_cmd(s_OperServ, "CHGHOST %s %s", nick, vhost);
925  } else {
926  anope_cmd_global(s_OperServ, "CHGHOST not loaded!");
927  }
928 }
929 
930 /* CHGIDENT */
931 void inspircd_cmd_chgident(char *nick, char *vIdent)
932 {
933  if (has_chgidentmod == 1) {
934  if (!nick || !vIdent || !*vIdent) {
935  return;
936  }
937  send_cmd(s_OperServ, "CHGIDENT %s %s", nick, vIdent);
938  } else {
939  anope_cmd_global(s_OperServ, "CHGIDENT not loaded!");
940  }
941 }
942 
943 /* INVITE */
944 void inspircd_cmd_invite(char *source, char *chan, char *nick)
945 {
946  if (!source || !chan || !nick) {
947  return;
948  }
949 
950  send_cmd(source, "INVITE %s %s", nick, chan);
951 }
952 
953 /* PART */
954 void inspircd_cmd_part(char *nick, char *chan, char *buf)
955 {
956  if (!nick || !chan) {
957  return;
958  }
959 
960  if (buf) {
961  send_cmd(nick, "PART %s :%s", chan, buf);
962  } else {
963  send_cmd(nick, "PART %s :Leaving", chan);
964  }
965 }
966 
967 /* 391 */
968 void inspircd_cmd_391(char *source, char *timestr)
969 {
970  if (!timestr) {
971  return;
972  }
973  send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr);
974 }
975 
976 /* 250 */
977 void inspircd_cmd_250(char *buf)
978 {
979  if (!buf) {
980  return;
981  }
982 
983  send_cmd(NULL, "250 %s", buf);
984 }
985 
986 /* 307 */
987 void inspircd_cmd_307(char *buf)
988 {
989  if (!buf) {
990  return;
991  }
992 
993  send_cmd(ServerName, "307 %s", buf);
994 }
995 
996 /* 311 */
997 void inspircd_cmd_311(char *buf)
998 {
999  if (!buf) {
1000  return;
1001  }
1002 
1003  send_cmd(ServerName, "311 %s", buf);
1004 }
1005 
1006 /* 312 */
1007 void inspircd_cmd_312(char *buf)
1008 {
1009  if (!buf) {
1010  return;
1011  }
1012 
1013  send_cmd(ServerName, "312 %s", buf);
1014 }
1015 
1016 /* 317 */
1017 void inspircd_cmd_317(char *buf)
1018 {
1019  if (!buf) {
1020  return;
1021  }
1022 
1023  send_cmd(ServerName, "317 %s", buf);
1024 }
1025 
1026 /* 219 */
1027 void inspircd_cmd_219(char *source, char *letter)
1028 {
1029  if (!source) {
1030  return;
1031  }
1032 
1033  if (letter) {
1034  send_cmd(NULL, "219 %s %c :End of /STATS report.", source,
1035  *letter);
1036  } else {
1037  send_cmd(NULL, "219 %s l :End of /STATS report.", source);
1038  }
1039 }
1040 
1041 /* 401 */
1042 void inspircd_cmd_401(char *source, char *who)
1043 {
1044  if (!source || !who) {
1045  return;
1046  }
1047  send_cmd(ServerName, "401 %s %s :No such service.", source, who);
1048 }
1049 
1050 /* 318 */
1051 void inspircd_cmd_318(char *source, char *who)
1052 {
1053  if (!source || !who) {
1054  return;
1055  }
1056 
1057  send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who);
1058 }
1059 
1060 /* 242 */
1061 void inspircd_cmd_242(char *buf)
1062 {
1063  if (!buf) {
1064  return;
1065  }
1066 
1067  send_cmd(NULL, "242 %s", buf);
1068 }
1069 
1070 /* 243 */
1071 void inspircd_cmd_243(char *buf)
1072 {
1073  if (!buf) {
1074  return;
1075  }
1076 
1077  send_cmd(NULL, "243 %s", buf);
1078 }
1079 
1080 /* 211 */
1081 void inspircd_cmd_211(char *buf)
1082 {
1083  if (!buf) {
1084  return;
1085  }
1086 
1087  send_cmd(NULL, "211 %s", buf);
1088 }
1089 
1090 /* GLOBOPS */
1091 void inspircd_cmd_global(char *source, char *buf)
1092 {
1093  if (!buf) {
1094  return;
1095  }
1096 
1097  send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf);
1098 }
1099 
1100 /* SQLINE */
1101 void inspircd_cmd_sqline(char *mask, char *reason)
1102 {
1103  if (!mask || !reason) {
1104  return;
1105  }
1106 
1107  send_cmd(ServerName, "ADDLINE Q %s %s %ld 0 :%s", mask, s_OperServ,
1108  (long int) time(NULL), reason);
1109 }
1110 
1111 /* SQUIT */
1112 void inspircd_cmd_squit(char *servname, char *message)
1113 {
1114  if (!servname || !message) {
1115  return;
1116  }
1117 
1118  send_cmd(ServerName, "SQUIT %s :%s", servname, message);
1119 }
1120 
1121 /* SVSO */
1122 void inspircd_cmd_svso(char *source, char *nick, char *flag)
1123 {
1124 }
1125 
1126 /* NICK <newnick> */
1127 void inspircd_cmd_chg_nick(char *oldnick, char *newnick)
1128 {
1129  if (!oldnick || !newnick) {
1130  return;
1131  }
1132 
1133  send_cmd(oldnick, "NICK %s", newnick);
1134 }
1135 
1136 /* SVSNICK */
1137 void inspircd_cmd_svsnick(char *source, char *guest, time_t when)
1138 {
1139  if (!source || !guest) {
1140  return;
1141  }
1142  /* Please note that inspircd will now echo back a nickchange for this SVSNICK */
1143  send_cmd(ServerName, "SVSNICK %s %s :%lu", source, guest,
1144  (unsigned long) when);
1145 }
1146 
1147 /* Functions that use serval cmd functions */
1148 
1149 void inspircd_cmd_vhost_on(char *nick, char *vIdent, char *vhost)
1150 {
1151  if (!nick) {
1152  return;
1153  }
1154  if (vIdent) {
1155  inspircd_cmd_chgident(nick, vIdent);
1156  }
1157  inspircd_cmd_chghost(nick, vhost);
1158 }
1159 
1161 {
1162  if (servernum == 1) {
1164  }
1165  if (servernum == 2) {
1167  }
1168  if (servernum == 3) {
1170  }
1172  send_cmd(NULL, "BURST");
1173  send_cmd(ServerName, "VERSION :Anope-%s %s :%s - %s (%s) -- %s",
1176 
1177  me_server =
1179 }
1180 
1182 {
1183  /* Not used */
1184 }
1185 
1186 /* Events */
1187 
1188 int anope_event_ping(char *source, int ac, char **av)
1189 {
1190  if (ac < 1)
1191  return MOD_CONT;
1192  /* ((ac > 1) ? av[1] : ServerName) */
1193  inspircd_cmd_pong(ServerName, av[0]);
1194  return MOD_CONT;
1195 }
1196 
1197 int anope_event_436(char *source, int ac, char **av)
1198 {
1199  if (ac < 1)
1200  return MOD_CONT;
1201 
1202  m_nickcoll(av[0]);
1203  return MOD_CONT;
1204 }
1205 
1206 int anope_event_away(char *source, int ac, char **av)
1207 {
1208  if (!source) {
1209  return MOD_CONT;
1210  }
1211  m_away(source, (ac ? av[0] : NULL));
1212  return MOD_CONT;
1213 }
1214 
1215 /* Taken from hybrid.c, topic syntax is identical */
1216 
1217 int anope_event_topic(char *source, int ac, char **av)
1218 {
1219  Channel *c = findchan(av[0]);
1220  time_t topic_time = time(NULL);
1221 
1222  if (!c) {
1223  if (debug) {
1224  alog("debug: TOPIC %s for nonexistent channel %s",
1225  merge_args(ac - 1, av + 1), av[0]);
1226  }
1227  return MOD_CONT;
1228  }
1229 
1230  if (check_topiclock(c, topic_time))
1231  return MOD_CONT;
1232 
1233  if (c->topic) {
1234  free(c->topic);
1235  c->topic = NULL;
1236  }
1237  if (ac > 1 && *av[1])
1238  c->topic = sstrdup(av[1]);
1239 
1240  strscpy(c->topic_setter, source, sizeof(c->topic_setter));
1241  c->topic_time = topic_time;
1242 
1243  record_topic(av[0]);
1244 
1245  if (ac > 1 && *av[1])
1246  send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[1]);
1247  else
1248  send_event(EVENT_TOPIC_UPDATED, 2, av[0], "");
1249 
1250  return MOD_CONT;
1251 }
1252 
1253 int anope_event_squit(char *source, int ac, char **av)
1254 {
1255  if (ac != 2)
1256  return MOD_CONT;
1257  do_squit(source, ac, av);
1258  return MOD_CONT;
1259 }
1260 
1261 int anope_event_rsquit(char *source, int ac, char **av)
1262 {
1263  if (ac < 1 || ac > 3)
1264  return MOD_CONT;
1265 
1266  /* Horrible workaround to an insp bug (#) in how RSQUITs are sent - mark */
1267  if (ac > 1 && strcmp(ServerName, av[0]) == 0)
1268  do_squit(source, ac - 1, av + 1);
1269  else
1270  do_squit(source, ac, av);
1271 
1272  return MOD_CONT;
1273 }
1274 
1275 int anope_event_quit(char *source, int ac, char **av)
1276 {
1277  if (ac != 1)
1278  return MOD_CONT;
1279  do_quit(source, ac, av);
1280  return MOD_CONT;
1281 }
1282 
1283 
1284 int anope_event_mode(char *source, int ac, char **av)
1285 {
1286  if (ac < 2)
1287  return MOD_CONT;
1288 
1289  if (*av[0] == '#' || *av[0] == '&') {
1290  do_cmode(source, ac, av);
1291  } else {
1292  /* InspIRCd lets opers change another
1293  users modes, we have to kludge this
1294  as it slightly breaks RFC1459
1295  */
1296  if (!strcasecmp(source, av[0])) {
1297  do_umode(source, ac, av);
1298  } else {
1299  do_umode(av[0], ac, av);
1300  }
1301  }
1302  return MOD_CONT;
1303 }
1304 
1305 
1306 int anope_event_kill(char *source, int ac, char **av)
1307 {
1308  if (ac != 2)
1309  return MOD_CONT;
1310 
1311  m_kill(av[0], av[1]);
1312  return MOD_CONT;
1313 }
1314 
1315 int anope_event_kick(char *source, int ac, char **av)
1316 {
1317  if (ac != 3)
1318  return MOD_CONT;
1319  do_kick(source, ac, av);
1320  return MOD_CONT;
1321 }
1322 
1323 
1324 int anope_event_join(char *source, int ac, char **av)
1325 {
1326  if (ac != 2)
1327  return MOD_CONT;
1328  do_join(source, ac, av);
1329  return MOD_CONT;
1330 }
1331 
1332 int anope_event_motd(char *source, int ac, char **av)
1333 {
1334  if (!source) {
1335  return MOD_CONT;
1336  }
1337 
1338  m_motd(source);
1339  return MOD_CONT;
1340 }
1341 
1342 int anope_event_setname(char *source, int ac, char **av)
1343 {
1344  User *u;
1345 
1346  if (ac != 1)
1347  return MOD_CONT;
1348 
1349  u = finduser(source);
1350  if (!u) {
1351  if (debug) {
1352  alog("debug: SETNAME for nonexistent user %s", source);
1353  }
1354  return MOD_CONT;
1355  }
1356 
1357  change_user_realname(u, av[0]);
1358  return MOD_CONT;
1359 }
1360 
1361 int anope_event_chgname(char *source, int ac, char **av)
1362 {
1363  User *u;
1364 
1365  if (ac != 2)
1366  return MOD_CONT;
1367 
1368  u = finduser(source);
1369  if (!u) {
1370  if (debug) {
1371  alog("debug: FNAME for nonexistent user %s", source);
1372  }
1373  return MOD_CONT;
1374  }
1375 
1376  change_user_realname(u, av[0]);
1377  return MOD_CONT;
1378 }
1379 
1380 int anope_event_setident(char *source, int ac, char **av)
1381 {
1382  User *u;
1383 
1384  if (ac != 1)
1385  return MOD_CONT;
1386 
1387  u = finduser(source);
1388  if (!u) {
1389  if (debug) {
1390  alog("debug: SETIDENT for nonexistent user %s", source);
1391  }
1392  return MOD_CONT;
1393  }
1394 
1395  change_user_username(u, av[0]);
1396  return MOD_CONT;
1397 }
1398 
1399 int anope_event_chgident(char *source, int ac, char **av)
1400 {
1401  User *u;
1402 
1403  if (ac != 2)
1404  return MOD_CONT;
1405 
1406  u = finduser(av[0]);
1407  if (!u) {
1408  if (debug) {
1409  alog("debug: CHGIDENT for nonexistent user %s", av[0]);
1410  }
1411  return MOD_CONT;
1412  }
1413 
1414  change_user_username(u, av[1]);
1415  return MOD_CONT;
1416 }
1417 
1418 int anope_event_sethost(char *source, int ac, char **av)
1419 {
1420  User *u;
1421 
1422  if (ac != 1)
1423  return MOD_CONT;
1424 
1425  u = finduser(source);
1426  if (!u) {
1427  if (debug) {
1428  alog("debug: SETHOST for nonexistent user %s", source);
1429  }
1430  return MOD_CONT;
1431  }
1432 
1433  change_user_host(u, av[0]);
1434  return MOD_CONT;
1435 }
1436 
1437 
1438 int anope_event_nick(char *source, int ac, char **av)
1439 {
1440  User *user;
1441  struct in_addr addy;
1442  uint32 *ad = (uint32 *) & addy;
1443 
1444  if (ac != 1) {
1445  if (ac == 8) {
1446  int svid = 0;
1447  int ts = strtoul(av[0], NULL, 10);
1448 
1449  if (strchr(av[5], 'r') != NULL)
1450  svid = ts;
1451 
1452  inet_aton(av[6], &addy);
1453  user = do_nick("", av[1], /* nick */
1454  av[4], /* username */
1455  av[2], /* realhost */
1456  source, /* server */
1457  av[7], /* realname */
1458  ts, svid, htonl(*ad), av[3], NULL);
1459  if (user)
1460  anope_set_umode(user, 1, &av[5]);
1461  }
1462  } else {
1463  do_nick(source, av[0], NULL, NULL, NULL, NULL, 0, 0, 0, NULL,
1464  NULL);
1465  }
1466  return MOD_CONT;
1467 }
1468 
1469 
1470 int anope_event_chghost(char *source, int ac, char **av)
1471 {
1472  User *u;
1473 
1474  if (ac != 1)
1475  return MOD_CONT;
1476 
1477  u = finduser(source);
1478  if (!u) {
1479  if (debug) {
1480  alog("debug: FHOST for nonexistent user %s", source);
1481  }
1482  return MOD_CONT;
1483  }
1484 
1485  change_user_host(u, av[0]);
1486  return MOD_CONT;
1487 }
1488 
1489 /* EVENT: SERVER */
1490 int anope_event_server(char *source, int ac, char **av)
1491 {
1492  if (!stricmp(av[1], "1")) {
1493  uplink = sstrdup(av[0]);
1494  }
1495  do_server(source, av[0], av[1], av[2], NULL);
1496  return MOD_CONT;
1497 }
1498 
1499 
1500 int anope_event_privmsg(char *source, int ac, char **av)
1501 {
1502  if (ac != 2)
1503  return MOD_CONT;
1504  m_privmsg(source, av[0], av[1]);
1505  return MOD_CONT;
1506 }
1507 
1508 int anope_event_part(char *source, int ac, char **av)
1509 {
1510  if (ac < 1 || ac > 2)
1511  return MOD_CONT;
1512  do_part(source, ac, av);
1513  return MOD_CONT;
1514 }
1515 
1516 int anope_event_whois(char *source, int ac, char **av)
1517 {
1518  if (source && ac >= 1) {
1519  m_whois(source, av[0]);
1520  }
1521  return MOD_CONT;
1522 }
1523 
1524 int anope_event_capab(char *source, int ac, char **av)
1525 {
1526  int argc;
1527  char **argv;
1528  CBModeInfo *cbmi;
1529 
1530  if (strcasecmp(av[0], "START") == 0) {
1531  /* reset CAPAB */
1532  has_servicesmod = 0;
1533  has_globopsmod = 0;
1534  has_svsholdmod = 0;
1535  has_chghostmod = 0;
1536  has_chgidentmod = 0;
1537 
1538  } else if (strcasecmp(av[0], "MODULES") == 0) {
1539  if (strstr(av[1], "m_globops.so")) {
1540  has_globopsmod = 1;
1541  }
1542  if (strstr(av[1], "m_services.so")) {
1543  has_servicesmod = 1;
1544  }
1545  if (strstr(av[1], "m_svshold.so")) {
1546  has_svsholdmod = 1;
1547  }
1548  if (strstr(av[1], "m_chghost.so")) {
1549  has_chghostmod = 1;
1550  }
1551  if (strstr(av[1], "m_chgident.so")) {
1552  has_chgidentmod = 1;
1553  }
1554  if (strstr(av[1], "m_messageflood.so")) {
1555  has_messagefloodmod = 1;
1556  }
1557  if (strstr(av[1], "m_banexception.so")) {
1558  has_banexceptionmod = 1;
1559  }
1560  if (strstr(av[1], "m_inviteexception.so")) {
1562  }
1563  } else if (strcasecmp(av[0], "END") == 0) {
1564  if (!has_globopsmod) {
1565  send_cmd(NULL,
1566  "ERROR :m_globops is not loaded. This is required by Anope");
1567  quitmsg = "Remote server does not have the m_globops module loaded, and this is required.";
1568  quitting = 1;
1569  return MOD_STOP;
1570  }
1571  if (!has_servicesmod) {
1572  send_cmd(NULL,
1573  "ERROR :m_services is not loaded. This is required by Anope");
1574  quitmsg = "Remote server does not have the m_services module loaded, and this is required.";
1575  quitting = 1;
1576  return MOD_STOP;
1577  }
1578  if (!has_svsholdmod) {
1579  anope_cmd_global(s_OperServ, "SVSHOLD missing, Usage disabled until module is loaded.");
1580  }
1581  if (!has_chghostmod) {
1582  anope_cmd_global(s_OperServ, "CHGHOST missing, Usage disabled until module is loaded.");
1583  }
1584  if (!has_chgidentmod) {
1585  anope_cmd_global(s_OperServ, "CHGIDENT missing, Usage disabled until module is loaded.");
1586  }
1587  if (has_messagefloodmod) {
1588  cbmi = myCbmodeinfos;
1589 
1590  /* Find 'f' in myCbmodeinfos and add the relevant bits to myCbmodes and myCbmodeinfos
1591  * to enable +f support if found. This is needed because we're really not set up to
1592  * handle modular ircds which can have modes enabled/disabled as they please :( - mark
1593  */
1594  while ((cbmi->mode != 'f')) {
1595  cbmi++;
1596  }
1597  if (cbmi) {
1598  cbmi->getvalue = get_flood;
1599  cbmi->csgetvalue = cs_get_flood;
1600 
1601  myCbmodes['f'].flag = CMODE_f;
1602  myCbmodes['f'].flags = 0;
1603  myCbmodes['f'].setvalue = set_flood;
1604  myCbmodes['f'].cssetvalue = cs_set_flood;
1605 
1606  pmodule_ircd_cbmodeinfos(myCbmodeinfos);
1607  pmodule_ircd_cbmodes(myCbmodes);
1608 
1609  ircd->fmode = 1;
1610  }
1611  else {
1612  alog("Support for channelmode +f can not be enabled");
1613  if (debug) {
1614  alog("debug: 'f' missing from myCbmodeinfos");
1615  }
1616  }
1617  }
1618  if (has_banexceptionmod) {
1619  myCmmodes['e'].addmask = add_exception;
1620  myCmmodes['e'].delmask = del_exception;
1621  ircd->except = 1;
1622  }
1623  if (has_inviteexceptionmod) {
1624  myCmmodes['I'].addmask = add_invite;
1625  myCmmodes['I'].delmask = del_invite;
1626  ircd->invitemode = 1;
1627  }
1629 
1631  pmodule_ircd_cmmodes(myCmmodes);
1632  }
1633 
1634  /* Generate a fake capabs parsing call so things like NOQUIT work
1635  * fine. It's ugly, but it works....
1636  */
1637  argc = 6;
1638  argv = scalloc(argc, sizeof(char *));
1639  argv[0] = "NOQUIT";
1640  argv[1] = "SSJ3";
1641  argv[2] = "NICK2";
1642  argv[3] = "VL";
1643  argv[4] = "TLKEXT";
1644  argv[5] = "UNCONNECT";
1645 
1646  capab_parse(argc, argv);
1647  }
1648  return MOD_CONT;
1649 }
1650 
1651 /* SVSHOLD - set */
1652 void inspircd_cmd_svshold(char *nick)
1653 {
1654  send_cmd(s_OperServ, "SVSHOLD %s %ds :%s", nick, NSReleaseTimeout,
1655  "Being held for registered user");
1656 }
1657 
1658 /* SVSHOLD - release */
1660 {
1661  send_cmd(s_OperServ, "SVSHOLD %s", nick);
1662 }
1663 
1664 /* UNSGLINE */
1665 void inspircd_cmd_unsgline(char *mask)
1666 {
1667  /* Not Supported by this IRCD */
1668 }
1669 
1670 /* UNSZLINE */
1671 void inspircd_cmd_unszline(char *mask)
1672 {
1673  send_cmd(s_OperServ, "ZLINE %s", mask);
1674 }
1675 
1676 /* SZLINE */
1677 void inspircd_cmd_szline(char *mask, char *reason, char *whom)
1678 {
1679  send_cmd(ServerName, "ADDLINE Z %s %s %ld 0 :%s", mask, whom,
1680  (long int) time(NULL), reason);
1681 }
1682 
1683 /* SGLINE */
1684 void inspircd_cmd_sgline(char *mask, char *reason)
1685 {
1686  /* Not Supported by this IRCD */
1687 }
1688 
1689 void inspircd_cmd_unban(char *name, char *nick)
1690 {
1691  /* Not Supported by this IRCD */
1692 }
1693 
1694 /* SVSMODE channel modes */
1695 
1696 void inspircd_cmd_svsmode_chan(char *name, char *mode, char *nick)
1697 {
1698  /* Not Supported by this IRCD */
1699 }
1700 
1701 
1702 /* SVSMODE +d */
1703 /* sent if svid is something weird */
1704 void inspircd_cmd_svid_umode(char *nick, time_t ts)
1705 {
1706  if (debug)
1707  alog("debug: common_svsmode(0)");
1708 }
1709 
1710 /* SVSMODE +d */
1711 /* nc_change was = 1, and there is no na->status */
1713 {
1714  if (debug)
1715  alog("debug: common_svsmode(1)");
1716  common_svsmode(u, "-r", NULL);
1717 }
1718 
1719 /* SVSMODE +r */
1720 void inspircd_cmd_svid_umode2(User * u, char *ts)
1721 {
1722  if (debug)
1723  alog("debug: common_svsmode(2)");
1724  common_svsmode(u, "+r", NULL);
1725 }
1726 
1727 void inspircd_cmd_svid_umode3(User * u, char *ts)
1728 {
1729  /* not used */
1730 }
1731 
1732 void inspircd_cmd_svsjoin(char *source, char *nick, char *chan, char *param)
1733 {
1734  send_cmd(source, "SVSJOIN %s %s", nick, chan);
1735 }
1736 
1737 void inspircd_cmd_svspart(char *source, char *nick, char *chan)
1738 {
1739  send_cmd(source, "SVSPART %s %s", nick, chan);
1740 }
1741 
1742 void inspircd_cmd_swhois(char *source, char *who, char *mask)
1743 {
1744  /* Not used currently */
1745 }
1746 
1748 {
1749  send_cmd(NULL, "ENDBURST");
1750 }
1751 
1752 
1753 int anope_event_rehash(char *source, int ac, char **av)
1754 {
1755  return MOD_CONT;
1756 }
1757 
1758 int anope_event_credits(char *source, int ac, char **av)
1759 {
1760  return MOD_CONT;
1761 }
1762 
1763 int anope_event_admin(char *source, int ac, char **av)
1764 {
1765  return MOD_CONT;
1766 }
1767 
1769 {
1770  char *dp, *end;
1771 
1772  if (value && *value != ':'
1773  && (strtoul((*value == '*' ? value + 1 : value), &dp, 10) > 0)
1774  && (*dp == ':') && (*(++dp) != 0) && (strtoul(dp, &end, 10) > 0)
1775  && (*end == 0)) {
1776  return 1;
1777  } else {
1778  return 0;
1779  }
1780 }
1781 
1782 void inspircd_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  inspircd_cmd_squit(jserver, rbuf);
1791  inspircd_cmd_server(jserver, 1, rbuf);
1792  new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL);
1793 }
1794 
1795 /* GLOBOPS - to handle old WALLOPS */
1796 void inspircd_cmd_global_legacy(char *source, char *fmt)
1797 {
1798  send_cmd(source ? source : s_OperServ, "GLOBOPS :%s", fmt);
1799 }
1800 
1801 int inspircd_valid_nick(char *nick)
1802 {
1803  return 1;
1804 }
1805 
1806 int inspircd_valid_chan(char *chan)
1807 {
1808  return 1;
1809 }
1810 
1811 
1812 void inspircd_cmd_ctcp(char *source, char *dest, char *buf)
1813 {
1814  char *s;
1815 
1816  if (!buf) {
1817  return;
1818  } else {
1819  s = normalizeBuffer(buf);
1820  }
1821 
1822  send_cmd(source, "NOTICE %s :\1%s\1", dest, s);
1823  free(s);
1824 }
1825 
1826 
1828 {
1829  char *tempValue, *one, *two;
1830  int param1 = 0;
1831  int param2 = 0;
1832 
1833  if (!value)
1834  return 0;
1835 
1836  tempValue = sstrdup(value);
1837  one = strtok(tempValue, ":");
1838  two = strtok(NULL, "");
1839  if (one && two) {
1840  param1 = atoi(one);
1841  param2 = atoi(two);
1842  }
1843  if ((param1 >= 1) && (param1 <= 255) && (param2 >= 1) && (param2 <= 999))
1844  return 1;
1845  return 0;
1846 }
1847 
1848 
1854 {
1931 }
1932 
1936 int AnopeInit(int argc, char **argv)
1937 {
1938 
1939  moduleAddAuthor("Anope");
1941  (VERSION_STRING);
1943 
1944  pmodule_ircd_version("inspircdIRCd 1.1");
1945  pmodule_ircd_cap(myIrcdcap);
1946  pmodule_ircd_var(myIrcd);
1947  pmodule_ircd_cbmodeinfos(myCbmodeinfos);
1948  pmodule_ircd_cumodes(myCumodes);
1951  pmodule_ircd_cbmodes(myCbmodes);
1952  pmodule_ircd_cmmodes(myCmmodes);
1955 
1965 
1968 
1969  return MOD_CONT;
1970 }
1971 
E int is_oper(User *user)
Definition: users.c:937
E void pmodule_cmd_vhost_off(void(*func)(User *u))
Definition: ircd.c:713
void inspircd_cmd_svid_umode2(User *u, char *ts)
Definition: inspircd11.c:1720
E char * quitmsg
Definition: extern.h:792
void inspircd_cmd_sgline(char *mask, char *reason)
Definition: inspircd11.c:1684
E void pmodule_permchan_mode(int mode)
Definition: ircd.c:1206
E void set_redirect(Channel *chan, char *value)
Definition: channels.c:2022
IRCDCAPAB myIrcdcap[]
Definition: inspircd11.c:138
void inspircd_cmd_protoctl()
Definition: inspircd11.c:877
int inspircd_valid_chan(char *chan)
Definition: inspircd11.c:1806
E int32 opcnt
Definition: extern.h:1140
void moduleAddAnopeCmds()
Definition: inspircd11.c:1853
E char * RemotePassword3
Definition: extern.h:270
void inspircd_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes)
Definition: inspircd11.c:783
int anope_event_rehash(char *source, int ac, char **av)
Definition: inspircd11.c:1753
E void pmodule_cmd_svspart(void(*func)(char *source, char *nick, char *chan))
Definition: ircd.c:1056
int anope_event_server(char *source, int ac, char **av)
Definition: inspircd11.c:1490
void inspircd_cmd_242(char *buf)
Definition: inspircd11.c:1061
E void do_topic(const char *source, int ac, char **av)
Definition: channels.c:1249
void(* cssetvalue)(ChannelInfo *ci, char *value)
Definition: services.h:925
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
#define CMODE_z
Definition: charybdis.h:40
E char * RemotePassword
Definition: extern.h:264
int anope_event_whois(char *source, int ac, char **av)
Definition: inspircd11.c:1516
void inspircd_cmd_312(char *buf)
Definition: inspircd11.c:1007
int anope_event_rsquit(char *source, int ac, char **av)
Definition: inspircd11.c:1261
static int has_servicesmod
Definition: inspircd11.c:388
E void pmodule_cmd_bot_chan_mode(void(*func)(char *nick, char *chan))
Definition: ircd.c:827
void inspircd_cmd_243(char *buf)
Definition: inspircd11.c:1071
void inspircd_cmd_vhost_on(char *nick, char *vIdent, char *vhost)
Definition: inspircd11.c:1149
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
#define CMODE_H
Definition: inspircd11.h:36
uint32 flag
Definition: services.h:920
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
int anope_event_away(char *source, int ac, char **av)
Definition: inspircd11.c:1206
E void cs_set_throttle(ChannelInfo *ci, char *value)
Definition: chanserv.c:2520
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
void inspircd_cmd_311(char *buf)
Definition: inspircd11.c:997
void inspircd_cmd_svid_umode(char *nick, time_t ts)
Definition: inspircd11.c:1704
#define UMODE_w
Definition: bahamut.h:21
#define CBM_MINUS_NO_ARG
Definition: services.h:928
E void change_user_username(User *user, const char *username)
Definition: users.c:170
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
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
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
#define CAPAB_NOQUIT
Definition: services.h:1366
E void cs_set_limit(ChannelInfo *ci, char *value)
Definition: chanserv.c:2558
int anope_event_setident(char *source, int ac, char **av)
Definition: inspircd11.c:1380
void inspircd_cmd_chghost(char *nick, char *vhost)
Definition: inspircd11.c:918
void inspircd_cmd_guest_nick(char *nick, char *user, char *host, char *real, char *modes)
Definition: inspircd11.c:625
E int nick_identified(User *u)
Definition: nickserv.c:1111
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 inspircd_cmd_release_svshold(char *nick)
Definition: inspircd11.c:1659
unsigned long umodes[128]
Definition: inspircd11.c:172
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
#define CBM_NO_MLOCK
Definition: services.h:929
void inspircd_cmd_chgident(char *nick, char *vIdent)
Definition: inspircd11.c:931
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
void inspircd_cmd_remove_akill(char *user, char *host)
Definition: inspircd11.c:541
E void pmodule_cmd_unsqline(void(*func)(char *user))
Definition: ircd.c:853
void inspircd_cmd_318(char *source, char *who)
Definition: inspircd11.c:1051
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
char *(* csgetvalue)(ChannelInfo *ci)
Definition: services.h:939
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
void inspircd_cmd_invite(char *source, char *chan, char *nick)
Definition: inspircd11.c:944
#define CMODE_l
Definition: bahamut.h:51
char * name
Definition: services.h:277
#define CMODE_N
Definition: inspircd11.h:48
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 inspircd_cmd_global_legacy(char *source, char *fmt)
Definition: inspircd11.c:1796
void inspircd_cmd_372(char *source, char *msg)
Definition: inspircd11.c:591
void inspircd_cmd_global(char *source, char *buf)
Definition: inspircd11.c:1091
E char * ServerDesc
Definition: extern.h:275
E void pmodule_cmd_bob(void(*func)())
Definition: ircd.c:976
#define CMODE_C
Definition: inspircd11.h:45
uint16 flags
Definition: services.h:921
E void pmodule_ircd_flood_mode_char_remove(char *mode)
Definition: ircd.c:1130
void inspircd_cmd_250(char *buf)
Definition: inspircd11.c:977
E void del_invite(Channel *chan, char *mask)
Definition: channels.c:1833
uint32 svid
Definition: services.h:888
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
int anope_event_chgident(char *source, int ac, char **av)
Definition: inspircd11.c:1399
char * host
Definition: services.h:878
E void pmodule_ircd_var(IRCDVar *ircdvar)
Definition: ircd.c:1097
static int has_banexceptionmod
Definition: inspircd11.c:398
E void do_umode(const char *source, int ac, char **av)
Definition: users.c:816
void inspircd_cmd_391(char *source, char *timestr)
Definition: inspircd11.c:968
E int UnRestrictSAdmin
Definition: extern.h:363
void inspircd_cmd_375(char *source)
Definition: inspircd11.c:602
MDE Message * createMessage(const char *name, int(*func)(char *source, int ac, char **av))
Definition: modules.c:1470
int inspircd_flood_mode_check(char *value)
Definition: inspircd11.c:1768
void inspircd_cmd_serv_notice(char *source, char *dest, char *msg)
Definition: inspircd11.c:843
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 CMODE_A
Definition: inspircd11.h:35
char mode
Definition: services.h:933
int anope_event_kick(char *source, int ac, char **av)
Definition: inspircd11.c:1315
#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
#define CMODE_R
Definition: bahamut.h:52
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
E char * get_throttle(Channel *chan)
Definition: channels.c:1867
void inspircd_cmd_pass(char *pass)
Definition: inspircd11.c:884
MDE void moduleAddAuthor(const char *author)
Definition: modules.c:1772
CBModeInfo myCbmodeinfos[]
Definition: inspircd11.c:311
#define CMODE_t
Definition: bahamut.h:49
int except
Definition: services.h:320
int anope_event_chghost(char *source, int ac, char **av)
Definition: inspircd11.c:1470
E char * cs_get_key(ChannelInfo *ci)
Definition: chanserv.c:2447
void inspircd_cmd_kick(char *source, char *chan, char *user, char *buf)
Definition: inspircd11.c:792
E void cs_set_redirect(ChannelInfo *ci, char *value)
Definition: chanserv.c:2572
MDE void moduleSetType(MODType type)
Definition: modules.c:818
#define CMODE_V
Definition: inspircd11.h:42
int anope_event_436(char *source, int ac, char **av)
Definition: inspircd11.c:1197
int anope_event_topic(char *source, int ac, char **av)
Definition: inspircd11.c:1217
#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 update_host(User *user)
Definition: users.c:104
E void pmodule_cmd_243(void(*func)(char *buf))
Definition: ircd.c:919
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
int anope_event_sethost(char *source, int ac, char **av)
Definition: inspircd11.c:1418
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
#define CMODE_u
Definition: inspircd11.h:46
static int has_chgidentmod
Definition: inspircd11.c:396
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
void inspircd_cmd_quit(char *source, char *buf)
Definition: inspircd11.c:867
void inspircd_cmd_connect(int servernum)
Definition: inspircd11.c:1160
int anope_event_fjoin(char *source, int ac, char **av)
Definition: inspircd11.c:723
#define CMODE_Q
Definition: charybdis.h:44
void inspircd_cmd_351(char *source)
Definition: inspircd11.c:859
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
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
int anope_event_fmode(char *source, int ac, char **av)
Definition: inspircd11.c:684
E void pmodule_invis_umode(int mode)
Definition: ircd.c:1171
void inspircd_cmd_vhost_off(User *u)
Definition: inspircd11.c:554
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
#define MOD_STOP
Definition: modules.h:53
void(* addmask)(Channel *chan, char *mask)
Definition: services.h:943
void inspircd_cmd_svsadmin(char *server, int set)
Definition: inspircd11.c:536
int anope_event_chgname(char *source, int ac, char **av)
Definition: inspircd11.c:1361
E char * ServiceHost
Definition: extern.h:277
#define UMODE_x
Definition: bahamut.h:23
int invitemode
Definition: services.h:359
void inspircd_cmd_unsqline(char *user)
Definition: inspircd11.c:909
void inspircd_cmd_svshold(char *nick)
Definition: inspircd11.c:1652
void inspircd_cmd_bot_chan_mode(char *nick, char *chan)
Definition: inspircd11.c:854
E void record_topic(const char *chan)
Definition: chanserv.c:1645
E char * EncModule
Definition: extern.h:580
static int has_chghostmod
Definition: inspircd11.c:395
E void pmodule_invite_cmode(int mode)
Definition: ircd.c:1181
void inspircd_cmd_akill(char *user, char *host, char *who, time_t when, time_t expires, char *reason)
Definition: inspircd11.c:566
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
#define CMODE_O
Definition: bahamut.h:57
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
int anope_event_nick(char *source, int ac, char **av)
Definition: inspircd11.c:1438
int anope_event_quit(char *source, int ac, char **av)
Definition: inspircd11.c:1275
CBMode myCbmodes[128]
Definition: inspircd11.c:245
E char * uplink
Definition: extern.h:35
void inspircd_cmd_serv_privmsg(char *source, char *dest, char *msg)
Definition: inspircd11.c:848
E User * finduser(const char *nick)
Definition: users.c:323
CMMode myCmmodes[128]
Definition: inspircd11.c:217
void inspircd_cmd_376(char *source)
Definition: inspircd11.c:608
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
time_t creation_time
Definition: services.h:1002
#define CAPAB_TLKEXT
Definition: services.h:1393
E void set_flood(Channel *chan, char *value)
Definition: channels.c:1972
void(* setvalue)(Channel *chan, char *value)
Definition: services.h:924
MDE void moduleAddVersion(const char *version)
Definition: modules.c:1760
#define UMODE_a
Definition: bahamut.h:16
char *(* getvalue)(Channel *chan)
Definition: services.h:938
E void add_ban(Channel *chan, char *mask)
Definition: channels.c:1338
void inspircd_cmd_unszline(char *mask)
Definition: inspircd11.c:1671
E void do_part(const char *source, int ac, char **av)
Definition: channels.c:710
#define CUS_HALFOP
Definition: services.h:1343
E void del_ban(Channel *chan, char *mask)
Definition: channels.c:1779
void inspircd_cmd_privmsg2(char *source, char *dest, char *msg)
Definition: inspircd11.c:838
void inspircd_cmd_notice_ops(char *source, char *dest, char *buf)
Definition: inspircd11.c:801
E char * merge_args(int argc, char **argv)
Definition: misc.c:180
#define CUS_PROTECT
Definition: services.h:1345
E void pmodule_ircd_cumodes(CUMode modes[128])
Definition: ircd.c:1117
void inspircd_cmd_svid_umode3(User *u, char *ts)
Definition: inspircd11.c:1727
E const char version_flags[]
Definition: extern.h:771
#define CMODE_f
Definition: charybdis.h:35
Command * c
Definition: ns_recover.c:17
void inspircd_cmd_svsjoin(char *source, char *nick, char *chan, char *param)
Definition: inspircd11.c:1732
u_int32_t uint32
Definition: db-merger.c:123
void inspircd_cmd_swhois(char *source, char *who, char *mask)
Definition: inspircd11.c:1742
E void alog(const char *fmt,...) FORMAT(printf
void inspircd_cmd_unsgline(char *mask)
Definition: inspircd11.c:1665
E int servernum
Definition: extern.h:615
int anope_event_ping(char *source, int ac, char **av)
Definition: inspircd11.c:1188
int anope_event_setname(char *source, int ac, char **av)
Definition: inspircd11.c:1342
void inspircd_cmd_chg_nick(char *oldnick, char *newnick)
Definition: inspircd11.c:1127
int svshold
Definition: services.h:338
E char * get_redirect(Channel *chan)
Definition: channels.c:1894
void inspircd_cmd_eob()
Definition: inspircd11.c:1747
#define MOD_CONT
Definition: modules.h:54
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(* delmask)(Channel *chan, char *mask)
Definition: services.h:944
E char * cs_get_flood(ChannelInfo *ci)
Definition: chanserv.c:2417
E void display_news(User *u, int16 type)
Definition: news.c:269
#define CAPAB_SSJ3
Definition: services.h:1389
void inspircd_cmd_topic(char *whosets, char *chan, char *whosetit, char *topic, time_t when)
Definition: inspircd11.c:547
#define CMODE_K
Definition: inspircd11.h:37
E Server * findserver(Server *s, const char *name)
Definition: servers.c:261
#define CMODE_G
Definition: inspircd11.h:44
E void pmodule_cmd_svid_umode(void(*func)(char *nick, time_t ts))
Definition: ircd.c:1023
void inspircd_cmd_bob()
Definition: inspircd11.c:1181
E int m_privmsg(char *source, char *receiver, char *msg)
Definition: messages.c:130
int anope_event_ftopic(char *source, int ac, char **av)
Definition: inspircd11.c:656
void inspircd_cmd_nick(char *nick, char *name, char *modes)
Definition: inspircd11.c:613
E void pmodule_ircd_csmodes(char mode[128])
Definition: ircd.c:1151
E void pmodule_cmd_242(void(*func)(char *buf))
Definition: ircd.c:914
#define NI_MSG
Definition: services.h:1292
E int debug
Definition: extern.h:775
int anope_event_idle(char *source, int ac, char **av)
Definition: inspircd11.c:648
static int has_svsholdmod
Definition: inspircd11.c:394
E int is_services_admin(User *u)
Definition: operserv.c:591
#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
IRCDVar myIrcd[]
Definition: inspircd11.c:38
E void pmodule_cmd_join(void(*func)(char *user, char *channel, time_t chantime))
Definition: ircd.c:848
int anope_event_privmsg(char *source, int ac, char **av)
Definition: inspircd11.c:1500
int anope_event_admin(char *source, int ac, char **av)
Definition: inspircd11.c:1763
void inspircd_cmd_svsmode_chan(char *name, char *mode, char *nick)
Definition: inspircd11.c:1696
E int NSDefFlags
Definition: extern.h:377
static int has_messagefloodmod
Definition: inspircd11.c:397
#define CUS_OWNER
Definition: services.h:1344
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
static char currentpass[1024]
Definition: inspircd11.c:881
void inspircd_cmd_svsnoop(char *server, int set)
Definition: inspircd11.c:531
E void pmodule_cmd_250(void(*func)(char *buf))
Definition: ircd.c:874
char * username
Definition: services.h:877
char * topic
Definition: services.h:1003
char * vident
Definition: services.h:882
E void pmodule_ircd_version(char *version)
Definition: ircd.c:1107
E const char version_number[]
Definition: extern.h:767
static int has_globopsmod
Definition: inspircd11.c:389
int anope_event_version(char *source, int ac, char **av)
Definition: inspircd11.c:643
E char * get_flood(Channel *chan)
Definition: channels.c:1860
#define CMODE_m
Definition: bahamut.h:45
void inspircd_cmd_privmsg(char *source, char *dest, char *buf)
Definition: inspircd11.c:829
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
int anope_event_kill(char *source, int ac, char **av)
Definition: inspircd11.c:1306
void inspircd_cmd_notice(char *source, char *dest, char *buf)
Definition: inspircd11.c:811
E void pmodule_cmd_401(void(*func)(char *source, char *who))
Definition: ircd.c:904
E int WallOper
Definition: extern.h:448
E void pmodule_cmd_svso(void(*func)(char *source, char *nick, char *flag))
Definition: ircd.c:949
#define CAPAB_VL
Definition: services.h:1392
E void pmodule_cmd_serv_privmsg(void(*func)(char *source, char *dest, char *msg))
Definition: ircd.c:821
void inspircd_cmd_server(char *servname, int hop, char *descript)
Definition: inspircd11.c:890
E void pmodule_cmd_317(void(*func)(char *buf))
Definition: ircd.c:894
char myCsmodes[128]
Definition: inspircd11.c:196
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
void inspircd_cmd_szline(char *mask, char *reason, char *whom)
Definition: inspircd11.c:1677
E int quitting
Definition: extern.h:790
E void pmodule_cmd_remove_akill(void(*func)(char *user, char *host))
Definition: ircd.c:701
E int NSReleaseTimeout
Definition: extern.h:388
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
int anope_event_mode(char *source, int ac, char **av)
Definition: inspircd11.c:1284
int anope_event_part(char *source, int ac, char **av)
Definition: inspircd11.c:1508
void inspircd_cmd_372_error(char *source)
Definition: inspircd11.c:596
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
void inspircd_cmd_squit(char *servname, char *message)
Definition: inspircd11.c:1112
CUMode myCumodes[128]
Definition: inspircd11.c:341
#define UMODE_r
Definition: bahamut.h:20
void inspircd_cmd_svspart(char *source, char *nick, char *chan)
Definition: inspircd11.c:1737
int anope_event_credits(char *source, int ac, char **av)
Definition: inspircd11.c:1758
void inspircd_set_umode(User *user, int ac, char **av)
Definition: inspircd11.c:401
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 inspircd_cmd_svso(char *source, char *nick, char *flag)
Definition: inspircd11.c:1122
int anope_event_capab(char *source, int ac, char **av)
Definition: inspircd11.c:1524
void inspircd_cmd_part(char *nick, char *chan, char *buf)
Definition: inspircd11.c:954
void inspircd_cmd_211(char *buf)
Definition: inspircd11.c:1081
void inspircd_cmd_mode(char *source, char *dest, char *buf)
Definition: inspircd11.c:632
#define UMODE_A
Definition: bahamut.h:22
void inspircd_cmd_ctcp(char *source, char *dest, char *buf)
Definition: inspircd11.c:1812
E void add_exception(Channel *chan, char *mask)
Definition: channels.c:1377
void inspircd_cmd_219(char *source, char *letter)
Definition: inspircd11.c:1027
#define CBM_NO_USER_MLOCK
Definition: services.h:930
#define CMODE_k
Definition: bahamut.h:50
int AnopeInit(int argc, char **argv)
Definition: inspircd11.c:1936
int inspircd_valid_nick(char *nick)
Definition: inspircd11.c:1801
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
#define UMODE_h
Definition: bahamut.h:17
static int has_inviteexceptionmod
Definition: inspircd11.c:399
#define DEFAULT_MLOCK
Definition: bahamut.h:59
E void chan_set_throttle(Channel *chan, char *value)
Definition: channels.c:1985
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 inspircd_cmd_svskill(char *source, char *user, char *buf)
Definition: inspircd11.c:573
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
void inspircd_cmd_307(char *buf)
Definition: inspircd11.c:987
E char * cs_get_limit(ChannelInfo *ci)
Definition: chanserv.c:2458
uint32 mode
Definition: services.h:889
E char * cs_get_throttle(ChannelInfo *ci)
Definition: chanserv.c:2432
E void pmodule_cmd_guest_nick(void(*func)(char *nick, char *user, char *host, char *real, char *modes))
Definition: ircd.c:761
E void common_svsmode(User *u, char *modes, char *arg)
Definition: actions.c:228
E char * ServerName
Definition: extern.h:274
#define CMODE_c
Definition: bahamut.h:54
void inspircd_cmd_pong(char *servname, char *who)
Definition: inspircd11.c:897
void inspircd_cmd_svsnick(char *source, char *guest, time_t when)
Definition: inspircd11.c:1137
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
void inspircd_cmd_317(char *buf)
Definition: inspircd11.c:1017
E void pmodule_cmd_svshold(void(*func)(char *nick))
Definition: ircd.c:981
int anope_event_squit(char *source, int ac, char **av)
Definition: inspircd11.c:1253
#define SERVER_ISME
Definition: services.h:865
void inspircd_cmd_notice2(char *source, char *dest, char *msg)
Definition: inspircd11.c:824
#define CAPAB_NICK2
Definition: services.h:1390
void inspircd_cmd_jupe(char *jserver, char *who, char *reason)
Definition: inspircd11.c:1782
int inspircd_jointhrottle_mode_check(char *value)
Definition: inspircd11.c:1827
char * vhostchar
Definition: services.h:365
E void pmodule_cmd_serv_notice(void(*func)(char *source, char *dest, char *msg))
Definition: ircd.c:816
E void pmodule_jointhrottle_mode_check(int(*func)(char *value))
Definition: ircd.c:1159
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
void inspircd_cmd_unban(char *name, char *nick)
Definition: inspircd11.c:1689
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
void moduleAddIRCDMsgs(void)
Definition: inspircd11.c:475
int anope_event_opertype(char *source, int ac, char **av)
Definition: inspircd11.c:669
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
E Server * new_server(Server *uplink, const char *name, const char *desc, uint16 flags, char *suid)
Definition: servers.c:119
E void pmodule_flood_mode_check(int(*func)(char *value))
Definition: ircd.c:1092
#define NEWS_OPER
Definition: services.h:1050
E void change_user_realname(User *user, const char *realname)
Definition: users.c:147
E void pmodule_ircd_cbmodeinfos(CBModeInfo *modeinfos)
Definition: ircd.c:1112
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 inspircd_cmd_nc_change(User *u)
Definition: inspircd11.c:1712
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
int anope_event_join(char *source, int ac, char **av)
Definition: inspircd11.c:1324
E void pmodule_cmd_mode(void(*func)(char *source, char *dest, char *buf))
Definition: ircd.c:768
E void pmodule_limit_mode(int mode)
Definition: ircd.c:1201
#define CMODE_i
Definition: bahamut.h:44
#define CMODE_S
Definition: hybrid.h:46
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
E void pmodule_cmd_312(void(*func)(char *buf))
Definition: ircd.c:889
E const char version_build[]
Definition: extern.h:769
E void change_user_host(User *user, const char *host)
Definition: users.c:129
#define CMODE_s
Definition: bahamut.h:48
#define CUS_OP
Definition: services.h:1341
int fmode
Definition: services.h:349
E char * normalizeBuffer(char *)
Definition: botserv.c:1101
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
void inspircd_cmd_401(char *source, char *who)
Definition: inspircd11.c:1042
#define CUF_PROTECT_BOTSERV
Definition: services.h:956
void inspircd_cmd_join(char *user, char *channel, time_t chantime)
Definition: inspircd11.c:903
void inspircd_cmd_sqline(char *mask, char *reason)
Definition: inspircd11.c:1101
#define UMODE_o
Definition: bahamut.h:19
E void pmodule_cmd_219(void(*func)(char *source, char *letter))
Definition: ircd.c:899
int anope_event_motd(char *source, int ac, char **av)
Definition: inspircd11.c:1332
void inspircd_cmd_svsmode(User *u, int ac, char **av)
Definition: inspircd11.c:581