00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "services.h"
00015 #include "pseudo.h"
00016 #include "ptlink.h"
00017
00018 IRCDVar myIrcd[] = {
00019 {"PTlink 6.15.*+",
00020 "+o",
00021 "+o",
00022 "+o",
00023 "+o",
00024 "+io",
00025 "+o",
00026 "+h",
00027 "+i",
00028 "+io",
00029 "+o",
00030 "+o",
00031 "+o",
00032 "+io",
00033 "+io",
00034 "+o",
00035 "+h",
00036 "+i",
00037 "+io",
00038 "+",
00039 2,
00040 "-inpsmtCRKOASdcqBNl",
00041 "+ao",
00042 1,
00043 1,
00044 0,
00045 NULL,
00046 NULL,
00047 "+a",
00048 "-a",
00049 "+r",
00050 NULL,
00051 NULL,
00052 NULL,
00053 "-r",
00054 NULL,
00055 1,
00056 1,
00057 1,
00058 0,
00059 4,
00060 0,
00061 0,
00062 1,
00063 0,
00064 0,
00065 0,
00066 0,
00067 0,
00068 0,
00069 0,
00070 1,
00071 0,
00072 1,
00073 CMODE_r,
00074 1,
00075 0,
00076 0,
00077 0,
00078 0,
00079 1,
00080 1,
00081 0,
00082 CMODE_K,
00083 CMODE_A,
00084 DEFAULT_MLOCK,
00085 UMODE_VH,
00086 1,
00087 0,
00088 CMODE_f,
00089 0,
00090 1,
00091 1,
00092 NULL,
00093 0,
00094 1,
00095 0,
00096 0,
00097 0,
00098 0,
00099 0,
00100 0,
00101 0,
00102 NULL,
00103 0,
00104 1,
00105 0,
00106 NULL,
00107 0,
00108 }
00109 ,
00110 {NULL}
00111 };
00112
00113 IRCDCAPAB myIrcdcap[] = {
00114 {
00115 0,
00116 0,
00117 0,
00118 0,
00119 0,
00120 CAPAB_ZIP,
00121 0,
00122 0,
00123 0,
00124 0,
00125 CAPAB_PT4,
00126 CAPAB_SCS,
00127 CAPAB_QS,
00128 0,
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,
00143 0, 0, 0}
00144 };
00145
00146
00147 unsigned long umodes[128] = {
00148 0, 0, 0,
00149 0, 0, 0,
00150 0, 0, 0,
00151 0, 0, 0,
00152 0, 0, 0,
00153 0, 0, 0,
00154 0, 0, 0,
00155 0, 0, 0,
00156 0, 0, 0,
00157 0, 0, 0,
00158 0, 0, 0,
00159 0, 0, 0,
00160 0, 0, 0,
00161 0, 0, 0,
00162 0, 0, 0,
00163 0, 0, 0,
00164 0, 0,
00165 0, 0,
00166 0, 0,
00167 0, 0,
00168 0, 0,
00169 0, 0,
00170 0, 0, 0,
00171 0, 0,
00172 UMODE_A, UMODE_B, 0,
00173 0, 0, 0,
00174 0, UMODE_H, 0,
00175 0, 0, 0,
00176 0, UMODE_N, UMODE_O,
00177 0, 0, UMODE_R,
00178 UMODE_S, UMODE_T, 0,
00179 0, 0, 0,
00180 0,
00181 0,
00182 0, 0, 0,
00183 0, 0, 0,
00184 UMODE_a, 0, 0,
00185 0, 0, 0,
00186 0, UMODE_h, UMODE_i,
00187 0, 0, 0,
00188 0, 0, UMODE_o,
00189 UMODE_p, 0, UMODE_r,
00190 UMODE_s, 0, 0,
00191 UMODE_v, UMODE_w, 0,
00192 UMODE_y,
00193 UMODE_z,
00194 0, 0, 0,
00195 0, 0
00196 };
00197
00198 char myCsmodes[128] = {
00199 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00200 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00201
00202 0,
00203 0,
00204 0, 0, 0,
00205 0,
00206 0, 0, 0, 0,
00207 0,
00208
00209 'v', 0, 0, 'a', 0,
00210 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00211
00212 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00213 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00214
00215 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00216 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
00217 };
00218
00219
00220 CMMode myCmmodes[128] = {
00221 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00222 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00223 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00224 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00225 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00226 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00227 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00228 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00229 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00230 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00231 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00232 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00233 {NULL},
00234 {NULL},
00235 {add_ban, del_ban},
00236 {NULL},
00237 {NULL},
00238 {add_exception, del_exception},
00239 {NULL},
00240 {NULL},
00241 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00242 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00243 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}
00244 };
00245
00246
00247 CBMode myCbmodes[128] = {
00248 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00249 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00250 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00251 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00252 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00253 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00254 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00255 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00256 {0},
00257 {CMODE_A, 0, NULL, NULL},
00258 {CMODE_B, 0, NULL, NULL},
00259 {CMODE_C, 0, NULL, NULL},
00260 {0},
00261 {0},
00262 {0},
00263 {0},
00264 {0},
00265 {0},
00266 {0},
00267 {CMODE_K, 0, NULL, NULL},
00268 {0},
00269 {0},
00270 {CMODE_N, 0, NULL, NULL},
00271 {CMODE_O, 0, NULL, NULL},
00272 {0},
00273 {0},
00274 {CMODE_R, 0, NULL, NULL},
00275 {CMODE_S, 0, NULL, NULL},
00276 {0},
00277 {0},
00278 {0},
00279 {0},
00280 {0},
00281 {0},
00282 {0},
00283 {0}, {0}, {0}, {0}, {0}, {0},
00284 {0},
00285 {0},
00286 {CMODE_c, 0, NULL, NULL},
00287 {CMODE_d, 0, NULL, NULL},
00288 {0},
00289 {CMODE_f, 0, set_flood, cs_set_flood},
00290 {0},
00291 {0},
00292 {CMODE_i, 0, NULL, NULL},
00293 {0},
00294 {CMODE_k, 0, chan_set_key, cs_set_key},
00295 {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit},
00296 {CMODE_m, 0, NULL, NULL},
00297 {CMODE_n, 0, NULL, NULL},
00298 {0},
00299 {CMODE_p, 0, NULL, NULL},
00300 {CMODE_q, 0, NULL, NULL},
00301 {CMODE_r, CBM_NO_MLOCK, NULL, NULL},
00302 {CMODE_s, 0, NULL, NULL},
00303 {CMODE_t, 0, NULL, NULL},
00304 {0},
00305 {0},
00306 {0},
00307 {0},
00308 {0},
00309 {0},
00310 {0}, {0}, {0}, {0}
00311 };
00312
00313 CBModeInfo myCbmodeinfos[] = {
00314 {'c', CMODE_c, 0, NULL, NULL},
00315 {'d', CMODE_d, 0, NULL, NULL},
00316 {'f', CMODE_f, 0, get_flood, cs_get_flood},
00317 {'i', CMODE_i, 0, NULL, NULL},
00318 {'k', CMODE_k, 0, get_key, cs_get_key},
00319 {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit},
00320 {'m', CMODE_m, 0, NULL, NULL},
00321 {'n', CMODE_n, 0, NULL, NULL},
00322 {'p', CMODE_p, 0, NULL, NULL},
00323 {'q', CMODE_q, 0, NULL, NULL},
00324 {'r', CMODE_r, 0, NULL, NULL},
00325 {'s', CMODE_s, 0, NULL, NULL},
00326 {'t', CMODE_t, 0, NULL, NULL},
00327 {'A', CMODE_A, 0, NULL, NULL},
00328 {'B', CMODE_B, 0, NULL, NULL},
00329 {'C', CMODE_C, 0, NULL, NULL},
00330 {'K', CMODE_K, 0, NULL, NULL},
00331 {'N', CMODE_N, 0, NULL, NULL},
00332 {'O', CMODE_O, 0, NULL, NULL},
00333 {'R', CMODE_R, 0, NULL, NULL},
00334 {'S', CMODE_S, 0, NULL, NULL},
00335 {0}
00336 };
00337
00338 CUMode myCumodes[128] = {
00339 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00340 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00341 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00342 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00343
00344 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00345 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00346 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00347 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00348
00349 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00350 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00351 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00352 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00353
00354 {0},
00355
00356 {0},
00357 {0},
00358 {0},
00359 {0},
00360 {0},
00361 {0},
00362 {0},
00363 {0},
00364 {0},
00365 {0},
00366 {0},
00367 {0},
00368 {0},
00369 {0},
00370 {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op},
00371 {0},
00372 {0},
00373 {0},
00374 {0},
00375 {0},
00376 {0},
00377 {CUS_VOICE, 0, NULL},
00378 {0},
00379 {0},
00380 {0},
00381 {0},
00382 {0}, {0}, {0}, {0}, {0}
00383 };
00384
00385
00386
00387 void ptlink_cmd_bot_chan_mode(char *nick, char *chan)
00388 {
00389 anope_cmd_mode(s_ChanServ, chan, "%s %s %s", ircd->botchanumode, nick,
00390 nick);
00391 }
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403 int anope_event_sjoin(char *source, int ac, char **av)
00404 {
00405 do_sjoin(source, ac, av);
00406 return MOD_CONT;
00407 }
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420 int anope_event_newmask(char *source, int ac, char **av)
00421 {
00422 User *u;
00423 char *newhost = NULL, *newuser = NULL;
00424 int tofree = 0;
00425
00426 if (ac != 1)
00427 return MOD_CONT;
00428 u = finduser(source);
00429
00430 if (!u) {
00431 if (debug) {
00432 alog("debug: NEWMASK for nonexistent user %s", av[0]);
00433 }
00434 return MOD_CONT;
00435 }
00436
00437 if ((u->mode & (UMODE_NM | UMODE_VH)) == (UMODE_NM | UMODE_VH)) {
00438
00439
00440
00441
00442
00443 u->mode &= ~UMODE_NM;
00444 if (debug)
00445 alog("debug: Ignoring NEWMASK because it's send because of SVSMODE +r");
00446 return MOD_CONT;
00447 }
00448
00449 newuser = myStrGetOnlyToken(av[0], '@', 0);
00450 if (newuser) {
00451 newhost = myStrGetTokenRemainder(av[0], '@', 1);
00452 tofree = 1;
00453 change_user_username(u, newuser);
00454 free(newuser);
00455 } else {
00456 newhost = av[0];
00457 }
00458
00459 if (newhost && *newhost == '@')
00460 newhost++;
00461
00462 u->mode |= UMODE_VH;
00463
00464 if (newhost)
00465 change_user_host(u, newhost);
00466
00467 if (tofree)
00468 free(newhost);
00469
00470 return MOD_CONT;
00471 }
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496 int anope_event_nick(char *source, int ac, char **av)
00497 {
00498 User *user;
00499
00500 if (ac != 2) {
00501 user = do_nick(source, av[0], av[4], av[5], av[7], av[8],
00502 strtoul(av[2], NULL, 10), 0, 0, av[6], NULL);
00503 if (user)
00504 anope_set_umode(user, 1, &av[3]);
00505 } else {
00506 do_nick(source, av[0], NULL, NULL, NULL, NULL,
00507 strtoul(av[1], NULL, 10), 0, 0, NULL, NULL);
00508 }
00509 return MOD_CONT;
00510 }
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520 int anope_event_server(char *source, int ac, char **av)
00521 {
00522 if (!stricmp(av[1], "1")) {
00523 uplink = sstrdup(av[0]);
00524 }
00525 do_server(source, av[0], av[1], av[3], NULL);
00526 return MOD_CONT;
00527 }
00528
00529 int anope_event_436(char *source, int ac, char **av)
00530 {
00531 if (ac < 1)
00532 return MOD_CONT;
00533
00534 m_nickcoll(av[0]);
00535 return MOD_CONT;
00536 }
00537
00538
00539 void moduleAddIRCDMsgs(void)
00540 {
00541 Message *m;
00542
00543 updateProtectDetails("PROTECT", "PROTECTME", "protect", "deprotect",
00544 "AUTOPROTECT", "+a", "-a");
00545
00546 m = createMessage("401", anope_event_null);
00547 addCoreMessage(IRCD, m);
00548 m = createMessage("402", anope_event_null);
00549 addCoreMessage(IRCD, m);
00550 m = createMessage("436", anope_event_436);
00551 addCoreMessage(IRCD, m);
00552 m = createMessage("461", anope_event_null);
00553 addCoreMessage(IRCD, m);
00554 m = createMessage("AWAY", anope_event_away);
00555 addCoreMessage(IRCD, m);
00556 m = createMessage("INVITE", anope_event_invite);
00557 addCoreMessage(IRCD, m);
00558 m = createMessage("JOIN", anope_event_join);
00559 addCoreMessage(IRCD, m);
00560 m = createMessage("KICK", anope_event_kick);
00561 addCoreMessage(IRCD, m);
00562 m = createMessage("KILL", anope_event_kill);
00563 addCoreMessage(IRCD, m);
00564 m = createMessage("MODE", anope_event_mode);
00565 addCoreMessage(IRCD, m);
00566 m = createMessage("MOTD", anope_event_motd);
00567 addCoreMessage(IRCD, m);
00568 m = createMessage("NICK", anope_event_nick);
00569 addCoreMessage(IRCD, m);
00570 m = createMessage("NOTICE", anope_event_notice);
00571 addCoreMessage(IRCD, m);
00572 m = createMessage("PART", anope_event_part);
00573 addCoreMessage(IRCD, m);
00574 m = createMessage("PASS", anope_event_pass);
00575 addCoreMessage(IRCD, m);
00576 m = createMessage("PING", anope_event_ping);
00577 addCoreMessage(IRCD, m);
00578 m = createMessage("PRIVMSG", anope_event_privmsg);
00579 addCoreMessage(IRCD, m);
00580 m = createMessage("QUIT", anope_event_quit);
00581 addCoreMessage(IRCD, m);
00582 m = createMessage("SERVER", anope_event_server);
00583 addCoreMessage(IRCD, m);
00584 m = createMessage("SQUIT", anope_event_squit);
00585 addCoreMessage(IRCD, m);
00586 m = createMessage("TOPIC", anope_event_topic);
00587 addCoreMessage(IRCD, m);
00588 m = createMessage("USER", anope_event_null);
00589 addCoreMessage(IRCD, m);
00590 m = createMessage("WALLOPS", anope_event_null);
00591 addCoreMessage(IRCD, m);
00592 m = createMessage("WHOIS", anope_event_whois);
00593 addCoreMessage(IRCD, m);
00594 m = createMessage("AKILL", anope_event_null);
00595 addCoreMessage(IRCD, m);
00596 m = createMessage("GLOBOPS", anope_event_null);
00597 addCoreMessage(IRCD, m);
00598 m = createMessage("GNOTICE", anope_event_null);
00599 addCoreMessage(IRCD, m);
00600 m = createMessage("GOPER", anope_event_null);
00601 addCoreMessage(IRCD, m);
00602 m = createMessage("RAKILL", anope_event_null);
00603 addCoreMessage(IRCD, m);
00604 m = createMessage("SILENCE", anope_event_null);
00605 addCoreMessage(IRCD, m);
00606 m = createMessage("SVSKILL", anope_event_null);
00607 addCoreMessage(IRCD, m);
00608 m = createMessage("SVSMODE", anope_event_null);
00609 addCoreMessage(IRCD, m);
00610 m = createMessage("SVSNICK", anope_event_null);
00611 addCoreMessage(IRCD, m);
00612 m = createMessage("SVSNOOP", anope_event_null);
00613 addCoreMessage(IRCD, m);
00614 m = createMessage("SQLINE", anope_event_null);
00615 addCoreMessage(IRCD, m);
00616 m = createMessage("UNSQLINE", anope_event_null);
00617 addCoreMessage(IRCD, m);
00618 m = createMessage("NEWMASK", anope_event_newmask);
00619 addCoreMessage(IRCD, m);
00620 m = createMessage("CAPAB", anope_event_capab);
00621 addCoreMessage(IRCD, m);
00622 m = createMessage("SVINFO", anope_event_svinfo);
00623 addCoreMessage(IRCD, m);
00624 m = createMessage("SVSINFO", anope_event_svsinfo);
00625 addCoreMessage(IRCD, m);
00626 m = createMessage("SJOIN", anope_event_sjoin);
00627 addCoreMessage(IRCD, m);
00628 m = createMessage("REHASH", anope_event_rehash);
00629 addCoreMessage(IRCD, m);
00630 m = createMessage("ADMIN", anope_event_admin);
00631 addCoreMessage(IRCD, m);
00632 m = createMessage("CREDITS", anope_event_credits);
00633 addCoreMessage(IRCD, m);
00634 m = createMessage("ERROR", anope_event_error);
00635 addCoreMessage(IRCD, m);
00636 m = createMessage("NJOIN", anope_event_sjoin);
00637 addCoreMessage(IRCD, m);
00638 m = createMessage("NNICK", anope_event_nick);
00639 addCoreMessage(IRCD, m);
00640 m = createMessage("ZLINE", anope_event_null);
00641 addCoreMessage(IRCD, m);
00642 m = createMessage("UNZLINE", anope_event_null);
00643 addCoreMessage(IRCD, m);
00644 }
00645
00646 int anope_event_svsinfo(char *source, int ac, char **av)
00647 {
00648 return MOD_CONT;
00649 }
00650
00651 int anope_event_svinfo(char *source, int ac, char **av)
00652 {
00653 return MOD_CONT;
00654 }
00655
00656
00657 int anope_event_capab(char *source, int ac, char **av)
00658 {
00659 capab_parse(ac, av);
00660 return MOD_CONT;
00661 }
00662
00663
00664
00665
00666
00667
00668
00669 void ptlink_cmd_sqline(char *mask, char *reason)
00670 {
00671 send_cmd(ServerName, "SQLINE %s :%s", mask, reason);
00672 }
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682 void ptlink_cmd_svsnoop(char *server, int set)
00683 {
00684 send_cmd(NULL, "SVSADMIN %s :%s", server, set ? "noopers" : "rehash");
00685 }
00686
00687 void ptlink_cmd_svsadmin(char *server, int set)
00688 {
00689 ptlink_cmd_svsnoop(server, set);
00690 }
00691
00692
00693
00694
00695
00696
00697 void ptlink_cmd_remove_akill(char *user, char *host)
00698 {
00699 send_cmd(NULL, "UNGLINE %s@%s", user, host);
00700 }
00701
00702
00703 void anope_part(char *nick, char *chan)
00704 {
00705 send_cmd(nick, "PART %s", chan);
00706 }
00707 void anope_topic(char *whosets, char *chan, char *whosetit, char *topic,
00708 time_t when)
00709 {
00710 send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit,
00711 (unsigned long int) when, topic);
00712 }
00713
00714
00715
00716
00717
00718
00719 void ptlink_cmd_unsqline(char *user)
00720 {
00721 send_cmd(NULL, "UNSQLINE %s", user);
00722 }
00723
00724 void ptlink_cmd_join(char *user, char *channel, time_t chantime)
00725 {
00726 send_cmd(ServerName, "SJOIN %ld %s + :%s", (long int) chantime,
00727 channel, user);
00728 }
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738 void ptlink_cmd_akill(char *user, char *host, char *who, time_t when,
00739 time_t expires, char *reason)
00740 {
00741 send_cmd(ServerName, "GLINE %s@%s %i %s :%s", user, host, 86400 * 2,
00742 who, reason);
00743 }
00744
00745
00746 void ptlink_cmd_svskill(char *source, char *user, char *buf)
00747 {
00748 if (!buf) {
00749 return;
00750 }
00751
00752 if (!source || !user) {
00753 return;
00754 }
00755
00756 send_cmd(source, "KILL %s :%s", user, buf);
00757 }
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767 void ptlink_cmd_svsmode(User * u, int ac, char **av)
00768 {
00769 send_cmd(ServerName, "SVSMODE %s %s%s%s", u->nick, av[0],
00770 (ac == 2 ? " " : ""), (ac == 2 ? av[1] : ""));
00771
00772
00773
00774
00775
00776
00777
00778 if ((strchr(av[0], 'r')
00779 && ((u->mode & UMODE_N) || (u->mode & UMODE_R)
00780 || (u->mode & UMODE_a) || (u->mode & UMODE_h))))
00781 u->mode |= UMODE_NM;
00782 }
00783
00784 int anope_event_error(char *source, int ac, char **av)
00785 {
00786 if (ac >= 1) {
00787 if (debug) {
00788 alog("debug: %s", av[0]);
00789 }
00790 }
00791 return MOD_CONT;
00792 }
00793
00794 void ptlink_cmd_squit(char *servname, char *message)
00795 {
00796 send_cmd(NULL, "SQUIT %s :%s", servname, message);
00797 }
00798
00799
00800 void ptlink_cmd_pong(char *servname, char *who)
00801 {
00802 send_cmd(servname, "PONG %s", who);
00803 }
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814 void ptlink_cmd_svinfo()
00815 {
00816 #if defined(PTLINK_TS_CURRENT) && defined(PTLINK_TS_MIN)
00817 send_cmd(NULL, "SVINFO %d %d %lu", PTLINK_TS_CURRENT, PTLINK_TS_MIN,
00818 (unsigned long int) time(NULL));
00819 #else
00820
00821 send_cmd(NULL, "SVINFO 6 3 %lu", (unsigned long int) time(NULL));
00822 #endif
00823 }
00824
00825
00826
00827
00828
00829
00830
00831 void ptlink_cmd_svsinfo()
00832 {
00833 send_cmd(NULL, "SVSINFO %lu %d", (unsigned long int) time(NULL),
00834 maxusercnt);
00835 }
00836
00837
00838
00839
00840
00841
00842
00843 void ptlink_cmd_pass(char *pass)
00844 {
00845 send_cmd(NULL, "PASS %s :TS", pass);
00846 }
00847
00848
00849
00850
00851
00852 void ptlink_cmd_capab()
00853 {
00854 send_cmd(NULL, "CAPAB :QS PTS4");
00855 }
00856
00857
00858 void ptlink_cmd_server(char *servname, int hop, char *descript)
00859 {
00860 send_cmd(NULL, "SERVER %s %d Anope.Services%s :%s", servname, hop,
00861 version_number_dotted, descript);
00862 }
00863 void ptlink_cmd_connect(int servernum)
00864 {
00865 me_server =
00866 new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL);
00867
00868 if (servernum == 1)
00869 ptlink_cmd_pass(RemotePassword);
00870 else if (servernum == 2)
00871 ptlink_cmd_pass(RemotePassword2);
00872 else if (servernum == 3)
00873 ptlink_cmd_pass(RemotePassword3);
00874
00875 ptlink_cmd_capab();
00876 ptlink_cmd_server(ServerName, 1, ServerDesc);
00877 ptlink_cmd_svinfo();
00878 ptlink_cmd_svsinfo();
00879 }
00880
00881
00882
00883 int anope_event_privmsg(char *source, int ac, char **av)
00884 {
00885 if (ac != 2)
00886 return MOD_CONT;
00887 m_privmsg(source, av[0], av[1]);
00888 return MOD_CONT;
00889 }
00890
00891 int anope_event_part(char *source, int ac, char **av)
00892 {
00893 if (ac < 1 || ac > 2)
00894 return MOD_CONT;
00895 do_part(source, ac, av);
00896 return MOD_CONT;
00897 }
00898
00899 int anope_event_whois(char *source, int ac, char **av)
00900 {
00901 if (source && ac >= 1) {
00902 m_whois(source, av[0]);
00903 }
00904 return MOD_CONT;
00905 }
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915 int anope_event_topic(char *source, int ac, char **av)
00916 {
00917 if (ac != 4)
00918 return MOD_CONT;
00919 do_topic(source, ac, av);
00920 return MOD_CONT;
00921 }
00922
00923 int anope_event_squit(char *source, int ac, char **av)
00924 {
00925 if (ac != 2)
00926 return MOD_CONT;
00927 do_squit(source, ac, av);
00928 return MOD_CONT;
00929 }
00930
00931 int anope_event_quit(char *source, int ac, char **av)
00932 {
00933 if (ac != 1)
00934 return MOD_CONT;
00935 do_quit(source, ac, av);
00936 return MOD_CONT;
00937 }
00938
00939
00940
00941
00942
00943
00944
00945 int anope_event_mode(char *source, int ac, char **av)
00946 {
00947 if (ac < 2)
00948 return MOD_CONT;
00949
00950 if (*av[0] == '#' || *av[0] == '&') {
00951 do_cmode(source, ac, av);
00952 } else {
00953 do_umode(source, ac, av);
00954 }
00955 return MOD_CONT;
00956 }
00957
00958
00959 int anope_event_kill(char *source, int ac, char **av)
00960 {
00961 if (ac != 2)
00962 return MOD_CONT;
00963
00964 m_kill(av[0], av[1]);
00965 return MOD_CONT;
00966 }
00967
00968 int anope_event_kick(char *source, int ac, char **av)
00969 {
00970 if (ac != 3)
00971 return MOD_CONT;
00972 do_kick(source, ac, av);
00973 return MOD_CONT;
00974 }
00975
00976
00977 int anope_event_join(char *source, int ac, char **av)
00978 {
00979 if (ac != 1)
00980 return MOD_CONT;
00981 do_join(source, ac, av);
00982 return MOD_CONT;
00983 }
00984
00985 int anope_event_motd(char *source, int ac, char **av)
00986 {
00987 if (!source) {
00988 return MOD_CONT;
00989 }
00990
00991 m_motd(source);
00992 return MOD_CONT;
00993 }
00994
00995 void ptlink_cmd_notice_ops(char *source, char *dest, char *buf)
00996 {
00997 if (!buf) {
00998 return;
00999 }
01000
01001 send_cmd(NULL, "NOTICE @%s :%s", dest, buf);
01002 }
01003
01004
01005 void ptlink_cmd_notice(char *source, char *dest, char *buf)
01006 {
01007 if (!buf) {
01008 return;
01009 }
01010
01011 if (NSDefFlags & NI_MSG) {
01012 ptlink_cmd_privmsg2(source, dest, buf);
01013 } else {
01014 send_cmd(source, "NOTICE %s :%s", dest, buf);
01015 }
01016 }
01017
01018 void ptlink_cmd_notice2(char *source, char *dest, char *msg)
01019 {
01020 send_cmd(source, "NOTICE %s :%s", dest, msg);
01021 }
01022
01023 void ptlink_cmd_privmsg(char *source, char *dest, char *buf)
01024 {
01025 if (!buf) {
01026 return;
01027 }
01028
01029 send_cmd(source, "PRIVMSG %s :%s", dest, buf);
01030 }
01031
01032 void ptlink_cmd_privmsg2(char *source, char *dest, char *msg)
01033 {
01034 send_cmd(source, "PRIVMSG %s :%s", dest, msg);
01035 }
01036
01037 void ptlink_cmd_serv_notice(char *source, char *dest, char *msg)
01038 {
01039 send_cmd(source, "NOTICE $%s :%s", dest, msg);
01040 }
01041
01042 void ptlink_cmd_serv_privmsg(char *source, char *dest, char *msg)
01043 {
01044 send_cmd(source, "PRIVMSG $%s :%s", dest, msg);
01045 }
01046
01047
01048 void ptlink_cmd_global(char *source, char *buf)
01049 {
01050 if (!buf) {
01051 return;
01052 }
01053
01054 send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf);
01055 }
01056
01057
01058 void ptlink_cmd_391(char *source, cha