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