00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "services.h"
00014 #include "pseudo.h"
00015 #include "charybdis.h"
00016
00017 IRCDVar myIrcd[] = {
00018 {"Charybdis 1.0+",
00019 "+oiS",
00020 "+oiS",
00021 "+oiS",
00022 "+oiS",
00023 "+oaiS",
00024 "+oiS",
00025 "+oiS",
00026 "+oiS",
00027 "+oiS",
00028 "+oiS",
00029 "+oiS",
00030 "+oiS",
00031 "+oiS",
00032 "+oaiS",
00033 "+oiS",
00034 "+oiS",
00035 "+oiS",
00036 "+oiS",
00037 "+oiS",
00038 2,
00039 "-cilmnpstrgzQF",
00040 "+o",
00041 1,
00042 1,
00043 0,
00044 NULL,
00045 NULL,
00046 NULL,
00047 NULL,
00048 NULL,
00049 NULL,
00050 NULL,
00051 NULL,
00052 NULL,
00053 NULL,
00054 1,
00055 1,
00056 1,
00057 0,
00058 3,
00059 1,
00060 1,
00061 1,
00062 0,
00063 0,
00064 0,
00065 0,
00066 1,
00067 0,
00068 0,
00069 0,
00070 0,
00071 0,
00072 0,
00073 0,
00074 1,
00075 0,
00076 0,
00077 0,
00078 0,
00079 1,
00080 0,
00081 CMODE_p,
00082 0,
00083 DEFAULT_MLOCK,
00084 0,
00085 1,
00086 1,
00087 CMODE_j,
00088 CMODE_f,
00089 1,
00090 0,
00091 NULL,
00092 0,
00093 1,
00094 0,
00095 1,
00096 0,
00097 0,
00098 0,
00099 0,
00100 0,
00101 NULL,
00102 1,
00103 0,
00104 0,
00105 NULL,
00106 0,
00107 }
00108 ,
00109 {NULL}
00110 };
00111
00112 IRCDCAPAB myIrcdcap[] = {
00113 {
00114 0,
00115 0,
00116 0,
00117 0,
00118 0,
00119 CAPAB_ZIP,
00120 0,
00121 CAPAB_TS5,
00122 0,
00123 0,
00124 0,
00125 0,
00126 CAPAB_QS,
00127 CAPAB_UID,
00128 CAPAB_KNOCK,
00129 0,
00130 0,
00131 0,
00132 0,
00133 0,
00134 0,
00135 0,
00136 0,
00137 0,
00138 0,
00139 0,
00140 0,
00141 0,
00142 0, 0, 0}
00143 };
00144
00145
00146
00147 void charybdis_set_umode(User * user, int ac, char **av)
00148 {
00149 int add = 1;
00150 char *modes = av[0];
00151
00152 ac--;
00153
00154 if (debug)
00155 alog("debug: Changing mode for %s to %s", user->nick, modes);
00156
00157 while (*modes) {
00158
00159
00160
00161
00162 if (add)
00163 user->mode |= umodes[(int) *modes];
00164 else
00165 user->mode &= ~umodes[(int) *modes];
00166
00167 switch (*modes++) {
00168 case '+':
00169 add = 1;
00170 break;
00171 case '-':
00172 add = 0;
00173 break;
00174 case 'o':
00175 if (add) {
00176 opcnt++;
00177
00178 if (WallOper)
00179 anope_cmd_global(s_OperServ,
00180 "\2%s\2 is now an IRC operator.",
00181 user->nick);
00182 display_news(user, NEWS_OPER);
00183
00184 } else {
00185 opcnt--;
00186 }
00187 break;
00188 }
00189 }
00190 }
00191
00192 unsigned long umodes[128] = {
00193 0, 0, 0,
00194 0, 0, 0,
00195 0, 0, 0,
00196 0, 0, 0,
00197 0, 0, 0,
00198 0, 0, 0,
00199 0, 0, 0,
00200 0, 0, 0,
00201 0, 0, 0,
00202 0, 0, 0,
00203 0, 0, 0,
00204 0, 0, 0,
00205 0, 0, 0,
00206 0, 0, 0,
00207 0, 0, 0,
00208 0, 0, 0,
00209 0, 0,
00210 0, 0,
00211 0, 0,
00212 0, 0,
00213 0, 0,
00214 0, 0,
00215 0, 0, 0,
00216 0, 0,
00217 0, 0, 0,
00218 0, 0, 0,
00219 0, 0, 0,
00220 0, 0, 0,
00221 0, 0, 0,
00222 0, UMODE_Q, UMODE_R,
00223 UMODE_S, 0, 0,
00224 0, 0, 0,
00225 0,
00226 0,
00227 0, 0, 0,
00228 0, 0, 0,
00229 UMODE_a, 0, 0,
00230 0, 0, 0,
00231 UMODE_g, 0, UMODE_i,
00232 0, 0, UMODE_l,
00233 0, 0, UMODE_o,
00234 0, 0, 0,
00235 UMODE_s, 0, 0,
00236 0, UMODE_w, 0,
00237 0,
00238 UMODE_z,
00239 0, 0, 0,
00240 0, 0
00241 };
00242
00243
00244 char myCsmodes[128] = {
00245 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00246 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00247
00248 0,
00249 0,
00250 0, 0, 0,
00251 0,
00252 0, 0, 0, 0,
00253 0,
00254
00255 'v', 0, 0, 0, 0,
00256 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00257
00258 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00259 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00260
00261 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00262 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
00263 };
00264
00265 CMMode myCmmodes[128] = {
00266 {NULL}, {NULL}, {NULL},
00267 {NULL}, {NULL}, {NULL},
00268 {NULL}, {NULL}, {NULL},
00269 {NULL}, {NULL}, {NULL},
00270 {NULL}, {NULL}, {NULL},
00271 {NULL}, {NULL}, {NULL},
00272 {NULL}, {NULL}, {NULL},
00273 {NULL}, {NULL}, {NULL},
00274 {NULL}, {NULL}, {NULL},
00275 {NULL}, {NULL}, {NULL},
00276 {NULL}, {NULL}, {NULL},
00277 {NULL}, {NULL}, {NULL},
00278 {NULL}, {NULL}, {NULL},
00279 {NULL}, {NULL}, {NULL},
00280 {NULL}, {NULL}, {NULL},
00281 {NULL}, {NULL}, {NULL},
00282 {NULL}, {NULL}, {NULL},
00283 {NULL}, {NULL}, {NULL},
00284 {NULL}, {NULL}, {NULL},
00285 {NULL}, {NULL}, {NULL},
00286 {NULL}, {NULL}, {NULL},
00287 {NULL}, {NULL}, {NULL},
00288 {NULL}, {NULL}, {NULL},
00289 {NULL}, {NULL}, {NULL},
00290 {NULL},
00291 {add_invite, del_invite},
00292 {NULL},
00293 {NULL}, {NULL}, {NULL},
00294 {NULL}, {NULL}, {NULL},
00295 {NULL}, {NULL}, {NULL},
00296 {NULL}, {NULL}, {NULL},
00297 {NULL}, {NULL}, {NULL},
00298 {NULL},
00299 {NULL}, {NULL},
00300 {NULL}, {NULL}, {NULL},
00301 {NULL},
00302 {NULL},
00303 {add_ban, del_ban},
00304 {NULL},
00305 {NULL},
00306 {add_exception, del_exception},
00307 {NULL},
00308 {NULL},
00309 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00310 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00311 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}
00312 };
00313
00314
00315 CBMode myCbmodes[128] = {
00316 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00317 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00318 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00319 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00320 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00321 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00322 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00323 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00324 {0},
00325 {0},
00326 {0},
00327 {0},
00328 {0},
00329 {0},
00330 {CMODE_F, 0, NULL, NULL},
00331 {0},
00332 {0},
00333 {0},
00334 {0},
00335 {0},
00336 {CMODE_L, CBM_NO_USER_MLOCK, NULL, NULL},
00337 {0},
00338 {0},
00339 {0},
00340 {CMODE_P, CBM_NO_USER_MLOCK, NULL, NULL},
00341 {CMODE_Q, 0, NULL, NULL},
00342 {0},
00343 {0},
00344 {0},
00345 {0},
00346 {0},
00347 {0},
00348 {0},
00349 {0},
00350 {0},
00351 {0}, {0}, {0}, {0}, {0}, {0},
00352 {0},
00353 {0},
00354 {CMODE_c, 0, NULL, NULL},
00355 {0},
00356 {0},
00357 {CMODE_f, 0, set_redirect, cs_set_redirect},
00358 {CMODE_g, 0, NULL, NULL},
00359 {0},
00360 {CMODE_i, 0, NULL, NULL},
00361 {CMODE_j, 0, set_flood, cs_set_flood},
00362 {CMODE_k, 0, chan_set_key, cs_set_key},
00363 {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit},
00364 {CMODE_m, 0, NULL, NULL},
00365 {CMODE_n, 0, NULL, NULL},
00366 {0},
00367 {CMODE_p, 0, NULL, NULL},
00368 {0},
00369 {CMODE_r, 0, NULL, NULL},
00370 {CMODE_s, 0, NULL, NULL},
00371 {CMODE_t, 0, NULL, NULL},
00372 {0},
00373 {0},
00374 {0},
00375 {0},
00376 {0},
00377 {CMODE_z, 0, NULL, NULL},
00378 {0}, {0}, {0}, {0}
00379 };
00380
00381 CBModeInfo myCbmodeinfos[] = {
00382 {'c', CMODE_c, 0, NULL, NULL},
00383 {'f', CMODE_f, CBM_MINUS_NO_ARG, get_redirect, cs_get_redirect},
00384 {'g', CMODE_g, 0, NULL, NULL},
00385 {'i', CMODE_i, 0, NULL, NULL},
00386 {'j', CMODE_j, CBM_MINUS_NO_ARG, get_flood, cs_get_flood},
00387 {'k', CMODE_k, 0, get_key, cs_get_key},
00388 {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit},
00389 {'m', CMODE_m, 0, NULL, NULL},
00390 {'n', CMODE_n, 0, NULL, NULL},
00391 {'p', CMODE_p, 0, NULL, NULL},
00392 {'r', CMODE_r, 0, NULL, NULL},
00393 {'s', CMODE_s, 0, NULL, NULL},
00394 {'t', CMODE_t, 0, NULL, NULL},
00395 {'z', CMODE_z, 0, NULL, NULL},
00396 {'F', CMODE_F, 0, NULL, NULL},
00397 {'L', CMODE_L, 0, NULL, NULL},
00398 {'P', CMODE_P, 0, NULL, NULL},
00399 {'Q', CMODE_Q, 0, NULL, NULL},
00400 {0}
00401 };
00402
00403
00404 CUMode myCumodes[128] = {
00405 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00406 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00407 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00408 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00409
00410 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00411 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00412 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00413 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00414
00415 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00416 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00417 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00418 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00419
00420 {0},
00421
00422 {0},
00423 {0},
00424 {0},
00425 {0},
00426 {0},
00427 {0},
00428 {0},
00429 {0},
00430 {0},
00431 {0},
00432 {0},
00433 {0},
00434 {0},
00435 {0},
00436 {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op},
00437 {0},
00438 {0},
00439 {0},
00440 {0},
00441 {0},
00442 {0},
00443 {CUS_VOICE, 0, NULL},
00444 {0},
00445 {0},
00446 {0},
00447 {0},
00448 {0}, {0}, {0}, {0}, {0}
00449 };
00450
00451
00452
00453 void charybdis_cmd_notice(char *source, char *dest, char *buf)
00454 {
00455 Uid *ud;
00456 User *u;
00457
00458 if (!buf) {
00459 return;
00460 }
00461
00462 if (NSDefFlags & NI_MSG) {
00463 charybdis_cmd_privmsg2(source, dest, buf);
00464 } else {
00465 ud = find_uid(source);
00466 u = finduser(dest);
00467 send_cmd((UseTS6 ? (ud ? ud->uid : source) : source),
00468 "NOTICE %s :%s", (UseTS6 ? (u ? u->uid : dest) : dest),
00469 buf);
00470 }
00471 }
00472
00473 void charybdis_cmd_notice2(char *source, char *dest, char *msg)
00474 {
00475 Uid *ud;
00476 User *u;
00477
00478 ud = find_uid(source);
00479 u = finduser(dest);
00480 send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "NOTICE %s :%s",
00481 (UseTS6 ? (u ? u->uid : dest) : dest), msg);
00482 }
00483
00484 void charybdis_cmd_privmsg(char *source, char *dest, char *buf)
00485 {
00486 Uid *ud, *ud2;
00487
00488 if (!buf) {
00489 return;
00490 }
00491 ud = find_uid(source);
00492 ud2 = find_uid(dest);
00493
00494 send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "PRIVMSG %s :%s",
00495 (UseTS6 ? (ud2 ? ud2->uid : dest) : dest), buf);
00496 }
00497
00498 void charybdis_cmd_privmsg2(char *source, char *dest, char *msg)
00499 {
00500 Uid *ud, *ud2;
00501
00502 ud = find_uid(source);
00503 ud2 = find_uid(dest);
00504
00505 send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "PRIVMSG %s :%s",
00506 (UseTS6 ? (ud2 ? ud2->uid : dest) : dest), msg);
00507 }
00508
00509 void charybdis_cmd_serv_notice(char *source, char *dest, char *msg)
00510 {
00511 send_cmd(source, "NOTICE $$%s :%s", dest, msg);
00512 }
00513
00514 void charybdis_cmd_serv_privmsg(char *source, char *dest, char *msg)
00515 {
00516 send_cmd(source, "PRIVMSG $$%s :%s", dest, msg);
00517 }
00518
00519
00520 void charybdis_cmd_global(char *source, char *buf)
00521 {
00522 Uid *u;
00523
00524 if (!buf) {
00525 return;
00526 }
00527
00528 if (source) {
00529 u = find_uid(source);
00530 if (u) {
00531 send_cmd((UseTS6 ? u->uid : source), "OPERWALL :%s", buf);
00532 } else {
00533 send_cmd((UseTS6 ? TS6SID : ServerName), "WALLOPS :%s", buf);
00534 }
00535 } else {
00536 send_cmd((UseTS6 ? TS6SID : ServerName), "WALLOPS :%s", buf);
00537 }
00538 }
00539
00540
00541 void charybdis_cmd_global_legacy(char *source, char *fmt)
00542 {
00543 Uid *u;
00544
00545 if (source) {
00546 u = find_uid(source);
00547 if (u) {
00548 send_cmd((UseTS6 ? u->uid : source), "OPERWALL :%s", fmt);
00549 } else {
00550 send_cmd((UseTS6 ? TS6SID : ServerName), "WALLOPS :%s", fmt);
00551 }
00552 } else {
00553 send_cmd((UseTS6 ? TS6SID : ServerName), "WALLOPS :%s", fmt);
00554 }
00555
00556 send_cmd(source ? source : ServerName, "OPERWALL :%s", fmt);
00557 }
00558
00559 int anope_event_sjoin(char *source, int ac, char **av)
00560 {
00561 do_sjoin(source, ac, av);
00562 return MOD_CONT;
00563 }
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589 int anope_event_nick(char *source, int ac, char **av)
00590 {
00591 Server *s;
00592 User *user;
00593
00594 if (UseTS6 && ac == 9) {
00595 s = findserver_uid(servlist, source);
00596
00597 *source = '\0';
00598 user = do_nick(source, av[0], av[4], av[5], s->name, av[8],
00599 strtoul(av[2], NULL, 10), 0, 0, NULL, av[7]);
00600 if (user) {
00601 anope_set_umode(user, 1, &av[3]);
00602 }
00603 } else {
00604 if (ac != 2) {
00605 user = do_nick(source, av[0], av[4], av[5], av[6], av[7],
00606 strtoul(av[2], NULL, 10), 0, 0, NULL, NULL);
00607 if (user)
00608 anope_set_umode(user, 1, &av[3]);
00609 } else {
00610 do_nick(source, av[0], NULL, NULL, NULL, NULL,
00611 strtoul(av[1], NULL, 10), 0, 0, NULL, NULL);
00612 }
00613 }
00614 return MOD_CONT;
00615 }
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632 int anope_event_euid(char *source, int ac, char **av)
00633 {
00634 Server *s;
00635 User *user;
00636 time_t ts;
00637
00638 if (UseTS6 && ac == 11) {
00639 s = findserver_uid(servlist, source);
00640
00641 *source = '\0';
00642 ts = strtoul(av[2], NULL, 10);
00643 user = do_nick(source, av[0], av[4], !strcmp(av[8], "*") ? av[5] : av[8], s->name, av[10],
00644 ts, !stricmp(av[0], av[9]) ? ts : 0, 0, av[5], av[7]);
00645 if (user) {
00646 anope_set_umode(user, 1, &av[3]);
00647 }
00648 }
00649 return MOD_CONT;
00650 }
00651
00652 int anope_event_topic(char *source, int ac, char **av)
00653 {
00654 User *u;
00655
00656 if (ac == 4) {
00657 do_topic(source, ac, av);
00658 } else {
00659 Channel *c = findchan(av[0]);
00660 time_t topic_time = time(NULL);
00661
00662 if (!c) {
00663 if (debug) {
00664 alog("debug: TOPIC %s for nonexistent channel %s",
00665 merge_args(ac - 1, av + 1), av[0]);
00666 }
00667 return MOD_CONT;
00668 }
00669
00670 if (check_topiclock(c, topic_time))
00671 return MOD_CONT;
00672
00673 if (c->topic) {
00674 free(c->topic);
00675 c->topic = NULL;
00676 }
00677 if (ac > 1 && *av[1])
00678 c->topic = sstrdup(av[1]);
00679
00680 if (UseTS6) {
00681 u = find_byuid(source);
00682 if (u) {
00683 strscpy(c->topic_setter, u->nick, sizeof(c->topic_setter));
00684 } else {
00685 strscpy(c->topic_setter, source, sizeof(c->topic_setter));
00686 }
00687 } else {
00688 strscpy(c->topic_setter, source, sizeof(c->topic_setter));
00689 }
00690 c->topic_time = topic_time;
00691
00692 record_topic(av[0]);
00693
00694 if (ac > 1 && *av[1])
00695 send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[1]);
00696 else
00697 send_event(EVENT_TOPIC_UPDATED, 2, av[0], "");
00698 }
00699 return MOD_CONT;
00700 }
00701
00702 int anope_event_tburst(char *source, int ac, char **av)
00703 {
00704 char *setter;
00705 Channel *c;
00706 time_t topic_time;
00707
00708 if (ac != 4) {
00709 return MOD_CONT;
00710 }
00711
00712 setter = myStrGetToken(av[2], '!', 0);
00713
00714 c = findchan(av[0]);
00715 topic_time = strtol(av[1], NULL, 10);
00716
00717 if (!c) {
00718 if (debug) {
00719 alog("debug: TOPIC %s for nonexistent channel %s",
00720 merge_args(ac - 1, av + 1), av[0]);
00721 }
00722 if (setter)
00723 free(setter);
00724 return MOD_CONT;
00725 }
00726
00727 if (check_topiclock(c, topic_time)) {
00728 if (setter)
00729 free(setter);
00730 return MOD_CONT;
00731 }
00732
00733 if (c->topic) {
00734 free(c->topic);
00735 c->topic = NULL;
00736 }
00737 if (ac > 1 && *av[3])
00738 c->topic = sstrdup(av[3]);
00739
00740 strscpy(c->topic_setter, setter, sizeof(c->topic_setter));
00741 c->topic_time = topic_time;
00742
00743 record_topic(av[0]);
00744
00745 if (ac > 1 && *av[3])
00746 send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[3]);
00747 else
00748 send_event(EVENT_TOPIC_UPDATED, 2, av[0], "");
00749
00750 if (setter)
00751 free(setter);
00752
00753 return MOD_CONT;
00754 }
00755
00756 int anope_event_436(char *source, int ac, char **av)
00757 {
00758 if (ac < 1)
00759 return MOD_CONT;
00760
00761 m_nickcoll(av[0]);
00762 return MOD_CONT;
00763 }
00764
00765
00766
00767 void moduleAddIRCDMsgs(void)
00768 {
00769 Message *m;
00770
00771 updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+","-");
00772
00773 if (UseTS6) {
00774 TS6SID = sstrdup(Numeric);
00775 }
00776
00777 m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m);
00778 m = createMessage("402", anope_event_null); addCoreMessage(IRCD,m);
00779 m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m);
00780 m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m);
00781 m = createMessage("INVITE", anope_event_invite); addCoreMessage(IRCD,m);
00782 m = createMessage("JOIN", anope_event_join); addCoreMessage(IRCD,m);
00783 m = createMessage("KICK", anope_event_kick); addCoreMessage(IRCD,m);
00784 m = createMessage("KILL", anope_event_kill); addCoreMessage(IRCD,m);
00785 m = createMessage("MODE", anope_event_mode); addCoreMessage(IRCD,m);
00786 m = createMessage("TMODE", anope_event_tmode); addCoreMessage(IRCD,m);
00787 m = createMessage("MOTD", anope_event_motd); addCoreMessage(IRCD,m);
00788 m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m);
00789 m = createMessage("BMASK", anope_event_bmask); addCoreMessage(IRCD,m);
00790 m = createMessage("UID", anope_event_nick); addCoreMessage(IRCD,m);
00791 m = createMessage("NOTICE", anope_event_notice); addCoreMessage(IRCD,m);
00792 m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m);
00793 m = createMessage("PASS", anope_event_pass); addCoreMessage(IRCD,m);
00794 m = createMessage("PING", anope_event_ping); addCoreMessage(IRCD,m);
00795 m = createMessage("PRIVMSG", anope_event_privmsg); addCoreMessage(IRCD,m);
00796 m = createMessage("QUIT", anope_event_quit); addCoreMessage(IRCD,m);
00797 m = createMessage("SERVER", anope_event_server); addCoreMessage(IRCD,m);
00798 m = createMessage("SQUIT", anope_event_squit); addCoreMessage(IRCD,m);
00799 m = createMessage("TOPIC", anope_event_topic); addCoreMessage(IRCD,m);
00800 m = createMessage("TB", anope_event_tburst); addCoreMessage(IRCD,m);
00801 m = createMessage("USER", anope_event_null); addCoreMessage(IRCD,m);
00802 m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m);
00803 m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m);
00804 m = createMessage("SVSMODE", anope_event_null); addCoreMessage(IRCD,m);
00805 m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m);
00806 m = createMessage("CAPAB", anope_event_capab); addCoreMessage(IRCD,m);
00807 m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m);
00808 m = createMessage("SVINFO", anope_event_svinfo); addCoreMessage(IRCD,m);
00809 m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m);
00810 m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m);
00811 m = createMessage("421", anope_event_null); addCoreMessage(IRCD,m);
00812 m = createMessage("ENCAP", anope_event_null); addCoreMessage(IRCD,m);
00813 m = createMessage("SID", anope_event_sid); addCoreMessage(IRCD,m);
00814 m = createMessage("EUID", anope_event_euid); addCoreMessage(IRCD,m);
00815 }
00816
00817
00818
00819
00820 void charybdis_cmd_sqline(char *mask, char *reason)
00821 {
00822 Uid *ud;
00823
00824 ud = find_uid(s_OperServ);
00825 send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
00826 "RESV * %s :%s", mask, reason);
00827 }
00828
00829 void charybdis_cmd_unsgline(char *mask)
00830 {
00831 Uid *ud;
00832
00833 ud = find_uid(s_OperServ);
00834 send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
00835 "UNXLINE * %s", mask);
00836 }
00837
00838 void charybdis_cmd_unszline(char *mask)
00839 {
00840
00841 }
00842
00843 void charybdis_cmd_szline(char *mask, char *reason, char *whom)
00844 {
00845
00846 }
00847
00848 void charybdis_cmd_svsnoop(char *server, int set)
00849 {
00850
00851 }
00852
00853 void charybdis_cmd_svsadmin(char *server, int set)
00854 {
00855 charybdis_cmd_svsnoop(server, set);
00856 }
00857
00858 void charybdis_cmd_sgline(char *mask, char *reason)
00859 {
00860 Uid *ud;
00861
00862 ud = find_uid(s_OperServ);
00863 send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
00864 "XLINE * %s 0 :%s", mask, reason);
00865 }
00866
00867 void charybdis_cmd_remove_akill(char *user, char *host)
00868 {
00869 Uid *ud;
00870
00871 ud = find_uid(s_OperServ);
00872 send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
00873 "UNKLINE * %s %s", user, host);
00874 }
00875
00876 void charybdis_cmd_topic(char *whosets, char *chan, char *whosetit,
00877 char *topic, time_t when)
00878 {
00879 Uid *ud;
00880
00881 ud = find_uid(whosets);
00882 send_cmd((UseTS6 ? (ud ? ud->uid : whosets) : whosets), "TOPIC %s :%s",
00883 chan, topic);
00884 }
00885
00886 void charybdis_cmd_vhost_off(User * u)
00887 {
00888 send_cmd((UseTS6 ? TS6SID : ServerName), "ENCAP * CHGHOST %s :%s",
00889 u->nick, u->host);
00890 }
00891
00892 void charybdis_cmd_vhost_on(char *nick, char *vIdent, char *vhost)
00893 {
00894 send_cmd((UseTS6 ? TS6SID : ServerName), "ENCAP * CHGHOST %s :%s",
00895 nick, vhost);
00896 }
00897
00898 void charybdis_cmd_unsqline(char *user)
00899 {
00900 Uid *ud;
00901
00902 ud = find_uid(s_OperServ);
00903 send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
00904 "UNRESV * %s", user);
00905 }
00906
00907 void charybdis_cmd_join(char *user, char *channel, time_t chantime)
00908 {
00909 Uid *ud;
00910
00911 ud = find_uid(user);
00912 send_cmd(NULL, "SJOIN %ld %s + :%s", (long int) chantime,
00913 channel, (UseTS6 ? (ud ? ud->uid : user) : user));
00914 }
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925 void charybdis_cmd_akill(char *user, char *host, char *who, time_t when,
00926 time_t expires, char *reason)
00927 {
00928 Uid *ud;
00929
00930 ud = find_uid(s_OperServ);
00931
00932 send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
00933 "KLINE * %ld %s %s :%s",
00934 (long int) (expires - (long) time(NULL)), user, host, reason);
00935 }
00936
00937 void charybdis_cmd_svskill(char *source, char *user, char *buf)
00938 {
00939 Uid *ud, *ud2;
00940
00941 if (!buf) {
00942 return;
00943 }
00944
00945 if (!source || !user) {
00946 return;
00947 }
00948
00949 ud = find_uid(source);
00950 ud2 = find_uid(user);
00951 send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "KILL %s :%s",
00952 (UseTS6 ? (ud2 ? ud2->uid : user) : user), buf);
00953 }
00954
00955 void charybdis_cmd_svsmode(User * u, int ac, char **av)
00956 {
00957 send_cmd((UseTS6 ? TS6SID : ServerName), "SVSMODE %s %s", u->nick,
00958 av[0]);
00959 }
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969 void charybdis_cmd_svinfo()
00970 {
00971 send_cmd(NULL, "SVINFO 6 3 0 :%ld", (long int) time(NULL));
00972 }
00973
00974 void charybdis_cmd_svsinfo()
00975 {
00976
00977 }
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000 void charybdis_cmd_capab()
01001 {
01002 send_cmd(NULL,
01003 "CAPAB :QS EX CHW IE KLN GLN KNOCK TB UNKLN CLUSTER ENCAP SERVICES EUID");
01004 }
01005
01006
01007 void charybdis_cmd_pass(char *pass)
01008 {
01009 if (UseTS6) {
01010 send_cmd(NULL, "PASS %s TS 6 :%s", pass, TS6SID);
01011 } else {
01012 send_cmd(NULL, "PASS %s :TS", pass);
01013 }
01014 }
01015
01016
01017 void charybdis_cmd_server(char *servname, int hop, char *descript)
01018 {
01019 send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript);
01020 }
01021
01022 void charybdis_cmd_connect(int servernum)
01023 {
01024
01025 if (UseTS6) {
01026 me_server =
01027 new_server(NULL, ServerName, ServerDesc, SERVER_ISME, TS6SID);
01028 } else {
01029 me_server =
01030 new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL);
01031 }
01032 if (servernum == 1)
01033 charybdis_cmd_pass(RemotePassword);
01034 else if (servernum == 2)
01035 charybdis_cmd_pass(RemotePassword2);
01036 else if