Anope IRC Services  Version 1.8
inspircd20.c
Go to the documentation of this file.
1 /* inspircd 2.0 + functions
2  *
3  * (C) 2009 Jan Milants <Viper@Anope.org>
4  * (C) 2011 Adam <Adam@anope.org>
5  * (C) 2003-2014 Anope Team
6  * Contact us at team@anope.org
7  *
8  * Please read COPYING and README for further details.
9  *
10  * Partially based on code of Denora IRC Stats.
11  * Based on InspIRCd 1.1 code of Anope by Anope Team.
12  * Based on the original code of Epona by Lara.
13  * Based on the original code of Services by Andy Church.
14  *
15  *
16  */
17 
18 
19 /*************************************************************************/
20 
21 #include "services.h"
22 #include "pseudo.h"
23 #include "inspircd20.h"
24 #include "version.h"
25 
26 #ifndef _WIN32
27 #include <sys/socket.h>
28 #include <netinet/in.h>
29 #include <arpa/inet.h>
30 #endif
31 
32 #ifdef _WIN32
33 #include "winsock.h"
34 int inet_aton(const char *name, struct in_addr *addr)
35 {
36  uint32 a = inet_addr(name);
37  addr->s_addr = a;
38  return a != (uint32) - 1;
39 }
40 #endif
41 
43 {
44  static int16 last_mode = CUS_PROTECT; /* highest value in services.h */
45  if (last_mode == 0x8000)
46  return 0;
47  last_mode = last_mode << 1;
48  if (last_mode == CUS_DEOPPED)
49  last_mode = last_mode << 1; /* get around CUS_DEOPPED */
50  return last_mode;
51 }
52 
54 {
55  struct chmodeinfo *p = chmodes;
56 
57  while (p->modechar != 0)
58  {
59  if (p->modechar == c)
60  return p->mode;
61  ++p;
62  }
63 
64  return 0;
65 }
66 
67 static char flood_mode_set[3];
68 static char flood_mode_unset[3];
69 
70 static void do_nothing(Channel *c, char *mask) { }
71 
73  {"InspIRCd 2.0", /* ircd name */
74  "+I", /* nickserv mode */
75  "+I", /* chanserv mode */
76  "+I", /* memoserv mode */
77  "+I", /* hostserv mode */
78  "+ioI", /* operserv mode */
79  "+I", /* botserv mode */
80  "+I", /* helpserv mode */
81  "+iI", /* Dev/Null mode */
82  "+iI", /* Global mode */
83  "+I", /* nickserv alias mode */
84  "+I", /* chanserv alias mode */
85  "+I", /* memoserv alias mode */
86  "+I", /* hostserv alias mode */
87  "+ioI", /* operserv alias mode */
88  "+I", /* botserv alias mode */
89  "+I", /* helpserv alias mode */
90  "+iI", /* Dev/Null alias mode */
91  "+iI", /* Global alias mode */
92  "+I", /* Used by BotServ Bots */
93  5, /* Chan Max Symbols */
94  "-cijlmnpstuzACGHKNOQRSV", /* Modes to Remove */
95  "+oa", /* Channel Umode used by Botserv bots */
96  1, /* SVSNICK */
97  1, /* Vhost */
98  0, /* Has Owner */
99  "+q", /* Mode to set for an owner */
100  "-q", /* Mode to unset for an owner */
101  "+a", /* Mode to set for channel admin */
102  "-a", /* Mode to unset for channel admin */
103  "+r", /* Mode On Reg */
104  NULL, /* Mode on ID for Roots */
105  NULL, /* Mode on ID for Admins */
106  NULL, /* Mode on ID for Opers */
107  "-r", /* Mode on UnReg */
108  "-r", /* Mode on Nick Change */
109  0, /* Supports SGlines */
110  1, /* Supports SQlines */
111  1, /* Supports SZlines */
112  0, /* Supports Halfop +h */
113  4, /* Number of server args */
114  0, /* Join 2 Set */
115  0, /* Join 2 Message */
116  0, /* Has exceptions +e */
117  1, /* TS Topic Forward */
118  0, /* TS Topic Backward */
119  0, /* Protected Umode */
120  0, /* Has Admin */
121  0, /* Chan SQlines */
122  0, /* Quit on Kill */
123  0, /* SVSMODE unban */
124  0, /* Has Protect */
125  1, /* Reverse */
126  1, /* Chan Reg */
127  CMODE_r, /* Channel Mode */
128  1, /* vidents */
129  0, /* svshold */
130  0, /* time stamp on mode */
131  1, /* NICKIP */
132  0, /* O:LINE */
133  1, /* UMODE */
134  1, /* VHOST ON NICK */
135  0, /* Change RealName */
136  0, /* No Knock */
137  0, /* Admin Only */
138  DEFAULT_MLOCK, /* Default MLOCK */
139  UMODE_x, /* Vhost Mode */
140  0, /* +f */
141  0, /* +L */
142  CMODE_f,
143  CMODE_L,
144  0,
145  1, /* No Knock requires +i */
146  NULL, /* CAPAB Chan Modes */
147  0, /* We support inspircd TOKENS */
148  1, /* TOKENS are CASE inSensitive */
149  0, /* TIME STAMPS are BASE64 */
150  0, /* +I support */
151  0, /* SJOIN ban char */
152  0, /* SJOIN except char */
153  0, /* SJOIN invite char */
154  0, /* Can remove User Channel Modes with SVSMODE */
155  0, /* Sglines are not enforced until user reconnects */
156  "x", /* vhost char */
157  1, /* ts6 */
158  1, /* support helper umode */
159  0, /* p10 */
160  NULL, /* character set */
161  1, /* reports sync state */
162  1, /* CIDR channelbans */
163  0, /* +j */
164  CMODE_j, /* +j Mode */
165  1, /* Use delayed client introduction. */
166  }
167  ,
168  {NULL}
169 };
170 
171 
173  {
174  CAPAB_NOQUIT, /* NOQUIT */
175  0, /* TSMODE */
176  1, /* UNCONNECT */
177  0, /* NICKIP */
178  0, /* SJOIN */
179  0, /* ZIP */
180  0, /* BURST */
181  0, /* TS5 */
182  0, /* TS3 */
183  0, /* DKEY */
184  0, /* PT4 */
185  0, /* SCS */
186  0, /* QS */
187  0, /* UID */
188  0, /* KNOCK */
189  0, /* CLIENT */
190  0, /* IPV6 */
191  0, /* SSJ5 */
192  0, /* SN2 */
193  0, /* TOKEN */
194  0, /* VHOST */
195  CAPAB_SSJ3, /* SSJ3 */
196  CAPAB_NICK2, /* NICK2 */
197  0, /* UMODE2 */
198  CAPAB_VL, /* VL */
199  CAPAB_TLKEXT, /* TLKEXT */
200  0, /* DODKEY */
201  0, /* DOZIP */
202  0,
203  0, 0}
204 };
205 
206 unsigned long umodes[128] = {
207  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
208  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
209  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
210  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
211  0,
212  0, UMODE_B, 0, 0, 0, /* A - E */
213  0, UMODE_G, UMODE_H, UMODE_I, 0, /* F - J */
214  0, 0, 0, 0, 0, /* K - O */
215  0, UMODE_Q, UMODE_R, UMODE_S, 0, /* P - T */
216  0, 0, UMODE_W, 0, 0, /* U - Y */
217  0, /* Z */
218  0, 0, 0, 0, 0, 0,
219  0, 0, UMODE_c, UMODE_d, 0, /* a - e */
220  0, UMODE_g, UMODE_h, UMODE_i, 0, /* f - j */
221  UMODE_k, 0, 0, 0, UMODE_o, /* k - o */
222  0, 0, UMODE_r, UMODE_s, 0, /* p - t */
223  0, 0, UMODE_w, UMODE_x, 0, /* u - y */
224  0, /* z */
225  0, 0, 0, 0, 0
226 };
227 
228 
229 char myCsmodes[128] = {
230  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
231  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
232 
233  0,
234  0,
235  0, 0, 0,
236  0,
237  0,
238  0, 0, 0, 0,
239 
240  0, 0, 0, 0, 0,
241  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
242 
243  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
244  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
245 
246  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
247  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
248 };
249 
250 static char sym_from_char(const char c)
251 {
252  int i;
253  for (i = 0; i < 128; ++i)
254  if (myCsmodes[i] == c)
255  return i;
256  return 0;
257 }
258 
260  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, /* 0-7 */
261  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, /* 8-15 */
262  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, /* 16-23 */
263  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, /* 24-31 */
264  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, /* 32-39 */
265  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, /* 40-47 */
266  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, /* 48-55 */
267  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, /* 56-63 */
268  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, /* 64-71 @-G */
269  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, /* 72-79 H-O */
270  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, /* 80-87 P-W */
271  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, /* 88-95 X-_ */
272  {NULL}, /* 96 */
273  {NULL}, /* 97 a */
274  {NULL}, /* 98 b */
275  {NULL}, /* c */
276  {NULL}, /* d */
277  {NULL}, /* e */
278  {NULL}, /* f */
279  {NULL}, /* g */
280  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, /* h-o */
281  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, /* p-w */
282  {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} /* z,y,z... */
283 };
284 
285 
286 
288  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
289  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
290  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
291  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
292  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
293  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
294  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
295  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
296  {0},
297  {0}, /* A */
298  {0}, /* B */
299  {0}, /* C */
300  {0}, /* D */
301  {0}, /* E */
302  {0}, /* F */
303  {0}, /* G */
304  {0}, /* H */
305  {0}, /* I */
306  {0}, /* J */
307  {0}, /* K */
308  {0}, /* L */
309  {CMODE_M, 0, NULL, NULL}, /* M */
310  {0}, /* N */
311  {0}, /* O */
312  {0}, /* P */
313  {0}, /* Q */
314  {CMODE_R, 0, NULL, NULL}, /* R */
315  {0}, /* S */
316  {0}, /* T */
317  {0}, /* U */
318  {0}, /* V */
319  {0}, /* W */
320  {0}, /* X */
321  {0}, /* Y */
322  {0}, /* Z */
323  {0}, {0}, {0}, {0}, {0}, {0},
324  {0}, /* a */
325  {0}, /* b */
326  {0}, /* c */
327  {0}, /* d */
328  {0}, /* e */
329  {0}, /* f */
330  {0}, /* g */
331  {0}, /* h */
332  {CMODE_i, 0, NULL, NULL},
333  {0}, /* j */
336  {CMODE_m, 0, NULL, NULL},
337  {CMODE_n, 0, NULL, NULL},
338  {0}, /* o */
339  {CMODE_p, 0, NULL, NULL},
340  {0}, /* q */
341  {CMODE_r, CBM_NO_MLOCK, NULL, NULL},
342  {CMODE_s, 0, NULL, NULL},
343  {CMODE_t, 0, NULL, NULL},
344  {0},
345  {0}, /* v */
346  {0}, /* w */
347  {0}, /* x */
348  {0}, /* y */
349  {0},
350  {0}, {0}, {0}, {0}
351 };
352 
354  {'a', 0, 0, NULL, NULL},
355  {'c', CMODE_c, 0, NULL, NULL},
356  {'d', 0, 0, NULL, NULL},
357  {'f', CMODE_f, 0, NULL, NULL},
358  {'g', 0, 0, NULL, NULL},
359  {'i', CMODE_i, 0, NULL, NULL},
360  {'j', CMODE_j, 0, NULL, NULL},
361  {'k', CMODE_k, 0, get_key, cs_get_key},
363  {'m', CMODE_m, 0, NULL, NULL},
364  {'n', CMODE_n, 0, NULL, NULL},
365  {'p', CMODE_p, 0, NULL, NULL},
366  {'r', CMODE_r, 0, NULL, NULL},
367  {'s', CMODE_s, 0, NULL, NULL},
368  {'t', CMODE_t, 0, NULL, NULL},
369  {'u', CMODE_u, 0, NULL, NULL},
370  {'v', 0, 0, NULL, NULL},
371  {'w', 0, 0, NULL, NULL},
372  {'x', 0, 0, NULL, NULL},
373  {'y', 0, 0, NULL, NULL},
374  {'z', CMODE_z, 0, NULL, NULL},
375  {'A', CMODE_A, 0, NULL, NULL},
376  {'B', 0, 0, NULL, NULL},
377  {'C', CMODE_C, 0, NULL, NULL},
378  {'D', 0, 0, NULL, NULL},
379  {'E', 0, 0, NULL, NULL},
380  {'F', CMODE_F, 0, NULL, NULL},
381  {'G', CMODE_G, 0, NULL, NULL},
382  {'H', 0, 0, NULL, NULL},
383  {'J', CMODE_J, 0, NULL, NULL},
384  {'K', CMODE_K, 0, NULL, NULL},
385  {'L', CMODE_L, 0, NULL, NULL},
386  {'M', CMODE_M, 0, NULL, NULL},
387  {'N', CMODE_N, 0, NULL, NULL},
388  {'O', CMODE_O, 0, NULL, NULL},
389  {'P', CMODE_P, 0, NULL, NULL},
390  {'Q', CMODE_Q, 0, NULL, NULL},
391  {'R', CMODE_R, 0, NULL, NULL},
392  {'S', CMODE_S, 0, NULL, NULL},
393  {'T', CMODE_T, 0, NULL, NULL},
394  {'U', 0, 0, NULL, NULL},
395  {'V', 0, 0, NULL, NULL},
396  {'W', 0, 0, NULL, NULL},
397  {'X', 0, 0, NULL, NULL},
398  {'Y', 0, 0, NULL, NULL},
399  {'Z', 0, 0, NULL, NULL},
400  {0}
401 };
402 
403 static CBModeInfo *find_cbinfo(const char mode)
404 {
406 
407  while (p->flag != 0)
408  {
409  if (p->mode == mode)
410  {
411  return p;
412  }
413  ++p;
414  }
415 
416  return NULL;
417 }
418 
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}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
426  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
427  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
428  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
429 
430  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
431  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
432  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
433  {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
434 
435  {0},
436 
437  {0}, /* a */
438  {0}, /* b */
439  {0}, /* c */
440  {0}, /* d */
441  {0}, /* e */
442  {0}, /* f */
443  {0}, /* g */
444  {0}, /* h */
445  {0}, /* i */
446  {0}, /* j */
447  {0}, /* k */
448  {0}, /* l */
449  {0}, /* m */
450  {0}, /* n */
452  {0}, /* p */
453  {0}, /* q */
454  {0}, /* r */
455  {0}, /* s */
456  {0}, /* t */
457  {0}, /* u */
458  {CUS_VOICE, 0, NULL},
459  {0}, /* w */
460  {0}, /* x */
461  {0}, /* y */
462  {0}, /* z */
463  {0}, {0}, {0}, {0}, {0}
464 };
465 
466 /* This will be set to 1 if a burst is in progess. */
467 static int burst = 0;
468 /* Here we store for which user we last got a UID with +r. */
470 
471 static int has_servicesmod = 0;
472 static int has_chghostmod = 0;
473 static int has_chgidentmod = 0;
474 static int has_servprotectmod = 0;
475 static int has_hidechansmod = 0;
476 static int has_cloaking = 0;
477 
478 void inspircd_set_umode(User *user, int ac, char **av)
479 {
480  int add = 1; /* 1 if adding modes, 0 if deleting */
481  char *modes = av[0];
482 
483  ac--;
484 
485  if (debug)
486  alog("debug: Changing mode for %s to %s", user->nick, modes);
487 
488  while (*modes) {
489 
490  /* This looks better, much better than "add ? (do_add) : (do_remove)".
491  * At least this is readable without paying much attention :) -GD
492  */
493  if (add)
494  user->mode |= umodes[(int) *modes];
495  else
496  user->mode &= ~umodes[(int) *modes];
497 
498  switch (*modes++) {
499  case '+':
500  add = 1;
501  break;
502  case '-':
503  add = 0;
504  break;
505  case 'o':
506  if (add) {
507  opcnt++;
508  if (WallOper) {
509  anope_cmd_global(s_OperServ, "\2%s\2 is now an IRC operator.",
510  user->nick);
511  }
512  display_news(user, NEWS_OPER);
513  } else {
514  opcnt--;
515  }
516  break;
517  case 'r':
518  user->svid = (add ? user->timestamp : 0);
519  if (burst && user == u_intro_regged)
520  break;
521  if (add && !nick_identified(user)) {
522  common_svsmode(user, "-r", NULL);
523  user->mode &= ~UMODE_r;
524  }
525  break;
526  case 'x':
527  update_host(user);
528  break;
529  }
530  }
531 }
532 
533 
534 /* *INDENT-OFF* */
535 void moduleAddIRCDMsgs(void) {
536  Message *m;
537 
538  updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+a","-a");
539 
551  m = createMessage("ENDBURST", anope_event_eob); addCoreMessage(IRCD,m);
590  m = createMessage("SVSWATCH", anope_event_null); addCoreMessage(IRCD,m);
591  m = createMessage("SVSSILENCE",anope_event_null); addCoreMessage(IRCD,m);
594 }
595 
596 /* *INDENT-ON* */
597 
598 void inspircd_cmd_svsnoop(char *server, int set)
599 {
600  /* Not Supported by this IRCD */
601 }
602 
603 void inspircd_cmd_svsadmin(char *server, int set)
604 {
605  /* Not Supported by this IRCD */
606 }
607 
608 void inspircd_cmd_remove_akill(char *user, char *host)
609 {
610  Uid *ud = find_uid(s_OperServ);
611  send_cmd(ud->uid, "GLINE %s@%s", user, host);
612 }
613 
614 void inspircd_cmd_topic(char *whosets, char *chan, char *whosetit,
615  char *topic, time_t when)
616 {
617  Uid *ud;
618  if (!whosets) return;
619  ud = find_uid(whosets);
620  send_cmd(ud ? ud->uid : whosets, "FTOPIC %s %lu %s :%s", chan,
621  (unsigned long int) when, whosetit, topic);
622 }
623 
625 {
626  if (has_cloaking)
627  {
628  common_svsmode(u, "-x", NULL);
629  common_svsmode(u, "+x", NULL);
630  }
631  else
632  {
634  }
635 
636  if (has_chgidentmod && u->username && u->vident && strcmp(u->username, u->vident) != 0)
637  {
639  }
640 }
641 
642 void inspircd_cmd_akill(char *user, char *host, char *who, time_t when,
643  time_t expires, char *reason)
644 {
645  /* Calculate the time left before this would expire, capping it at 2 days */
646  time_t timeleft = expires - time(NULL);
647  if (timeleft > 172800 || timeleft < 0)
648  timeleft = 172800;
649  send_cmd(TS6SID, "ADDLINE G %s@%s %s %ld %ld :%s", user, host, who,
650  (long int) time(NULL), (long int) timeleft, reason);
651 }
652 
653 void inspircd_cmd_svskill(char *source, char *user, char *buf)
654 {
655  Uid *ud1;
656  User *u;
657 
658  if (!buf || !source || !user)
659  return;
660 
661  ud1 = find_uid(source);
662  u = finduser(user);
663  send_cmd(ud1 ? ud1->uid : TS6SID, "KILL %s :%s", u ? u->uid : user, buf);
664 }
665 
666 void inspircd_cmd_svsmode(User * u, int ac, char **av)
667 {
668  Uid *ud = find_uid(s_NickServ);
669  send_cmd(ud->uid, "MODE %s %s", u->nick, merge_args(ac, av));
670 
671  if (strstr(av[0], "+r") && u->na) {
672  send_cmd(TS6SID, "METADATA %s accountname :%s", u->uid, u->na->nc->display);
673  } else if (strstr(av[0], "-r")) {
674  send_cmd(TS6SID, "METADATA %s accountname :", u->uid);
675  }
676 }
677 
678 
679 void inspircd_cmd_372(char *source, char *msg)
680 {
681  User *u = finduser(source);
682 
683  send_cmd(TS6SID, "PUSH %s ::%s 372 %s :- %s", u ? u->uid : source, ServerName, source, msg);
684 }
685 
686 void inspircd_cmd_372_error(char *source)
687 {
688  User *u = finduser(source);
689 
690  send_cmd(TS6SID, "PUSH %s ::%s 422 %s :- MOTD file not found! Please "
691  "contact your IRC administrator.", u ? u->uid : source, ServerName, source);
692 }
693 
694 void inspircd_cmd_375(char *source)
695 {
696  User *u = finduser(source);
697 
698  send_cmd(TS6SID, "PUSH %s ::%s 375 %s :- %s Message of the Day", u ? u->uid : source,
699  ServerName, source, ServerName);
700 }
701 
702 void inspircd_cmd_376(char *source)
703 {
704  User *u = finduser(source);
705 
706  send_cmd(TS6SID, "PUSH %s ::%s 376 %s :End of /MOTD command.", u ? u->uid : source, ServerName, source);
707 }
708 
709 void inspircd_cmd_nick(char *nick, char *name, char *modes)
710 {
711  char *nicknumbuf = ts6_uid_retrieve();
712  send_cmd(TS6SID, "KILL %s :Services enforced kill", nick);
713  send_cmd(TS6SID, "UID %s %ld %s %s %s %s 0.0.0.0 %ld +%s :%s",
714  nicknumbuf, (long int) time(NULL), nick, ServiceHost,
715  ServiceHost, ServiceUser, (long int) time(NULL), modes, name);
716  new_uid(nick, nicknumbuf);
717  if (strchr(modes, 'o') != NULL)
718  send_cmd(nicknumbuf, "OPERTYPE Service");
719 }
720 
721 void inspircd_cmd_guest_nick(char *nick, char *user, char *host,
722  char *real, char *modes)
723 {
724  char *nicknumbuf = ts6_uid_retrieve();
725  send_cmd(TS6SID, "UID %s %ld %s %s %s %s 0.0.0.0 %ld +%s :%s", nicknumbuf,
726  (long int) time(NULL), nick, host, host, user, (long int) time(NULL), modes, real);
727  new_uid(nick, nicknumbuf);
728 }
729 
730 void inspircd_cmd_mode(char *source, char *dest, char *buf)
731 {
732  Channel *c;
733  Uid *ud = NULL;
734 
735  if (!buf)
736  return;
737 
738  c = findchan(dest);
739  if (source) ud = find_uid(source);
740  send_cmd(ud ? ud->uid : TS6SID, "FMODE %s %u %s", dest, (unsigned int)((c) ? c->creation_time : time(NULL)), buf);
741 }
742 
743 int anope_event_version(char *source, int ac, char **av)
744 {
745  return MOD_CONT;
746 }
747 
748 int anope_event_idle(char *source, int ac, char **av)
749 {
750  Uid *ud;
751  BotInfo *bi;
752  if (ac == 1) {
753  ud = find_nickuid(av[0]);
754  if (ud) {
755  bi = findbot(ud->nick);
756  send_cmd(ud->uid, "IDLE %s %ld %ld", source, start_time, bi ? time(NULL) - bi->lastmsg : 0);
757  }
758  }
759  return MOD_CONT;
760 }
761 
762 int anope_event_ftopic(char *source, int ac, char **av)
763 {
764  /* :source FTOPIC channel ts setby :topic */
765  char *temp;
766  if (ac < 4)
767  return MOD_CONT;
768  temp = av[1]; /* temp now holds ts */
769  av[1] = av[2]; /* av[1] now holds set by */
770  av[2] = temp; /* av[2] now holds ts */
771  do_topic(source, ac, av);
772  return MOD_CONT;
773 }
774 
775 int anope_event_opertype(char *source, int ac, char **av)
776 {
777  /* opertype is equivalent to mode +o because servers
778  dont do this directly */
779  User *u;
780  u = find_byuid(source);
781  if (u && !is_oper(u)) {
782  char *newav[2];
783  newav[0] = source;
784  newav[1] = "+o";
785  return anope_event_mode(source, 2, newav);
786  } else
787  return MOD_CONT;
788 }
789 
790 int anope_event_fmode(char *source, int ac, char **av)
791 {
792  char *newav[128];
793  int n, o;
794  Channel *c;
795 
796  /* :source FMODE #test 12345678 +nto foo */
797  if (ac < 3)
798  return MOD_CONT;
799 
800  /* Checking the TS for validity to avoid desyncs */
801  if ((c = findchan(av[0]))) {
802  if (c->creation_time > strtol(av[1], NULL, 10)) {
803  /* Our TS is bigger, we should lower it */
804  c->creation_time = strtol(av[1], NULL, 10);
805  } else if (c->creation_time < strtol(av[1], NULL, 10)) {
806  /* The TS we got is bigger, we should ignore this message. */
807  return MOD_CONT;
808  }
809  } else {
810  /* Got FMODE for a non-existing channel */
811  return MOD_CONT;
812  }
813 
814  /* TS's are equal now, so we can proceed with parsing */
815  n = o = 0;
816  while (n < ac) {
817  if (n != 1) {
818  newav[o] = av[n];
819  o++;
820  if (debug)
821  alog("Param: %s", newav[o - 1]);
822  }
823  n++;
824  }
825 
826  return anope_event_mode(source, ac - 1, newav);
827 }
828 
829 /*
830  * [Nov 03 22:31:57.695076 2009] debug: Received: :964 FJOIN #test 1223763723 +BPSnt :,964AAAAAB ,964AAAAAC ,966AAAAAA
831  *
832  * 0: name
833  * 1: channel ts (when it was created, see protocol docs for more info)
834  * 2: channel modes + params (NOTE: this may definitely be more than one param!)
835  * last: users
836  */
837 int anope_event_fjoin(char *source, int ac, char **av)
838 {
839  char *newav[64];
840  char nicklist[4096] = ""; /* inspircd thing */
841 
842  char **argv;
843  int i, argc;
844 
845  if (ac <= 3)
846  return MOD_CONT;
847 
848  argc = split_buf(av[ac - 1], &argv, 1);
849  for (i = 0; i < argc; ++i)
850  {
851  char *nick = argv[i];
852 
853  while (*nick != ',')
854  {
855  nicklist[strlen(nicklist)] = sym_from_char(*nick);
856  nick++;
857  }
858  nick++;
859 
860  strlcat(nicklist, nick, sizeof(nicklist));
861  strlcat(nicklist, " ", sizeof(nicklist));
862  }
863 
864  newav[0] = av[1]; /* timestamp */
865  newav[1] = av[0]; /* channel name */
866  for (i = 2; i < ac - 1; i++)
867  newav[i] = av[i]; /* Modes */
868  newav[i] = nicklist; /* Nicknames */
869  i++;
870 
871  if (debug)
872  alog("Final FJOIN string: %s", merge_args(i, newav));
873 
874  do_sjoin(source, i, newav);
875  return MOD_CONT;
876 }
877 
878 void inspircd_cmd_bot_nick(char *nick, char *user, char *host, char *real,
879  char *modes)
880 {
881  char *nicknumbuf = ts6_uid_retrieve();
882  send_cmd(TS6SID, "UID %s %ld %s %s %s %s 0.0.0.0 %ld +%s :%s",
883  nicknumbuf, (long int) time(NULL), nick, host, host, user,
884  (long int) time(NULL), modes, real);
885  new_uid(nick, nicknumbuf);
886  if (strchr(modes, 'o') != NULL)
887  send_cmd(nicknumbuf, "OPERTYPE Bot");
888 }
889 
890 void inspircd_cmd_kick(char *source, char *chan, char *user, char *buf)
891 {
892  User *u = finduser(user);
893  Uid *ud = (source ? find_uid(source) : NULL), *ud2 = NULL;
894  if (!u) ud2 = (user ? find_uid(user) : NULL);
895 
896  if (buf) {
897  send_cmd(ud ? ud->uid : source, "KICK %s %s :%s", chan, u ? u->uid : ud2 ? ud2->uid : user, buf);
898  } else {
899  send_cmd(ud ? ud->uid : source, "KICK %s %s :%s", chan, u ? u->uid : ud2 ? ud2->uid : user, user);
900  }
901 }
902 
903 void inspircd_cmd_notice_ops(char *source, char *dest, char *buf)
904 {
905  Uid *ud = (source ? find_uid(source) : NULL);
906  if (!buf)
907  return;
908 
909  send_cmd(ud ? ud->uid : TS6SID, "NOTICE @%s :%s", dest, buf);
910 }
911 
912 
913 void inspircd_cmd_notice(char *source, char *dest, char *buf)
914 {
915  if (!buf)
916  return;
917 
918  if (NSDefFlags & NI_MSG) {
919  inspircd_cmd_privmsg2(source, dest, buf);
920  } else {
921  Uid *ud = (source ? find_uid(source) : NULL);
922  User *u = finduser(dest);
923 
924  send_cmd(ud ? ud->uid : TS6SID, "NOTICE %s :%s", u ? u->uid : dest, buf);
925  }
926 }
927 
928 void inspircd_cmd_notice2(char *source, char *dest, char *msg)
929 {
930  Uid *ud = (source ? find_uid(source) : NULL);
931  User *u = finduser(dest);
932 
933  send_cmd(ud ? ud->uid : TS6SID, "NOTICE %s :%s", u ? u->uid : dest, msg);
934 }
935 
936 void inspircd_cmd_privmsg(char *source, char *dest, char *buf)
937 {
938  Uid *ud;
939  User *u;
940 
941  if (!buf)
942  return;
943 
944  ud = (source ? find_uid(source) : NULL);
945  u = finduser(dest);
946 
947  send_cmd(ud ? ud->uid : TS6SID, "PRIVMSG %s :%s", u ? u->uid : dest, buf);
948 }
949 
950 void inspircd_cmd_privmsg2(char *source, char *dest, char *msg)
951 {
952  Uid *ud = (source ? find_uid(source) : NULL);
953  User *u = finduser(dest);
954 
955  send_cmd(ud ? ud->uid : TS6SID, "PRIVMSG %s :%s", u ? u->uid : dest, msg);
956 }
957 
958 void inspircd_cmd_serv_notice(char *source, char *dest, char *msg)
959 {
960  Uid *ud = (source ? find_uid(source) : NULL);
961  send_cmd(ud ? ud->uid : TS6SID, "NOTICE $%s :%s", dest, msg);
962 }
963 
964 void inspircd_cmd_serv_privmsg(char *source, char *dest, char *msg)
965 {
966  Uid *ud = (source ? find_uid(source) : NULL);
967  send_cmd(ud ? ud->uid : TS6SID, "PRIVMSG $%s :%s", dest, msg);
968 }
969 
970 
971 void inspircd_cmd_bot_chan_mode(char *nick, char *chan)
972 {
973  anope_cmd_mode(nick, chan, "%s %s %s", ircd->botchanumode, GET_BOT(nick), GET_BOT(nick));
974 }
975 
976 void inspircd_cmd_351(char *source)
977 {
978  User *u = finduser(source);
979  if (!u) return;
980 
981  send_cmd(TS6SID, "PUSH %s ::%s 351 %s Anope-%s %s :%s - %s (%s) -- %s",
984 }
985 
986 /* QUIT */
987 void inspircd_cmd_quit(char *source, char *buf)
988 {
989  Uid *ud= NULL;
990  if (source) ud = find_uid(source);
991  if (buf) {
992  send_cmd(ud ? ud->uid : source, "QUIT :%s", buf);
993  } else {
994  send_cmd(ud ? ud->uid : source, "QUIT :Exiting");
995  }
996 }
997 
998 /* PROTOCTL */
1000 {
1001 }
1002 
1003 static char currentpass[1024];
1004 
1005 /* PASS */
1006 void inspircd_cmd_pass(char *pass)
1007 {
1008  strncpy(currentpass, pass, 1024);
1009 }
1010 
1011 /* SERVER services-dev.chatspike.net password 0 :Description here */
1012 void inspircd_cmd_server(char *servname, int hop, char *descript, char *sid)
1013 {
1014  send_cmd(NULL, "SERVER %s %s %d %s :%s", servname, currentpass, hop,
1015  sid ? sid : TS6SID, descript);
1016 }
1017 
1018 /* PONG */
1019 void inspircd_cmd_pong(char *servname, char *who)
1020 {
1021  send_cmd(servname, "PONG %s", who);
1022 }
1023 
1024 /* JOIN */
1025 void inspircd_cmd_join(char *user, char *channel, time_t chantime)
1026 {
1027  Uid *ud = (user ? find_uid(user) : NULL);
1028  send_cmd(TS6SID, "FJOIN %s %ud + :,%s", channel, (unsigned int)chantime, ud ? ud->uid : user);
1029 }
1030 
1031 /* UNSQLINE */
1032 void inspircd_cmd_unsqline(char *user)
1033 {
1034  if (!user)
1035  return;
1036 
1037  send_cmd(TS6SID, "DELLINE Q %s", user);
1038 }
1039 
1040 /* CHGHOST */
1041 void inspircd_cmd_chghost(char *nick, char *vhost)
1042 {
1043  Uid *ud;
1044 
1045  if (has_chghostmod != 1) {
1046  anope_cmd_global(s_OperServ, "CHGHOST not loaded!");
1047  return;
1048  }
1049  if (!nick || !vhost)
1050  return;
1051 
1052  ud = find_uid(s_OperServ);
1053  send_cmd(ud->uid, "CHGHOST %s %s", nick, vhost);
1054 }
1055 
1056 /* CHGIDENT */
1057 void inspircd_cmd_chgident(char *nick, char *vIdent)
1058 {
1059  Uid *ud;
1060 
1061  if (has_chgidentmod != 1) {
1062  anope_cmd_global(s_OperServ, "CHGIDENT not loaded!");
1063  return;
1064  }
1065  if (!nick || !vIdent || !*vIdent)
1066  return;
1067 
1068  ud = find_uid(s_OperServ);
1069  send_cmd(ud->uid, "CHGIDENT %s %s", nick, vIdent);
1070 }
1071 
1072 /* INVITE */
1073 void inspircd_cmd_invite(char *source, char *chan, char *nick)
1074 {
1075  Uid *ud;
1076 
1077  if (!source || !chan || !nick)
1078  return;
1079 
1080  ud = find_uid(source);
1081  send_cmd(ud ? ud->uid : TS6SID, "INVITE %s %s", nick, chan);
1082 }
1083 
1084 /* PART */
1085 void inspircd_cmd_part(char *nick, char *chan, char *buf)
1086 {
1087  Uid *ud;
1088 
1089  if (!nick || !chan)
1090  return;
1091 
1092  ud = find_uid(nick);
1093  if (!ud) return;
1094  if (buf) {
1095  send_cmd(ud->uid, "PART %s :%s", chan, buf);
1096  } else {
1097  send_cmd(ud->uid, "PART %s :Leaving", chan);
1098  }
1099 }
1100 
1101 
1102 
1103 /* 391 */
1104 void inspircd_cmd_391(char *source, char *buf)
1105 {
1106  /* Numeric 391 is not used by InspIRCd.
1107  * Instead time requests are done through the TIME s2s command and
1108  * by the client server translated into a rfc conform syntax. ~ Viper */
1109  return;
1110 }
1111 
1112 /* 250 */
1113 void inspircd_cmd_250(char *buf)
1114 {
1115  char *target;
1116  User *u;
1117 
1118  if (!buf)
1119  return;
1120 
1121  target = myStrGetToken(buf, ' ', 0);
1122  u = finduser(target);
1123  free(target);
1124  if (!u) return;
1125 
1126  send_cmd(TS6SID, "PUSH %s ::%s 250 %s", u->uid, ServerName, buf);
1127 }
1128 
1129 /* 307 */
1130 void inspircd_cmd_307(char *buf)
1131 {
1132  char *target;
1133  User *u;
1134 
1135  if (!buf)
1136  return;
1137 
1138  target = myStrGetToken(buf, ' ', 0);
1139  u = finduser(target);
1140  free(target);
1141  if (!u) return;
1142 
1143  send_cmd(TS6SID, "PUSH %s ::%s 307 %s", u->uid, ServerName, buf);
1144 }
1145 
1146 /* 311 */
1147 void inspircd_cmd_311(char *buf)
1148 {
1149  char *target;
1150  User *u;
1151 
1152  if (!buf)
1153  return;
1154 
1155  target = myStrGetToken(buf, ' ', 0);
1156  u = finduser(target);
1157  free(target);
1158  if (!u) return;
1159 
1160  send_cmd(TS6SID, "PUSH %s ::%s 311 %s", u->uid, ServerName, buf);
1161 }
1162 
1163 /* 312 */
1164 void inspircd_cmd_312(char *buf)
1165 {
1166  char *target;
1167  User *u;
1168 
1169  if (!buf)
1170  return;
1171 
1172  target = myStrGetToken(buf, ' ', 0);
1173  u = finduser(target);
1174  free(target);
1175  if (!u) return;
1176 
1177  send_cmd(TS6SID, "PUSH %s ::%s 312 %s", u->uid, ServerName, buf);
1178 }
1179 
1180 /* 317 */
1181 void inspircd_cmd_317(char *buf)
1182 {
1183  char *target;
1184  User *u;
1185 
1186  if (!buf)
1187  return;
1188 
1189  target = myStrGetToken(buf, ' ', 0);
1190  u = finduser(target);
1191  free(target);
1192  if (!u) return;
1193 
1194  send_cmd(TS6SID, "PUSH %s ::%s 317 %s", u->uid, ServerName, buf);
1195 }
1196 
1197 /* 219 */
1198 void inspircd_cmd_219(char *source, char *letter)
1199 {
1200  User *u = finduser(source);
1201  if (!source)
1202  return;
1203 
1204  if (letter)
1205  send_cmd(TS6SID, "PUSH %s ::%s 219 %s %c :End of /STATS report.", u ? u->uid : source, ServerName, source, *letter);
1206  else
1207  send_cmd(TS6SID, "PUSH %s ::%s 219 %s l :End of /STATS report.", u ? u->uid : source, ServerName, source);
1208 }
1209 
1210 /* 401 */
1211 void inspircd_cmd_401(char *source, char *who)
1212 {
1213  User *u = finduser(source);
1214  if (!source || !who)
1215  return;
1216 
1217  send_cmd(TS6SID, "PUSH %s ::%s 401 %s %s :No such service.", u ? u->uid : source, ServerName, source, who);
1218 }
1219 
1220 /* 318 */
1221 void inspircd_cmd_318(char *source, char *who)
1222 {
1223  User *u = finduser(source);
1224  if (!source || !who)
1225  return;
1226 
1227  send_cmd(TS6SID, "PUSH %s ::%s 318 %s %s :End of /WHOIS list.", u ? u->uid : source, ServerName, source, who);
1228 }
1229 
1230 /* 242 */
1231 void inspircd_cmd_242(char *buf)
1232 {
1233  char *target;
1234  User *u;
1235 
1236  if (!buf)
1237  return;
1238 
1239  target = myStrGetToken(buf, ' ', 0);
1240  u = finduser(target);
1241  free(target);
1242  if (!u) return;
1243 
1244  send_cmd(TS6SID, "PUSH %s ::%s 242 %s", u->uid, ServerName, buf);
1245 }
1246 
1247 /* 243 */
1248 void inspircd_cmd_243(char *buf)
1249 {
1250  char *target;
1251  User *u;
1252 
1253  if (!buf)
1254  return;
1255 
1256  target = myStrGetToken(buf, ' ', 0);
1257  u = finduser(target);
1258  free(target);
1259  if (!u) return;
1260 
1261  send_cmd(TS6SID, "PUSH %s ::%s 243 %s", u->uid, ServerName, buf);
1262 }
1263 
1264 /* 211 */
1265 void inspircd_cmd_211(char *buf)
1266 {
1267  char *target;
1268  User *u;
1269 
1270  if (!buf)
1271  return;
1272 
1273  target = myStrGetToken(buf, ' ', 0);
1274  u = finduser(target);
1275  free(target);
1276  if (!u) return;
1277 
1278  send_cmd(TS6SID, "PUSH %s ::%s 211 %s", u->uid, ServerName, buf);
1279 }
1280 
1281 /* GLOBOPS */
1282 void inspircd_cmd_global(char *source, char *buf)
1283 {
1284  Uid *ud = NULL;
1285  if (!buf)
1286  return;
1287 
1288  if (source) ud = find_uid(source);
1289  if (!ud) ud = find_uid(s_OperServ);
1290 
1291  send_cmd(ud ? ud->uid : TS6SID, "SNONOTICE g :%s", buf);
1292 }
1293 
1294 /* SQLINE */
1295 void inspircd_cmd_sqline(char *mask, char *reason)
1296 {
1297  if (!mask || !reason)
1298  return;
1299 
1300  send_cmd(TS6SID, "ADDLINE Q %s %s %ld 0 :%s", mask, s_OperServ,
1301  (long int) time(NULL), reason);
1302 }
1303 
1304 /* SQUIT */
1305 void inspircd_cmd_squit(char *servname, char *message)
1306 {
1307  if (!servname || !message)
1308  return;
1309 
1310  send_cmd(TS6SID, "SQUIT %s :%s", servname, message);
1311 }
1312 
1313 /* SVSO */
1314 void inspircd_cmd_svso(char *source, char *nick, char *flag)
1315 {
1316 }
1317 
1318 /* NICK <newnick> */
1319 void inspircd_cmd_chg_nick(char *oldnick, char *newnick)
1320 {
1321  Uid *ud;
1322  if (!oldnick || !newnick)
1323  return;
1324  ud = find_uid(oldnick);
1325  if (!ud)
1326  ud = find_uid(newnick);
1327 
1328  if (ud)
1329  strscpy(ud->nick, newnick, NICKMAX);
1330  send_cmd(ud ? ud->uid : oldnick, "NICK %s %ld", newnick, time(NULL));
1331 }
1332 
1333 /* SVSNICK */
1334 void inspircd_cmd_svsnick(char *source, char *guest, time_t when)
1335 {
1336  User *u;
1337 
1338  if (!source || !guest)
1339  return;
1340 
1341  u = finduser(source);
1342  /* Please note that inspircd will now echo back a nickchange for this SVSNICK. */
1343  send_cmd(TS6SID, "SVSNICK %s %s %lu", u ? u->uid : source, guest, (unsigned long) when);
1344 }
1345 
1346 /* Functions that use serval cmd functions */
1347 
1348 void inspircd_cmd_vhost_on(char *nick, char *vIdent, char *vhost)
1349 {
1350  if (!nick)
1351  return;
1352 
1353  if (vIdent)
1354  inspircd_cmd_chgident(nick, vIdent);
1355 
1356  inspircd_cmd_chghost(nick, vhost);
1357 }
1358 
1360 {
1361  if (servernum == 1) {
1363  }
1364  if (servernum == 2) {
1366  }
1367  if (servernum == 3) {
1369  }
1370  send_cmd(NULL, "CAPAB START 1202");
1371  send_cmd(NULL, "CAPAB CAPABILITIES :PROTOCOL=1202");
1372  send_cmd(NULL, "CAPAB END");
1375 }
1376 
1378 {
1379  send_cmd(TS6SID, "BURST");
1380  send_cmd(TS6SID, "VERSION :Anope-%s %s :%s - %s (%s) -- %s",
1383 }
1384 
1385 /* Events */
1386 
1387 int anope_event_ping(char *source, int ac, char **av)
1388 {
1389  if (ac < 1)
1390  return MOD_CONT;
1391 
1392  if (ac < 2)
1393  inspircd_cmd_pong(TS6SID, av[0]);
1394 
1395  if (ac == 2) {
1396  char buf[BUFSIZE];
1397  snprintf(buf, BUFSIZE - 1, "%s %s", av[1], av[0]);
1398  inspircd_cmd_pong(TS6SID, buf);
1399  }
1400  return MOD_CONT;
1401 }
1402 
1403 int anope_event_436(char *source, int ac, char **av)
1404 {
1405  if (ac < 1)
1406  return MOD_CONT;
1407 
1408  m_nickcoll(av[0]);
1409  return MOD_CONT;
1410 }
1411 
1412 int anope_event_away(char *source, int ac, char **av)
1413 {
1414  User *u;
1415  if (!source)
1416  return MOD_CONT;
1417 
1418  u = find_byuid(source);
1419  m_away(u ? u->nick : source, (ac ? av[0] : NULL));
1420  return MOD_CONT;
1421 }
1422 
1423 int anope_event_topic(char *source, int ac, char **av)
1424 {
1425  Channel *c = findchan(av[0]);
1426  time_t topic_time = time(NULL);
1427  User *u = find_byuid(source);
1428 
1429  if (!c) {
1430  if (debug) {
1431  alog("debug: TOPIC %s for nonexistent channel %s",
1432  merge_args(ac - 1, av + 1), av[0]);
1433  }
1434  return MOD_CONT;
1435  }
1436 
1437  if (check_topiclock(c, topic_time))
1438  return MOD_CONT;
1439 
1440  if (c->topic) {
1441  free(c->topic);
1442  c->topic = NULL;
1443  }
1444  if (ac > 1 && *av[1])
1445  c->topic = sstrdup(av[1]);
1446 
1447  strscpy(c->topic_setter, u ? u->nick : source, sizeof(c->topic_setter));
1448  c->topic_time = topic_time;
1449 
1450  record_topic(av[0]);
1451 
1452  if (ac > 1 && *av[1])
1453  send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[1]);
1454  else
1455  send_event(EVENT_TOPIC_UPDATED, 2, av[0], "");
1456 
1457  return MOD_CONT;
1458 }
1459 
1460 int anope_event_squit(char *source, int ac, char **av)
1461 {
1462  Server *s;
1463 
1464  if (ac != 2)
1465  return MOD_CONT;
1466 
1467  s = findserver(servlist, av[0]);
1468  if (!s)
1469  s = findserver_uid(servlist, av[0]);
1470  if (s && (s->flags & SERVER_JUPED))
1471  {
1472  /* a squit for a juped server is not possible, this is an squit for a
1473  * server we have just juped and already internally quit. introduce the
1474  * new server now.
1475  */
1476  inspircd_cmd_server(s->name, s->hops, s->desc, s->suid);
1477  }
1478  else
1479  do_squit(source, ac, av);
1480 
1481  return MOD_CONT;
1482 }
1483 
1484 int anope_event_rsquit(char *source, int ac, char **av)
1485 {
1486  Server *s;
1487 
1488  if (ac < 1 || ac > 3)
1489  return MOD_CONT;
1490 
1491  /* On InspIRCd we must send a SQUIT when we receive RSQUIT for a server we have juped */
1492  s = findserver(servlist, av[0]);
1493  if (!s)
1494  s = findserver_uid(servlist, av[0]);
1495  if (s && s->flags & SERVER_JUPED)
1496  {
1497  send_cmd(TS6SID, "SQUIT %s :%s", s->suid, ac > 1 ? av[1] : "");
1498  }
1499 
1500  do_squit(source, ac, av);
1501  return MOD_CONT;
1502 }
1503 
1504 int anope_event_quit(char *source, int ac, char **av)
1505 {
1506  User *u;
1507 
1508  if (ac != 1)
1509  return MOD_CONT;
1510 
1511  u = find_byuid(source);
1512  do_quit(u ? u->nick : source, ac, av);
1513  return MOD_CONT;
1514 }
1515 
1516 
1517 int anope_event_mode(char *source, int ac, char **av)
1518 {
1519  if (ac < 2)
1520  return MOD_CONT;
1521 
1522  if (*av[0] == '#' || *av[0] == '&') {
1523  do_cmode(source, ac, av);
1524  } else {
1525  /* InspIRCd lets opers change another
1526  users modes, we have to kludge this
1527  as it slightly breaks RFC1459
1528  */
1529  User *u = find_byuid(source);
1530  User *u2 = find_byuid(av[0]);
1531 
1532  /* This can happen with server-origin modes. */
1533  if (u == NULL)
1534  u = u2;
1535 
1536  /* If it's still null, drop it like fire.
1537  * most likely situation was that server introduced a nick
1538  * which we subsequently akilled */
1539  if (u == NULL || u2 == NULL)
1540  return MOD_CONT;
1541 
1542  av[0] = u2->nick;
1543  do_umode(u->nick, ac, av);
1544  }
1545  return MOD_CONT;
1546 }
1547 
1548 
1549 int anope_event_kill(char *source, int ac, char **av)
1550 {
1551  Uid *ud;
1552  User *u;
1553 
1554  if (ac != 2)
1555  return MOD_CONT;
1556 
1557  u = find_byuid(av[0]);
1558  ud = find_nickuid(av[0]);
1559 
1560  m_kill(u ? u->nick : (ud ? ud->nick : av[0]), av[1]);
1561  return MOD_CONT;
1562 }
1563 
1564 int anope_event_kick(char *source, int ac, char **av)
1565 {
1566  if (ac != 3)
1567  return MOD_CONT;
1568  do_kick(source, ac, av);
1569  return MOD_CONT;
1570 }
1571 
1572 
1573 int anope_event_join(char *source, int ac, char **av)
1574 {
1575  if (ac != 2)
1576  return MOD_CONT;
1577  do_join(source, ac, av);
1578  return MOD_CONT;
1579 }
1580 
1581 int anope_event_motd(char *source, int ac, char **av)
1582 {
1583  if (!source)
1584  return MOD_CONT;
1585 
1586  m_motd(source);
1587  return MOD_CONT;
1588 }
1589 
1590 int anope_event_setname(char *source, int ac, char **av)
1591 {
1592  User *u;
1593 
1594  if (ac != 1)
1595  return MOD_CONT;
1596 
1597  u = find_byuid(source);
1598  if (!u) {
1599  if (debug) {
1600  alog("debug: SETNAME for nonexistent user %s", source);
1601  }
1602  return MOD_CONT;
1603  }
1604 
1605  change_user_realname(u, av[0]);
1606  return MOD_CONT;
1607 }
1608 
1609 int anope_event_chgname(char *source, int ac, char **av)
1610 {
1611  User *u;
1612 
1613  if (ac != 2)
1614  return MOD_CONT;
1615 
1616  u = find_byuid(source);
1617  if (!u) {
1618  if (debug) {
1619  alog("debug: FNAME for nonexistent user %s", source);
1620  }
1621  return MOD_CONT;
1622  }
1623 
1624  change_user_realname(u, av[0]);
1625  return MOD_CONT;
1626 }
1627 
1628 int anope_event_setident(char *source, int ac, char **av)
1629 {
1630  User *u;
1631 
1632  if (ac != 1)
1633  return MOD_CONT;
1634 
1635  u = find_byuid(source);
1636  if (!u) {
1637  if (debug) {
1638  alog("debug: SETIDENT for nonexistent user %s", source);
1639  }
1640  return MOD_CONT;
1641  }
1642 
1643  change_user_username(u, av[0]);
1644  return MOD_CONT;
1645 }
1646 
1647 int anope_event_chgident(char *source, int ac, char **av)
1648 {
1649  User *u;
1650 
1651  if (ac != 2)
1652  return MOD_CONT;
1653 
1654  u = find_byuid(source);
1655  if (!u) {
1656  if (debug) {
1657  alog("debug: CHGIDENT for nonexistent user %s", av[0]);
1658  }
1659  return MOD_CONT;
1660  }
1661 
1662  change_user_username(u, av[0]);
1663  return MOD_CONT;
1664 }
1665 
1666 int anope_event_sethost(char *source, int ac, char **av)
1667 {
1668  User *u;
1669 
1670  if (ac != 1)
1671  return MOD_CONT;
1672 
1673  u = find_byuid(source);
1674  if (!u) {
1675  if (debug) {
1676  alog("debug: SETHOST for nonexistent user %s", source);
1677  }
1678  return MOD_CONT;
1679  }
1680 
1681  change_user_host(u, av[0]);
1682  return MOD_CONT;
1683 }
1684 
1685 int anope_event_nick(char *source, int ac, char **av)
1686 {
1687  do_nick(source, av[0], NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
1688  return MOD_CONT;
1689 }
1690 
1691 /*
1692  * [Nov 03 22:09:58.176252 2009] debug: Received: :964 UID 964AAAAAC 1225746297 w00t2 localhost testnet.user w00t 127.0.0.1 1225746302 +iosw +ACGJKLNOQcdfgjklnoqtx :Robin Burchell <w00t@inspircd.org>
1693  * 0: uid
1694  * 1: ts
1695  * 2: nick
1696  * 3: host
1697  * 4: dhost
1698  * 5: ident
1699  * 6: ip
1700  * 7: signon
1701  * 8+: modes and params -- IMPORTANT, some modes (e.g. +s) may have parameters. So don't assume a fixed position of realname!
1702  * last: realname
1703  *
1704  * For now we assume that if we get a +r, the user owns the nick... THIS IS NOT TRUE!!!
1705  * If a user changes nick, he keeps his +r, but his METADATA will be incorrect. So we will be cancelling this
1706  * if we don't get a matching METDATA for him.. ~Viper
1707  */
1708 int anope_event_uid(char *source, int ac, char **av)
1709 {
1710  User *user = NULL;
1711  struct in_addr addy;
1712  Server *s = findserver_uid(servlist, source);
1713  uint32 *ad = (uint32 *) & addy;
1714  int ts = strtoul(av[1], NULL, 10);
1715  int regged = ((strchr(av[8], 'r') != NULL) ? ts : 0);
1716 
1717  /* The previously introduced user got recognized, but didn't deserve it.
1718  * Invalidate the recognition. */
1719  user = u_intro_regged;
1720  u_intro_regged = NULL;
1721  if (user) {
1722  if (debug)
1723  alog("debug: User %s had +r but received no account info.", user->nick);
1724  if (user->na)
1725  user->na->status &= ~NS_RECOGNIZED;
1726  validate_user(user);
1727  common_svsmode(user, "-r", NULL);
1728  }
1729  user = NULL;
1730 
1731  inet_aton(av[6], &addy);
1732  /* do_nick() will mark the user as recognized - not identified - for now.
1733  * It is up to the protocol module to either mark the user as identified or invalidate the
1734  * recognition in a later stage. ~ Viper */
1735  user = do_nick("", av[2], /* nick */
1736  av[5], /* username */
1737  av[3], /* realhost */
1738  s->name, /* server */
1739  av[ac - 1], /* realname */
1740  ts, regged && burst ? 2 : 0, htonl(*ad), av[4], av[0]);
1741 
1742  if (user) {
1743  /* Unless we receive metadata, this user will be logged out next run... */
1744  if (regged && burst && user->na) u_intro_regged = user;
1745  anope_set_umode(user, 1, &av[8]);
1746  }
1747  return MOD_CONT;
1748 }
1749 
1750 /*
1751  * We need to process the METADATA accountname information to check whether people are actually using their own nicks.
1752  * We cannot trust +r since it is not removed upon nick change, so people would be able to take over nicks by changing to them while
1753  * services are down. To prevent this we compare their accountname info and make sure it s the same as their display nick. ~ Viper
1754  */
1755 int anope_event_metadata(char *source, int ac, char **av)
1756 {
1757  User *u;
1758  Server *s;
1759  NickAlias *na;
1760 
1761  if (ac != 3 || !u_intro_regged || !burst)
1762  return MOD_CONT;
1763 
1764  s = findserver_uid(servlist, source);
1765  if (!s) {
1766  if (debug) alog("debug: Received METADATA from unknown source.");
1767  return MOD_CONT;
1768  }
1769  if (strcmp(av[1], "accountname"))
1770  return MOD_CONT;
1771 
1772  u = find_byuid(av[0]);
1773  if (!u) {
1774  if (debug) alog("debug: METADATA for nonexistent user %s.", av[0]);
1775  return MOD_CONT;
1776  }
1777  if (u != u_intro_regged) {
1778  if (debug) alog("debug: ERROR: Expected different user in METADA.");
1779  return MOD_CONT;
1780  }
1781  u_intro_regged = NULL;
1782 
1783  na = findnick(av[2]);
1784  if (na && u->na) {
1785  if (na->nc == u->na->nc) {
1786  /* The user was previously ID'd to the same nickgroup. Auto-ID him. */
1787  u->na->status |= NS_IDENTIFIED;
1788  check_memos(u);
1789 
1790  if (NSNickTracking)
1792 
1793  u->na->last_seen = time(NULL);
1794  if (u->na->last_usermask)
1795  free(u->na->last_usermask);
1796  u->na->last_usermask =
1797  smalloc(strlen(common_get_vident(u)) +
1798  strlen(common_get_vhost(u)) + 2);
1799  sprintf(u->na->last_usermask, "%s@%s",
1801 
1802  alog("%s: %s!%s@%s automatically identified for nick %s",
1803  s_NickServ, u->nick, u->username, u->host, u->nick);
1804  } else {
1805  /* The user was not previously ID'd to this nickgroup but another...
1806  * Invalidate the recognition. */
1807  if (debug)
1808  alog("debug: User %s had +r but did not receive matching account info.", u->nick);
1809  u->na->status &= ~NS_RECOGNIZED;
1810  common_svsmode(u, "-r", NULL);
1811  validate_user(u);
1812  }
1813  }
1814 
1815  return MOD_CONT;
1816 }
1817 
1818 int anope_event_burst(char *source, int ac, char **av)
1819 {
1820  /* As of now a burst is in progress.. */
1821  burst = 1;
1822 
1823  return MOD_CONT;
1824 }
1825 
1826 int anope_event_eob(char *source, int ac, char **av)
1827 {
1828  Server *s = findserver_uid(servlist, source);
1829  User *u = u_intro_regged;
1830  u_intro_regged = NULL;
1831 
1832  /* The burst is complete.. check if there was a user that got recognized and still needs to be invalidated.*/
1833  if (u) {
1834  if (u->na)
1835  u->na->status &= ~NS_RECOGNIZED;
1836  common_svsmode(u, "-r", NULL);
1837  validate_user(u);
1838  }
1839 
1840  if (s != NULL)
1841  finish_sync(s, 1);
1842 
1843  /* End of burst.. */
1844  burst = 0;
1845 
1846  return MOD_CONT;
1847 }
1848 
1849 int anope_event_chghost(char *source, int ac, char **av)
1850 {
1851  User *u;
1852 
1853  if (ac != 1)
1854  return MOD_CONT;
1855 
1856  u = find_byuid(source);
1857  if (!u) {
1858  if (debug) {
1859  alog("debug: FHOST for nonexistent user %s.", source);
1860  }
1861  return MOD_CONT;
1862  }
1863 
1864  change_user_host(u, av[0]);
1865  return MOD_CONT;
1866 }
1867 
1868 /*
1869  * [Nov 04 00:08:46.308435 2009] debug: Received: SERVER irc.inspircd.com pass 0 964 :Testnet Central!
1870  * 0: name
1871  * 1: pass
1872  * 2: hops
1873  * 3: numeric
1874  * 4: desc
1875  */
1876 int anope_event_server(char *source, int ac, char **av)
1877 {
1878  if (!stricmp(av[2], "0")) {
1879  uplink = sstrdup(av[0]);
1880  }
1881  do_server(source, av[0], av[2], av[4], av[3]);
1882  return MOD_CONT;
1883 }
1884 
1885 
1886 int anope_event_privmsg(char *source, int ac, char **av)
1887 {
1888  Uid *ud;
1889  User *u = find_byuid(source);
1890 
1891  if (ac != 2 || !u)
1892  return MOD_CONT;
1893 
1894  ud = find_nickuid(av[0]);
1895  m_privmsg((u ? u->nick : source), (ud ? ud->nick : av[0]), av[1]);
1896  return MOD_CONT;
1897 }
1898 
1899 int anope_event_part(char *source, int ac, char **av)
1900 {
1901  User *u;
1902  if (ac < 1 || ac > 2)
1903  return MOD_CONT;
1904 
1905  u = find_byuid(source);
1906  do_part((u ? u->nick : source), ac, av);
1907  return MOD_CONT;
1908 }
1909 
1910 int anope_event_whois(char *source, int ac, char **av)
1911 {
1912  if (source && ac >= 1) {
1913  m_whois(source, av[0]);
1914  }
1915  return MOD_CONT;
1916 }
1917 
1918 int anope_event_capab(char *source, int ac, char **av)
1919 {
1920  char *argv[6];
1921 
1922  if (strcasecmp(av[0], "START") == 0) {
1923  if (ac < 2 || atoi(av[1]) < 1202)
1924  {
1925  send_cmd(NULL, "ERROR :Protocol mismatch, no or invalid protocol version given in CAPAB START");
1926  quitmsg = "Protocol mismatch, no or invalid protocol version given in CAPAB START";
1927  quitting = 1;
1928  return MOD_STOP;
1929  }
1930  /* reset CAPAB */
1931  has_servicesmod = 0;
1932  has_chghostmod = 0;
1933  has_chgidentmod = 0;
1934  has_servprotectmod = 0;
1935  has_hidechansmod = 0;
1936  } else if (strcasecmp(av[0], "MODSUPPORT") == 0) {
1937  if (strstr(av[1], "m_services_account.so"))
1938  has_servicesmod = 1;
1939  if (strstr(av[1], "m_chghost.so"))
1940  has_chghostmod = 1;
1941  if (strstr(av[1], "m_chgident.so"))
1942  has_chgidentmod = 1;
1943  } else if (strcasecmp(av[0], "MODULES") == 0) {
1944  if (strstr(av[1], "m_svshold.so"))
1945  ircd->svshold = 1;
1946  if (strstr(av[1], "m_cloaking.so"))
1947  has_cloaking = 1;
1948  } else if (strcasecmp(av[0], "CHANMODES") == 0) {
1949  char **argv;
1950  int argc = split_buf(av[1], &argv, 1);
1951  int i;
1952 
1953  for (i = 0; i < argc; ++i)
1954  {
1955  char *modename = argv[i];
1956  char *modechar = strchr(modename, '=');
1957  if (!modechar)
1958  continue;
1959  *modechar++ = 0;
1960 
1961  if (!strcasecmp(modename, "ban"))
1962  {
1963  myCmmodes[(int) *modechar].addmask = add_ban;
1964  myCmmodes[(int) *modechar].delmask = del_ban;
1965  }
1966  else if (!strcasecmp(modename, "banexception"))
1967  {
1968  myCmmodes[(int) *modechar].addmask = add_exception;
1969  myCmmodes[(int) *modechar].delmask = del_exception;
1970  ircd->except = 1;
1971  }
1972  else if (!strcasecmp(modename, "invex"))
1973  {
1974  myCmmodes[(int) *modechar].addmask = add_invite;
1975  myCmmodes[(int) *modechar].delmask = del_invite;
1976  ircd->invitemode = 1;
1977  }
1978  else if (!strcasecmp(modename, "admin"))
1979  {
1980  ircd->botchanumode = "+ao";
1981  ircd->protect = 1;
1982 
1983  myCumodes[(int) *(modechar + 1)].status = CUS_PROTECT;
1984  myCumodes[(int) *(modechar + 1)].flags = CUF_PROTECT_BOTSERV;
1985  myCumodes[(int) *(modechar + 1)].is_valid = check_valid_op;
1986  }
1987  else if (!strcasecmp(modename, "founder"))
1988  {
1989  ircd->owner = 1;
1990 
1991  myCumodes[(int) *(modechar + 1)].status = CUS_OWNER;
1992  myCumodes[(int) *(modechar + 1)].flags = 0;
1993  myCumodes[(int) *(modechar + 1)].is_valid = check_valid_op;
1994  }
1995  else if (!strcasecmp(modename, "halfop"))
1996  {
1997  ircd->halfop = 1;
1998 
1999  myCumodes[(int) *(modechar + 1)].status = CUS_HALFOP;
2000  myCumodes[(int) *(modechar + 1)].flags = 0;
2001  myCumodes[(int) *(modechar + 1)].is_valid = check_valid_op;
2002  }
2003  else if (!strcasecmp(modename, "flood"))
2004  {
2005  CBModeInfo *cb = find_cbinfo(*modechar);
2006  if (cb)
2007  {
2008  cb->getvalue = get_flood;
2009  cb->csgetvalue = cs_get_flood;
2010  }
2011 
2012  myCbmodes[(int) *modechar].flag = CMODE_f;
2013  myCbmodes[(int) *modechar].setvalue = set_flood;
2014  myCbmodes[(int) *modechar].cssetvalue = cs_set_flood;
2015 
2016  snprintf(flood_mode_set, sizeof(flood_mode_set), "+%c", *modechar);
2017  snprintf(flood_mode_unset, sizeof(flood_mode_unset), "-%c", *modechar);
2018 
2019  ircd->fmode = 1;
2020  }
2021  else if (!strcasecmp(modename, "joinflood"))
2022  {
2023  CBModeInfo *cb = find_cbinfo(*modechar);
2024  if (cb)
2025  {
2026  cb->getvalue = get_throttle;
2028  }
2029 
2030  myCbmodes[(int) *modechar].flag = CMODE_j;
2031  myCbmodes[(int) *modechar].flags |= CBM_NO_MLOCK;
2032  myCbmodes[(int) *modechar].setvalue = chan_set_throttle;
2033  myCbmodes[(int) *modechar].cssetvalue = cs_set_throttle;
2034 
2035  ircd->jmode = 1;
2036  }
2037  else if (!strcasecmp(modename, "redirect"))
2038  {
2039  CBModeInfo *cb = find_cbinfo(*modechar);
2040  if (cb)
2041  {
2042  cb->getvalue = get_redirect;
2044  }
2045 
2046  myCbmodes[(int) *modechar].flag = CMODE_L;
2047  myCbmodes[(int) *modechar].setvalue = set_redirect;
2048  myCbmodes[(int) *modechar].cssetvalue = cs_set_redirect;
2049 
2050  ircd->Lmode = 1;
2051  }
2052  else if (!strcasecmp(modename, "filter") || !strcasecmp(modename, "kicknorejoin"))
2053  {
2054  myCbmodes[(int) *modechar].flags |= CBM_NO_MLOCK;
2055  }
2056  else if (!strcasecmp(modename, "operonly") || !strcasecmp(modename, "permanent"))
2057  {
2058  myCbmodes[(int) *modechar].flags |= CBM_NO_USER_MLOCK;
2059  }
2060  }
2061  } else if (strcasecmp(av[0], "USERMODES") == 0) {
2062  char **argv;
2063  int argc = split_buf(av[1], &argv, 1);
2064  int i;
2065 
2066  for (i = 0; i < argc; ++i)
2067  {
2068  char *name = argv[i];
2069  char *value = strchr(name, '=');
2070  if (!value)
2071  continue;
2072  *value++ = 0;
2073 
2074  if (!strcasecmp(name, "hidechans"))
2075  has_hidechansmod = 1;
2076  else if (!strcasecmp(name, "servprotect"))
2077  has_servprotectmod = 1;
2078  }
2079  } else if (strcasecmp(av[0], "CAPABILITIES") == 0) {
2080  char **argv;
2081  int argc = split_buf(av[1], &argv, 1);
2082  int i;
2083 
2084  for (i = 0; i < argc; ++i)
2085  {
2086  char *name = argv[i];
2087  char *value = strchr(name, '=');
2088  if (!value)
2089  continue;
2090  *value++ = 0;
2091 
2092  /* PREFIX=(yqaohvV)!~&@%+- */
2093  if (!strcasecmp(name, "PREFIX") && value)
2094  {
2095  int prefixlen = strlen(value), j;
2096 
2097  for (j = 0; j < prefixlen / 2; ++j)
2098  {
2099  switch (value[j])
2100  {
2101  case '(':
2102  case ')':
2103  break;
2104  default:
2105  if (debug)
2106  alog("Tied %c => %c", value[prefixlen / 2 + j], value[j]);
2107  myCsmodes[(int) value[prefixlen / 2 + j]] = value[j];
2108  if (!myCumodes[(int) value[j]].status)
2109  {
2110  myCumodes[(int) value[j]].status = get_new_statusmode();
2111  myCumodes[(int) value[j]].flags = 0;
2112  myCumodes[(int) value[j]].is_valid = check_valid_op;
2113  }
2114  break;
2115  }
2116  }
2117  }
2118  /* CHANMODES=IXYZbegw,k,FHJLdfjl,ABCDGKMNOPQRSTcimnprstuz
2119  * listmodes, unset with param, unset no param, regular
2120  */
2121  else if (!strcasecmp(name, "CHANMODES"))
2122  {
2123  char *listmodes = myStrGetToken(value, ',', 0);
2124  char *unsetparam = myStrGetToken(value, ',', 1);
2125  char *unsetnoparam = myStrGetToken(value, ',', 2);
2126  char *regular = myStrGetToken(value, ',', 3);
2127 
2128  if (listmodes)
2129  {
2130  int i;
2131  for (i = 0; i < strlen(listmodes); ++i)
2132  {
2133  if (!myCmmodes[(int) listmodes[i]].addmask)
2134  myCmmodes[(int) listmodes[i]].addmask = do_nothing;
2135  if (!myCmmodes[(int) listmodes[i]].delmask)
2136  myCmmodes[(int) listmodes[i]].delmask = do_nothing;
2137  }
2138  }
2139  if (unsetparam)
2140  {
2141  int i;
2142  for (i = 0; i < strlen(unsetparam); ++i)
2143  {
2144  CBModeInfo *cb = find_cbinfo(unsetparam[i]);
2145  if (cb)
2146  {
2147  if (!cb->getvalue)
2148  cb->getvalue = get_unkwn;
2149  if (!cb->csgetvalue)
2150  cb->csgetvalue = cs_get_unkwn;
2151  }
2152 
2153  myCbmodes[(int) unsetparam[i]].flag = get_mode_from_char(unsetparam[i]);
2154  if (!myCbmodes[(int) unsetparam[i]].setvalue)
2155  myCbmodes[(int) unsetparam[i]].setvalue = set_unkwn;
2156  if (!myCbmodes[(int) unsetparam[i]].cssetvalue)
2157  myCbmodes[(int) unsetparam[i]].cssetvalue = cs_set_unkwn;
2158  }
2159  }
2160  if (unsetnoparam)
2161  {
2162  int i;
2163  for (i = 0; i < strlen(unsetnoparam); ++i)
2164  {
2165  CBModeInfo *cb = find_cbinfo(unsetnoparam[i]);
2166  if (cb)
2167  {
2168  cb->flags |= CBM_MINUS_NO_ARG;
2169 
2170  if (!cb->getvalue)
2171  cb->getvalue = get_unkwn;
2172  if (!cb->csgetvalue)
2173  cb->csgetvalue = cs_get_unkwn;
2174  }
2175 
2176  myCbmodes[(int) unsetnoparam[i]].flag = get_mode_from_char(unsetnoparam[i]);
2177  myCbmodes[(int) unsetnoparam[i]].flags |= CBM_MINUS_NO_ARG;
2178  if (!myCbmodes[(int) unsetnoparam[i]].setvalue)
2179  myCbmodes[(int) unsetnoparam[i]].setvalue = set_unkwn;
2180  if (!myCbmodes[(int) unsetnoparam[i]].cssetvalue)
2181  myCbmodes[(int) unsetnoparam[i]].cssetvalue = cs_set_unkwn;
2182  }
2183  }
2184  if (regular)
2185  {
2186  int i;
2187  for (i = 0; i < strlen(regular); ++i)
2188  {
2189  CBModeInfo *cb = find_cbinfo(regular[i]);
2190  if (cb)
2191  {
2192  cb->getvalue = NULL;
2193  cb->csgetvalue = NULL;
2194  }
2195 
2196  myCbmodes[(int) regular[i]].flag = get_mode_from_char(regular[i]);
2197  myCbmodes[(int) regular[i]].setvalue = NULL;
2198  myCbmodes[(int) regular[i]].cssetvalue = NULL;
2199  }
2200  }
2201 
2202  if (listmodes)
2203  free(listmodes);
2204  if (unsetparam)
2205  free(unsetparam);
2206  if (unsetnoparam)
2207  free(unsetnoparam);
2208  if (regular)
2209  free(regular);
2210  }
2211  }
2212  } else if (strcasecmp(av[0], "END") == 0) {
2213  if (!has_servicesmod) {
2214  send_cmd(NULL, "ERROR :m_services_account is not loaded. This is required by Anope");
2215  quitmsg = "Remote server does not have the m_services_account module loaded, and this is required.";
2216  quitting = 1;
2217  return MOD_STOP;
2218  }
2219  if (!has_hidechansmod) {
2220  send_cmd(NULL, "ERROR :m_hidechans is not loaded. This is required by Anope");
2221  quitmsg = "Remote server does not have the m_hidechans module loaded, and this is required.";
2222  quitting = 1;
2223  return MOD_STOP;
2224  }
2225  if (!ircd->svshold) {
2226  anope_cmd_global(s_OperServ, "SVSHOLD missing, Usage disabled until module is loaded.");
2227  }
2228  if (!has_chghostmod) {
2229  anope_cmd_global(s_OperServ, "CHGHOST missing, Usage disabled until module is loaded.");
2230  }
2231  if (!has_chgidentmod) {
2232  anope_cmd_global(s_OperServ, "CHGIDENT missing, Usage disabled until module is loaded.");
2233  }
2234 
2235  if (has_servprotectmod) {
2236  ircd->nickservmode = "+oIk";
2237  ircd->chanservmode = "+oIk";
2238  ircd->memoservmode = "+Ik";
2239  ircd->hostservmode = "+oIk";
2240  ircd->operservmode = "+ioIk";
2241  ircd->botservmode = "+Ik";
2242  ircd->helpservmode = "+Ik";
2243  ircd->devnullmode = "+iIk";
2244  ircd->globalmode = "+iIk";
2245 
2246  ircd->nickservaliasmode = "+oIk";
2247  ircd->chanservaliasmode = "+oIk";
2248  ircd->memoservaliasmode = "+Ik";
2249  ircd->hostservaliasmode = "+oIk";
2250  ircd->operservaliasmode = "+ioIk";
2251  ircd->botservaliasmode = "+Ik";
2252  ircd->helpservaliasmode = "+Ik";
2253  ircd->devnullvaliasmode = "+iIk";
2254  ircd->globalaliasmode = "+iIk";
2255 
2256  ircd->botserv_bot_mode = "+Ik";
2257  alog("Support for usermode +k enabled. Pseudo-clients will be gods.");
2258  }
2259 
2260  /* Generate a fake capabs parsing call so things like NOQUIT work
2261  * fine. It's ugly, but it works....
2262  */
2263  argv[0] = "NOQUIT";
2264  argv[1] = "SSJ3";
2265  argv[2] = "NICK2";
2266  argv[3] = "VL";
2267  argv[4] = "TLKEXT";
2268  argv[5] = "UNCONNECT";
2269 
2270  capab_parse(6, argv);
2271 
2272  /* check defcon */
2274  {
2275  send_cmd(TS6SID, "ERROR :Defcon modes failed to validate");
2276  quitmsg = "Defcon modes failed to validate";
2277  quitting = 1;
2278  return MOD_CONT;
2279  }
2280 
2281  /* We have received our CAPAB, now we can introduce our clients. */
2282  init_tertiary();
2283  }
2284 
2285  pmodule_ircd_cbmodeinfos(myCbmodeinfos);
2286  pmodule_ircd_cumodes(myCumodes);
2289  pmodule_ircd_cbmodes(myCbmodes);
2290  pmodule_ircd_cmmodes(myCmmodes);
2292 
2293  return MOD_CONT;
2294 }
2295 
2296 /* SVSHOLD - set */
2297 void inspircd_cmd_svshold(char *nick)
2298 {
2299  Uid *ud = find_uid(s_OperServ);
2300  send_cmd(ud->uid, "SVSHOLD %s %ds :%s", nick, NSReleaseTimeout,
2301  "Being held for registered user");
2302 }
2303 
2304 /* SVSHOLD - release */
2306 {
2307  Uid *ud = find_uid(s_OperServ);
2308  send_cmd(ud->uid, "SVSHOLD %s", nick);
2309 }
2310 
2311 /* UNSGLINE */
2312 void inspircd_cmd_unsgline(char *mask)
2313 {
2314  /* Not Supported by this IRCD */
2315 }
2316 
2317 /* UNSZLINE */
2318 void inspircd_cmd_unszline(char *mask)
2319 {
2320  send_cmd(TS6SID, "DELLINE Z %s", mask);
2321 }
2322 
2323 /* SZLINE */
2324 void inspircd_cmd_szline(char *mask, char *reason, char *whom)
2325 {
2326  send_cmd(TS6SID, "ADDLINE Z %s %s %ld 0 :%s", mask, whom,
2327  (long int) time(NULL), reason);
2328 }
2329 
2330 /* SGLINE */
2331 void inspircd_cmd_sgline(char *mask, char *reason)
2332 {
2333  /* Not Supported by this IRCD */
2334 }
2335 
2336 void inspircd_cmd_unban(char *name, char *nick)
2337 {
2338  /* Not Supported by this IRCD */
2339 }
2340 
2341 /* SVSMODE channel modes */
2342 
2343 void inspircd_cmd_svsmode_chan(char *name, char *mode, char *nick)
2344 {
2345  /* Not Supported by this IRCD */
2346 }
2347 
2348 
2349 /* SVSMODE +d */
2350 /* sent if svid is something weird */
2351 void inspircd_cmd_svid_umode(char *nick, time_t ts)
2352 {
2353  if (debug)
2354  alog("debug: common_svsmode(0)");
2355 }
2356 
2357 /* SVSMODE +d */
2358 /* nc_change was = 1, and there is no na->status */
2360 {
2361  if (debug)
2362  alog("debug: common_svsmode(1)");
2363  common_svsmode(u, "-r", NULL);
2364 }
2365 
2366 /* SVSMODE +r */
2367 void inspircd_cmd_svid_umode2(User * u, char *ts)
2368 {
2369  if (debug)
2370  alog("debug: common_svsmode(2)");
2371  common_svsmode(u, "+r", NULL);
2372 }
2373 
2374 void inspircd_cmd_svid_umode3(User * u, char *ts)
2375 {
2376  /* not used */
2377 }
2378 
2379 void inspircd_cmd_svsjoin(char *source, char *nick, char *chan, char *param)
2380 {
2381  User *u = finduser(nick);
2382  Uid *ud = (source ? find_uid(source) : NULL);
2383  send_cmd(ud ? ud->uid : source, "SVSJOIN %s %s", u ? u->uid : nick, chan);
2384 }
2385 
2386 void inspircd_cmd_svspart(char *source, char *nick, char *chan)
2387 {
2388  User *u = finduser(nick);
2389  Uid *ud = (source ? find_uid(source) : NULL);
2390  send_cmd(ud ? ud->uid : source, "SVSPART %s %s", u ? u->uid : nick, chan);
2391 }
2392 
2393 void inspircd_cmd_swhois(char *source, char *who, char *mask)
2394 {
2395  User *u = finduser(who);
2396  send_cmd(TS6SID, "METADATA %s swhois :%s", u ? u->uid : who, mask);
2397 }
2398 
2400 {
2401  send_cmd(TS6SID, "ENDBURST");
2402 }
2403 
2404 
2405 int anope_event_rehash(char *source, int ac, char **av)
2406 {
2407  return MOD_CONT;
2408 }
2409 
2410 int anope_event_credits(char *source, int ac, char **av)
2411 {
2412  return MOD_CONT;
2413 }
2414 
2415 int anope_event_admin(char *source, int ac, char **av)
2416 {
2417  return MOD_CONT;
2418 }
2419 
2421 {
2422  char *dp, *end;
2423 
2424  if (value && *value != ':'
2425  && (strtoul((*value == '*' ? value + 1 : value), &dp, 10) > 0)
2426  && (*dp == ':') && (*(++dp) != 0) && (strtoul(dp, &end, 10) > 0)
2427  && (*end == 0)) {
2428  return 1;
2429  } else {
2430  return 0;
2431  }
2432 }
2433 
2434 void inspircd_cmd_jupe(char *jserver, char *who, char *reason)
2435 {
2436  char rbuf[256];
2437  char *sid;
2438  boolean found = false;
2439  Server *s;
2440 
2441  for (sid = ts6_sid_retrieve(); findserver_uid(servlist, sid); sid = ts6_sid_retrieve());
2442 
2443  snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who,
2444  reason ? ": " : "", reason ? reason : "");
2445 
2446  if (findserver(servlist, jserver))
2447  {
2448  send_cmd(TS6SID, "RSQUIT %s :%s", jserver, rbuf);
2449  do_squit(who, 1, &jserver);
2450  found = true;
2451  }
2452  s = new_server(me_server, jserver, rbuf, SERVER_JUPED, sid);
2453  if (!found)
2454  inspircd_cmd_server(s->name, s->hops, s->desc, s->suid);
2455 }
2456 
2457 /* GLOBOPS - to handle old WALLOPS */
2458 void inspircd_cmd_global_legacy(char *source, char *fmt)
2459 {
2460  Uid *ud = NULL;
2461 
2462  if (source)
2463  ud = find_uid(source);
2464  if (!ud)
2465  ud = find_uid(s_OperServ);
2466 
2467  send_cmd(ud->uid, "SNONOTICE g :%s", fmt);
2468 }
2469 
2470 int inspircd_valid_nick(char *nick)
2471 {
2472  return 1;
2473 }
2474 
2475 int inspircd_valid_chan(char *chan)
2476 {
2477  return 1;
2478 }
2479 
2480 void inspircd_cmd_ctcp(char *source, char *dest, char *buf)
2481 {
2482  char *s;
2483  Uid *ud;
2484  User *u = finduser(dest);
2485 
2486  if (!buf) {
2487  return;
2488  } else {
2489  s = normalizeBuffer(buf);
2490  }
2491  ud = (source ? find_uid(source) : NULL);
2492 
2493  send_cmd(ud ? ud->uid : TS6SID, "NOTICE %s :\1%s\1", u ? u->uid : dest, s);
2494  free(s);
2495 }
2496 
2498 {
2499  char *tempValue, *one, *two;
2500  int param1 = 0;
2501  int param2 = 0;
2502 
2503  if (!value)
2504  return 0;
2505 
2506  tempValue = sstrdup(value);
2507  one = strtok(tempValue, ":");
2508  two = strtok(NULL, "");
2509  if (one && two) {
2510  param1 = atoi(one);
2511  param2 = atoi(two);
2512  }
2513  if ((param1 >= 1) && (param1 <= 255) && (param2 >= 1) && (param2 <= 999))
2514  return 1;
2515  return 0;
2516 }
2517 
2518 int anope_event_time(char *source, int ac, char **av)
2519 {
2520  if (ac !=2)
2521  return MOD_CONT;
2522 
2523  send_cmd(TS6SID, "TIME %s %s %ld", source, av[1], (long int) time(NULL));
2524 
2525  /* We handled it, don't pass it on to the core..
2526  * The core doesn't understand our syntax anyways.. */
2527  return MOD_STOP;
2528 }
2529 
2530 /*******************************************************************/
2531 
2532 /*
2533  * TS6 generator code, provided by DukePyrolator
2534  */
2535 
2536 static int ts6_sid_initted = 0;
2537 static char ts6_new_sid[4];
2538 
2539 int is_sid(char *sid)
2540 {
2541  /* Returns true if the string given is exactly 3 characters long,
2542  * starts with a digit, and the other two characters are A-Z or digits
2543  */
2544  return ((strlen(sid) == 3) && isdigit(sid[0]) &&
2545  ((sid[1] >= 'A' && sid[1] <= 'Z') || isdigit(sid[1])) &&
2546  ((sid[2] >= 'A' && sid[2] <= 'Z') || isdigit(sid[2])));
2547 }
2548 
2549 void ts6_sid_increment(unsigned pos)
2550 {
2551  /*
2552  * An SID must be exactly 3 characters long, starts with a digit,
2553  * and the other two characters are A-Z or digits
2554  * The rules for generating an SID go like this...
2555  * --> ABCDEFGHIJKLMNOPQRSTUVWXYZ --> 0123456789 --> WRAP
2556  */
2557  if (!pos) {
2558  /* At pos 0, if we hit '9', we've run out of available SIDs,
2559  * reset the SID to the smallest possible value and try again. */
2560  if (ts6_new_sid[pos] == '9') {
2561  ts6_new_sid[0] = '0';
2562  ts6_new_sid[1] = 'A';
2563  ts6_new_sid[2] = 'A';
2564  } else
2565  /* But if we haven't, just keep incrementing merrily. */
2566  ++ts6_new_sid[0];
2567  } else {
2568  if (ts6_new_sid[pos] == 'Z')
2569  ts6_new_sid[pos] = '0';
2570  else if (ts6_new_sid[pos] == '9') {
2571  ts6_new_sid[pos] = 'A';
2572  ts6_sid_increment(pos - 1);
2573  } else
2574  ++ts6_new_sid[pos];
2575  }
2576 }
2577 
2579 {
2580  if (!ts6_sid_initted) {
2581  /* Initialize ts6_new_sid with the services server SID */
2582  snprintf(ts6_new_sid, 4, "%s", TS6SID);
2583  ts6_sid_initted = 1;
2584  }
2585  while (1) {
2586  /* Check if the new SID is used by a known server */
2588  /* return the new SID */
2589  return ts6_new_sid;
2590 
2591  /* Add one to the last SID */
2592  ts6_sid_increment(2);
2593  }
2594  /* not reached */
2595  return "";
2596 }
2597 
2598 /*******************************************************************/
2599 
2605 {
2682 }
2683 
2687 int AnopeInit(int argc, char **argv)
2688 {
2689  int noforksave = nofork;
2690 
2691  moduleAddAuthor("Anope");
2692  moduleAddVersion(VERSION_STRING);
2694 
2695  if (!UseTS6) {
2696  nofork = 1; /* We're going down, set nofork so this error is printed */
2697  alog("FATAL ERROR: The InspIRCd 2.0 protocol module requires UseTS6 to be enabled in the services.conf.");
2698  nofork = noforksave;
2699  return MOD_STOP;
2700  }
2701 
2702  if (Numeric && is_sid(Numeric))
2703  TS6SID = sstrdup(Numeric);
2704  else {
2705  nofork = 1; /* We're going down, set nofork so this error is printed */
2706  alog("FATAL ERROR: The InspIRCd 2.0 protocol module requires the Numeric in the services.conf to contain a TS6SID.");
2707  nofork = noforksave;
2708  return MOD_STOP;
2709  }
2710 
2711  pmodule_ircd_version("InspIRCd 2.0");
2712  pmodule_ircd_cap(myIrcdcap);
2713  pmodule_ircd_var(myIrcd);
2714  pmodule_ircd_cbmodeinfos(myCbmodeinfos);
2715  pmodule_ircd_cumodes(myCumodes);
2718  pmodule_ircd_cbmodes(myCbmodes);
2719  pmodule_ircd_cmmodes(myCmmodes);
2722 
2732 
2735 
2736  return MOD_CONT;
2737 }
2738 
2739 /* EOF */
E int is_oper(User *user)
Definition: users.c:937
E void pmodule_cmd_vhost_off(void(*func)(User *u))
Definition: ircd.c:713
int anope_event_topic(char *source, int ac, char **av)
Definition: inspircd20.c:1423
void inspircd_cmd_akill(char *user, char *host, char *who, time_t when, time_t expires, char *reason)
Definition: inspircd20.c:642
E char * quitmsg
Definition: extern.h:792
static int has_servprotectmod
Definition: inspircd20.c:474
void inspircd_cmd_svsjoin(char *source, char *nick, char *chan, char *param)
Definition: inspircd20.c:2379
E void pmodule_permchan_mode(int mode)
Definition: ircd.c:1206
E void set_redirect(Channel *chan, char *value)
Definition: channels.c:2022
int(* is_valid)(User *user, Channel *chan, int servermode)
Definition: services.h:951
E Uid * find_uid(const char *nick)
Definition: users.c:453
E int32 opcnt
Definition: extern.h:1140
void inspircd_cmd_serv_privmsg(char *source, char *dest, char *msg)
Definition: inspircd20.c:964
E char * RemotePassword3
Definition: extern.h:270
CMMode myCmmodes[128]
Definition: inspircd20.c:259
E void pmodule_cmd_svspart(void(*func)(char *source, char *nick, char *chan))
Definition: ircd.c:1056
void inspircd_cmd_eob()
Definition: inspircd20.c:2399
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
void inspircd_cmd_bob()
Definition: inspircd20.c:1377
void inspircd_cmd_nick(char *nick, char *name, char *modes)
Definition: inspircd20.c:709
E void pmodule_cmd_bot_chan_mode(void(*func)(char *nick, char *chan))
Definition: ircd.c:827
static char flood_mode_unset[3]
Definition: inspircd20.c:68
#define UMODE_c
Definition: bahamut.h:30
void inspircd_cmd_unsqline(char *user)
Definition: inspircd20.c:1032
void inspircd_cmd_svshold(char *nick)
Definition: inspircd20.c:2297
void inspircd_cmd_privmsg2(char *source, char *dest, char *msg)
Definition: inspircd20.c:950
#define UMODE_R
Definition: bahamut.h:42
void inspircd_cmd_notice(char *source, char *dest, char *buf)
Definition: inspircd20.c:913
#define CMODE_T
Definition: inspircd12.h:52
int anope_event_idle(char *source, int ac, char **av)
Definition: inspircd20.c:748
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
E NickAlias * findnick(const char *nick)
Definition: db-merger.c:1857
void inspircd_cmd_svid_umode3(User *u, char *ts)
Definition: inspircd20.c:2374
int anope_event_privmsg(char *source, int ac, char **av)
Definition: inspircd20.c:1886
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 Lmode
Definition: services.h:350
E void cs_set_throttle(ChannelInfo *ci, char *value)
Definition: chanserv.c:2520
#define CUS_DEOPPED
Definition: services.h:1346
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
int anope_event_quit(char *source, int ac, char **av)
Definition: inspircd20.c:1504
int anope_event_mode(char *source, int ac, char **av)
Definition: inspircd20.c:1517
void inspircd_cmd_swhois(char *source, char *who, char *mask)
Definition: inspircd20.c:2393
int16 flags
Definition: services.h:949
static char currentpass[1024]
Definition: inspircd20.c:1003
void inspircd_cmd_372_error(char *source)
Definition: inspircd20.c:686
#define UMODE_w
Definition: bahamut.h:21
void inspircd_cmd_376(char *source)
Definition: inspircd20.c:702
#define CBM_MINUS_NO_ARG
Definition: services.h:928
void inspircd_cmd_chg_nick(char *oldnick, char *newnick)
Definition: inspircd20.c:1319
void inspircd_set_umode(User *user, int ac, char **av)
Definition: inspircd20.c:478
int anope_event_credits(char *source, int ac, char **av)
Definition: inspircd20.c:2410
E void change_user_username(User *user, const char *username)
Definition: users.c:170
E IRCDVar * ircd
Definition: extern.h:39
#define UMODE_k
Definition: bahamut.h:31
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 inspircd_cmd_211(char *buf)
Definition: inspircd20.c:1265
void inspircd_cmd_mode(char *source, char *dest, char *buf)
Definition: inspircd20.c:730
E void pmodule_ircd_cmmodes(CMMode modes[128])
Definition: ircd.c:1143
void inspircd_cmd_ctcp(char *source, char *dest, char *buf)
Definition: inspircd20.c:2480
E void do_kick(const char *source, int ac, char **av)
Definition: channels.c:638
E void cs_set_unkwn(ChannelInfo *ci, char *value)
Definition: chanserv.c:2594
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
#define CMODE_F
Definition: charybdis.h:42
uint32 flag
Definition: services.h:934
E int nick_identified(User *u)
Definition: nickserv.c:1111
void inspircd_cmd_privmsg(char *source, char *dest, char *buf)
Definition: inspircd20.c:936
void inspircd_cmd_unszline(char *mask)
Definition: inspircd20.c:2318
#define UMODE_I
Definition: bahamut.h:41
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
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
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
static char flood_mode_set[3]
Definition: inspircd20.c:67
E time_t start_time
Definition: extern.h:797
E void pmodule_cmd_211(void(*func)(char *buf))
Definition: ircd.c:924
E int NSNickTracking
Definition: extern.h:399
static int16 get_new_statusmode()
Definition: inspircd20.c:42
E void set_unkwn(Channel *chan, char *value)
Definition: channels.c:2037
IRCDVar myIrcd[]
Definition: inspircd20.c:72
void inspircd_cmd_svsmode_chan(char *name, char *mode, char *nick)
Definition: inspircd20.c:2343
E void pmodule_cmd_unsqline(void(*func)(char *user))
Definition: ircd.c:853
E void pmodule_cmd_sgline(void(*func)(char *mask, char *reason))
Definition: ircd.c:1007
static int has_cloaking
Definition: inspircd20.c:476
char * hostservmode
Definition: services.h:281
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
CUMode myCumodes[128]
Definition: inspircd20.c:419
int anope_event_ping(char *source, int ac, char **av)
Definition: inspircd20.c:1387
void inspircd_cmd_squit(char *servname, char *message)
Definition: inspircd20.c:1305
#define CMODE_l
Definition: bahamut.h:51
char * name
Definition: services.h:277
void inspircd_cmd_317(char *buf)
Definition: inspircd20.c:1181
#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
int anope_event_capab(char *source, int ac, char **av)
Definition: inspircd20.c:1918
#define NS_RECOGNIZED
Definition: services.h:1276
int anope_event_burst(char *source, int ac, char **av)
Definition: inspircd20.c:1818
E char * ServerDesc
Definition: extern.h:275
E int nofork
Definition: extern.h:779
E void pmodule_cmd_bob(void(*func)())
Definition: ircd.c:976
#define CMODE_C
Definition: inspircd11.h:45
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
uint32 svid
Definition: services.h:888
E User * find_byuid(const char *uid)
Definition: users.c:378
char * memoservaliasmode
Definition: services.h:289
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_version(char *source, int ac, char **av)
Definition: inspircd20.c:743
int anope_event_ftopic(char *source, int ac, char **av)
Definition: inspircd20.c:762
#define CMODE_M
Definition: bahamut.h:55
char * host
Definition: services.h:878
E int DefConLevel
Definition: extern.h:561
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
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 inspircd_cmd_svskill(char *source, char *user, char *buf)
Definition: inspircd20.c:653
char myCsmodes[128]
Definition: inspircd20.c:229
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 inspircd_cmd_nc_change(User *u)
Definition: inspircd20.c:2359
#define UMODE_g
Definition: bahamut.h:35
void inspircd_cmd_szline(char *mask, char *reason, char *whom)
Definition: inspircd20.c:2324
#define CMODE_A
Definition: inspircd11.h:35
int anope_event_join(char *source, int ac, char **av)
Definition: inspircd20.c:1573
char mode
Definition: services.h:933
int anope_event_admin(char *source, int ac, char **av)
Definition: inspircd20.c:2415
#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 UMODE_W
Definition: inspircd12.h:38
#define CMODE_n
Definition: bahamut.h:46
E void check_memos(User *u)
Definition: memoserv.c:86
#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
#define UMODE_s
Definition: bahamut.h:29
void inspircd_cmd_svsnoop(char *server, int set)
Definition: inspircd20.c:598
char * uid
Definition: services.h:419
static char ts6_new_sid[4]
Definition: inspircd20.c:2537
char * botservmode
Definition: services.h:283
void inspircd_cmd_svspart(char *source, char *nick, char *chan)
Definition: inspircd20.c:2386
MDE void moduleAddAuthor(const char *author)
Definition: modules.c:1772
char * devnullmode
Definition: services.h:285
void inspircd_cmd_part(char *nick, char *chan, char *buf)
Definition: inspircd20.c:1085
int anope_event_squit(char *source, int ac, char **av)
Definition: inspircd20.c:1460
void inspircd_cmd_svso(char *source, char *nick, char *flag)
Definition: inspircd20.c:1314
char * nickservmode
Definition: services.h:278
void inspircd_cmd_notice2(char *source, char *dest, char *msg)
Definition: inspircd20.c:928
void inspircd_cmd_jupe(char *jserver, char *who, char *reason)
Definition: inspircd20.c:2434
E char * DefConChanModes
Definition: extern.h:568
int inspircd_jointhrottle_mode_check(char *value)
Definition: inspircd20.c:2497
void inspircd_cmd_219(char *source, char *letter)
Definition: inspircd20.c:1198
#define CMODE_t
Definition: bahamut.h:49
int except
Definition: services.h:320
E char * cs_get_key(ChannelInfo *ci)
Definition: chanserv.c:2447
void inspircd_cmd_join(char *user, char *channel, time_t chantime)
Definition: inspircd20.c:1025
E void cs_set_redirect(ChannelInfo *ci, char *value)
Definition: chanserv.c:2572
MDE void moduleSetType(MODType type)
Definition: modules.c:818
char * desc
Definition: services.h:856
void inspircd_cmd_svsmode(User *u, int ac, char **av)
Definition: inspircd20.c:666
int AnopeInit(int argc, char **argv)
Definition: inspircd20.c:2687
int inspircd_valid_nick(char *nick)
Definition: inspircd20.c:2470
#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
int anope_event_kill(char *source, int ac, char **av)
Definition: inspircd20.c:1549
E void update_host(User *user)
Definition: users.c:104
E void pmodule_cmd_243(void(*func)(char *buf))
Definition: ircd.c:919
IRCDCAPAB myIrcdcap[]
Definition: inspircd20.c:172
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 moduleAddAnopeCmds()
Definition: inspircd20.c:2604
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
NickCore * nc
Definition: services.h:533
void inspircd_cmd_307(char *buf)
Definition: inspircd20.c:1130
E void do_join(const char *source, int ac, char **av)
Definition: channels.c:556
static char sym_from_char(const char c)
Definition: inspircd20.c:250
E Uid * new_uid(const char *nick, char *uid)
Definition: users.c:435
#define CMODE_Q
Definition: charybdis.h:44
char * display
Definition: services.h:542
char * uid
Definition: services.h:890
int anope_event_part(char *source, int ac, char **av)
Definition: inspircd20.c:1899
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
void inspircd_cmd_svsnick(char *source, char *guest, time_t when)
Definition: inspircd20.c:1334
E void pmodule_key_mode(int mode)
Definition: ircd.c:1196
int anope_event_rsquit(char *source, int ac, char **av)
Definition: inspircd20.c:1484
E void pmodule_cmd_svsnick(void(*func)(char *source, char *guest, time_t when))
Definition: ircd.c:960
void inspircd_cmd_312(char *buf)
Definition: inspircd20.c:1164
E char * s_OperServ
Definition: extern.h:289
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
#define MOD_STOP
Definition: modules.h:53
void(* addmask)(Channel *chan, char *mask)
Definition: services.h:943
E char * ServiceHost
Definition: extern.h:277
#define UMODE_x
Definition: bahamut.h:23
int invitemode
Definition: services.h:359
E void record_topic(const char *chan)
Definition: chanserv.c:1645
E char * EncModule
Definition: extern.h:580
void inspircd_cmd_sqline(char *mask, char *reason)
Definition: inspircd20.c:1295
void inspircd_cmd_unban(char *name, char *nick)
Definition: inspircd20.c:2336
E void pmodule_invite_cmode(int mode)
Definition: ircd.c:1181
char * botserv_bot_mode
Definition: services.h:296
void moduleAddIRCDMsgs(void)
Definition: inspircd20.c:535
int anope_event_time(char *source, int ac, char **av)
Definition: inspircd20.c:2518
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
char * ts6_sid_retrieve()
Definition: inspircd20.c:2578
E char * uplink
Definition: extern.h:35
E char * ts6_uid_retrieve(void)
Definition: servers.c:617
void inspircd_cmd_svid_umode(char *nick, time_t ts)
Definition: inspircd20.c:2351
E User * finduser(const char *nick)
Definition: users.c:323
int anope_event_server(char *source, int ac, char **av)
Definition: inspircd20.c:1876
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
uint16 status
Definition: services.h:532
E BotInfo * findbot(char *nick)
Definition: db-merger.c:1989
time_t creation_time
Definition: services.h:1002
#define CAPAB_TLKEXT
Definition: services.h:1393
uint16 flags
Definition: services.h:935
E void set_flood(Channel *chan, char *value)
Definition: channels.c:1972
void(* setvalue)(Channel *chan, char *value)
Definition: services.h:924
void inspircd_cmd_pong(char *servname, char *who)
Definition: inspircd20.c:1019
int anope_event_metadata(char *source, int ac, char **av)
Definition: inspircd20.c:1755
MDE void moduleAddVersion(const char *version)
Definition: modules.c:1760
User * u_intro_regged
Definition: inspircd20.c:469
#define CMODE_J
Definition: inspircd12.h:70
void inspircd_cmd_guest_nick(char *nick, char *user, char *host, char *real, char *modes)
Definition: inspircd20.c:721
char *(* getvalue)(Channel *chan)
Definition: services.h:938
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
#define CUS_HALFOP
Definition: services.h:1343
E void del_ban(Channel *chan, char *mask)
Definition: channels.c:1779
void inspircd_cmd_vhost_on(char *nick, char *vIdent, char *vhost)
Definition: inspircd20.c:1348
void inspircd_cmd_401(char *source, char *who)
Definition: inspircd20.c:1211
void inspircd_cmd_server(char *servname, int hop, char *descript, char *sid)
Definition: inspircd20.c:1012
char * name
Definition: services.h:854
unsigned long umodes[128]
Definition: inspircd20.c:206
E char * merge_args(int argc, char **argv)
Definition: misc.c:180
uint32 get_mode_from_char(const char c)
Definition: inspircd20.c:53
#define CUS_PROTECT
Definition: services.h:1345
E void pmodule_ircd_cumodes(CUMode modes[128])
Definition: ircd.c:1117
E const char version_flags[]
Definition: extern.h:771
#define CMODE_f
Definition: charybdis.h:35
Command * c
Definition: ns_recover.c:17
uint16 flags
Definition: services.h:857
int protect
Definition: services.h:333
int anope_event_opertype(char *source, int ac, char **av)
Definition: inspircd20.c:775
void inspircd_cmd_protoctl()
Definition: inspircd20.c:999
int inspircd_valid_chan(char *chan)
Definition: inspircd20.c:2475
u_int32_t uint32
Definition: db-merger.c:123
void inspircd_cmd_318(char *source, char *who)
Definition: inspircd20.c:1221
E void init_tertiary()
Definition: init.c:777
E char * TS6SID
Definition: extern.h:1158
char * nickservaliasmode
Definition: services.h:287
E void alog(const char *fmt,...) FORMAT(printf
E int servernum
Definition: extern.h:615
time_t lastmsg
Definition: services.h:581
int svshold
Definition: services.h:338
void inspircd_cmd_242(char *buf)
Definition: inspircd20.c:1231
char * chanservaliasmode
Definition: services.h:288
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
char * helpservmode
Definition: services.h:284
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
void inspircd_cmd_372(char *source, char *msg)
Definition: inspircd20.c:679
E void display_news(User *u, int16 type)
Definition: news.c:269
int16_t int16
Definition: db-merger.c:120
#define CAPAB_SSJ3
Definition: services.h:1389
#define CMODE_K
Definition: inspircd11.h:37
int anope_event_whois(char *source, int ac, char **av)
Definition: inspircd20.c:1910
void inspircd_cmd_250(char *buf)
Definition: inspircd20.c:1113
void inspircd_cmd_chghost(char *nick, char *vhost)
Definition: inspircd20.c:1041
int anope_event_setident(char *source, int ac, char **av)
Definition: inspircd20.c:1628
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
E int m_privmsg(char *source, char *receiver, char *msg)
Definition: messages.c:130
static int has_servicesmod
Definition: inspircd20.c:471
void inspircd_cmd_243(char *buf)
Definition: inspircd20.c:1248
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
char nick[NICKMAX]
Definition: services.h:418
E int debug
Definition: extern.h:775
E int split_buf(char *buf, char ***argv, int colon_special)
Definition: process.c:270
void inspircd_cmd_chgident(char *nick, char *vIdent)
Definition: inspircd20.c:1057
#define EVENT_TOPIC_UPDATED
Definition: events.h:30
int anope_event_motd(char *source, int ac, char **av)
Definition: inspircd20.c:1581
E void set_limit(Channel *chan, char *value)
Definition: channels.c:2011
E void finish_sync(Server *serv, int sync_links)
Definition: servers.c:531
#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
void inspircd_cmd_svid_umode2(User *u, char *ts)
Definition: inspircd20.c:2367
E char * get_unkwn(Channel *chan)
Definition: channels.c:1903
int is_sid(char *sid)
Definition: inspircd20.c:2539
void inspircd_cmd_sgline(char *mask, char *reason)
Definition: inspircd20.c:2331
uint16 hops
Definition: services.h:855
E int NSDefFlags
Definition: extern.h:377
#define CUS_OWNER
Definition: services.h:1344
char * memoservmode
Definition: services.h:280
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 inspircd_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes)
Definition: inspircd20.c:878
int anope_event_rehash(char *source, int ac, char **av)
Definition: inspircd20.c:2405
void inspircd_cmd_pass(char *pass)
Definition: inspircd20.c:1006
E void pmodule_cmd_250(void(*func)(char *buf))
Definition: ircd.c:874
char * username
Definition: services.h:877
#define UMODE_B
Definition: inspircd12.h:31
char * topic
Definition: services.h:1003
char * vident
Definition: services.h:882
E void pmodule_ircd_version(char *version)
Definition: ircd.c:1107
void inspircd_cmd_global(char *source, char *buf)
Definition: inspircd20.c:1282
E const char version_number[]
Definition: extern.h:767
E int validate_user(User *u)
Definition: nickserv.c:990
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
struct chmodeinfo chmodes[]
E void anope_cmd_mode(char *source, char *dest, const char *fmt,...)
Definition: ircd.c:211
void inspircd_cmd_release_svshold(char *nick)
Definition: inspircd20.c:2305
E void pmodule_cmd_401(void(*func)(char *source, char *who))
Definition: ircd.c:904
E int WallOper
Definition: extern.h:448
static CBModeInfo * find_cbinfo(const char mode)
Definition: inspircd20.c:403
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
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
char * operservmode
Definition: services.h:282
void inspircd_cmd_quit(char *source, char *buf)
Definition: inspircd20.c:987
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 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
void inspircd_cmd_remove_akill(char *user, char *host)
Definition: inspircd20.c:608
int anope_event_away(char *source, int ac, char **av)
Definition: inspircd20.c:1412
time_t topic_time
Definition: services.h:1005
void inspircd_cmd_351(char *source)
Definition: inspircd20.c:976
void inspircd_cmd_311(char *buf)
Definition: inspircd20.c:1147
int anope_event_uid(char *source, int ac, char **av)
Definition: inspircd20.c:1708
static void do_nothing(Channel *c, char *mask)
Definition: inspircd20.c:70
void inspircd_cmd_391(char *source, char *buf)
Definition: inspircd20.c:1104
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_invite(char *source, char *chan, char *nick)
Definition: inspircd20.c:1073
#define UMODE_r
Definition: bahamut.h:20
#define NS_IDENTIFIED
Definition: services.h:1275
E void pmodule_cmd_notice_ops(void(*func)(char *source, char *dest, char *buf))
Definition: ircd.c:787
E void pmodule_cmd_release_svshold(void(*func)(char *nick))
Definition: ircd.c:986
int jmode
Definition: services.h:374
E void add_exception(Channel *chan, char *mask)
Definition: channels.c:1377
int anope_event_chghost(char *source, int ac, char **av)
Definition: inspircd20.c:1849
#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
int anope_event_436(char *source, int ac, char **av)
Definition: inspircd20.c:1403
E void pmodule_cmd_unban(void(*func)(char *name, char *nick))
Definition: ircd.c:1012
int anope_event_chgident(char *source, int ac, char **av)
Definition: inspircd20.c:1647
E void pmodule_cmd_notice(void(*func)(char *source, char *dest, char *buf))
Definition: ircd.c:792
char * globalmode
Definition: services.h:286
E Server * servlist
Definition: extern.h:1051
#define UMODE_h
Definition: bahamut.h:17
Definition: services.h:416
int owner
Definition: services.h:302
#define DEFAULT_MLOCK
Definition: bahamut.h:59
int anope_event_nick(char *source, int ac, char **av)
Definition: inspircd20.c:1685
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
E char * cs_get_unkwn(ChannelInfo *ci)
Definition: chanserv.c:2493
E void capab_parse(int ac, char **av)
Definition: servers.c:451
void inspircd_cmd_serv_notice(char *source, char *dest, char *msg)
Definition: inspircd20.c:958
E int check_valid_op(User *user, Channel *chan, int servermode)
Definition: chanserv.c:1290
E char * cs_get_limit(ChannelInfo *ci)
Definition: chanserv.c:2458
void inspircd_cmd_connect(int servernum)
Definition: inspircd20.c:1359
int anope_event_fjoin(char *source, int ac, char **av)
Definition: inspircd20.c:837
uint32 mode
Definition: services.h:889
char * chanservmode
Definition: services.h:279
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
char * devnullvaliasmode
Definition: services.h:294
E void common_svsmode(User *u, char *modes, char *arg)
Definition: actions.c:228
E void * smalloc(long size)
Definition: memory.c:30
E char * ServerName
Definition: extern.h:274
#define CMODE_c
Definition: bahamut.h:54
uint32 mode
Definition: inspircd20.h:77
E int defconParseModeString(const char *str)
Definition: operserv.c:1703
int anope_event_eob(char *source, int ac, char **av)
Definition: inspircd20.c:1826
char * suid
Definition: services.h:858
time_t last_seen
Definition: services.h:531
#define UMODE_G
Definition: inspircd12.h:32
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
char modechar
Definition: inspircd20.h:76
int anope_event_fmode(char *source, int ac, char **av)
Definition: inspircd20.c:790
char * globalaliasmode
Definition: services.h:295
E void pmodule_cmd_svshold(void(*func)(char *nick))
Definition: ircd.c:981
#define SERVER_ISME
Definition: services.h:865
void inspircd_cmd_global_legacy(char *source, char *fmt)
Definition: inspircd20.c:2458
int16 status
Definition: services.h:948
#define CAPAB_NICK2
Definition: services.h:1390
#define GET_BOT(bot)
Definition: services.h:271
char * helpservaliasmode
Definition: services.h:293
CBModeInfo myCbmodeinfos[]
Definition: inspircd20.c:353
E size_t strlcat(char *, const char *, size_t)
Definition: misc.c:1263
char * operservaliasmode
Definition: services.h:291
void inspircd_cmd_notice_ops(char *source, char *dest, char *buf)
Definition: inspircd20.c:903
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
void inspircd_cmd_kick(char *source, char *chan, char *user, char *buf)
Definition: inspircd20.c:890
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
static int has_chghostmod
Definition: inspircd20.c:472
char * botservaliasmode
Definition: services.h:292
E char * RemotePassword2
Definition: extern.h:267
int halfop
Definition: services.h:316
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
char * last_usermask
Definition: services.h:529
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
void inspircd_cmd_375(char *source)
Definition: inspircd20.c:694
#define UMODE_H
Definition: inspircd12.h:33
E void pmodule_flood_mode_check(int(*func)(char *value))
Definition: ircd.c:1092
int anope_event_sethost(char *source, int ac, char **av)
Definition: inspircd20.c:1666
#define NEWS_OPER
Definition: services.h:1050
E void change_user_realname(User *user, const char *realname)
Definition: users.c:147
CBMode myCbmodes[128]
Definition: inspircd20.c:287
E void pmodule_ircd_cbmodeinfos(CBModeInfo *modeinfos)
Definition: ircd.c:1112
int inspircd_flood_mode_check(char *value)
Definition: inspircd20.c:2420
void inspircd_cmd_unsgline(char *mask)
Definition: inspircd20.c:2312
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
char * hostservaliasmode
Definition: services.h:290
static int has_chgidentmod
Definition: inspircd20.c:473
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_setname(char *source, int ac, char **av)
Definition: inspircd20.c:1590
E void pmodule_cmd_mode(void(*func)(char *source, char *dest, char *buf))
Definition: ircd.c:768
E char * common_get_vhost(User *u)
Definition: actions.c:251
int anope_event_kick(char *source, int ac, char **av)
Definition: inspircd20.c:1564
E void pmodule_limit_mode(int mode)
Definition: ircd.c:1201
#define CMODE_i
Definition: bahamut.h:44
static int burst
Definition: inspircd20.c:467
#define CMODE_S
Definition: hybrid.h:46
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
void inspircd_cmd_topic(char *whosets, char *chan, char *whosetit, char *topic, time_t when)
Definition: inspircd20.c:614
#define BUFSIZE
Definition: config.h:47
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
static int ts6_sid_initted
Definition: inspircd20.c:2536
#define CUS_OP
Definition: services.h:1341
int fmode
Definition: services.h:349
E char * normalizeBuffer(char *)
Definition: botserv.c:1101
void inspircd_cmd_vhost_off(User *u)
Definition: inspircd20.c:624
E char * common_get_vident(User *u)
Definition: actions.c:272
void ts6_sid_increment(unsigned pos)
Definition: inspircd20.c:2549
NickAlias * na
Definition: services.h:892
#define CMODE_P
Definition: charybdis.h:38
int anope_event_chgname(char *source, int ac, char **av)
Definition: inspircd20.c:1609
E void anope_cmd_global(char *source, const char *fmt,...)
Definition: ircd.c:506
E void pmodule_cmd_global(void(*func)(char *source, char *buf))
Definition: ircd.c:929
#define UMODE_d
Definition: bahamut.h:34
void inspircd_cmd_svsadmin(char *server, int set)
Definition: inspircd20.c:603
#define CUF_PROTECT_BOTSERV
Definition: services.h:956
void inspircd_cmd_bot_chan_mode(char *nick, char *chan)
Definition: inspircd20.c:971
E void nsStartNickTracking(User *u)
Definition: nickserv.c:1962
#define UMODE_o
Definition: bahamut.h:19
E void pmodule_cmd_219(void(*func)(char *source, char *letter))
Definition: ircd.c:899
static int has_hidechansmod
Definition: inspircd20.c:475