00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "services.h"
00017 #include "pseudo.h"
00018 #include "bahamut.h"
00019
00020 IRCDVar myIrcd[] = {
00021 {"BahamutIRCd 1.4.*/1.8.*",
00022 "+o",
00023 "+o",
00024 "+o",
00025 "+",
00026 "+io",
00027 "+o",
00028 "+h",
00029 "+i",
00030 "+io",
00031 "+o",
00032 "+o",
00033 "+o",
00034 "+",
00035 "+io",
00036 "+o",
00037 "+h",
00038 "+i",
00039 "+io",
00040 "+",
00041 2,
00042 "-cilmnpstOR",
00043 "+o",
00044 1,
00045 0,
00046 0,
00047 NULL,
00048 NULL,
00049 NULL,
00050 NULL,
00051 "+rd",
00052 NULL,
00053 NULL,
00054 NULL,
00055 "-r+d",
00056 "+d",
00057 1,
00058 1,
00059 1,
00060 0,
00061 3,
00062 0,
00063 0,
00064 1,
00065 0,
00066 0,
00067 0,
00068 0,
00069 1,
00070 1,
00071 1,
00072 0,
00073 0,
00074 1,
00075 CMODE_r,
00076 0,
00077 1,
00078 1,
00079 1,
00080 0,
00081 1,
00082 0,
00083 0,
00084 0,
00085 0,
00086 DEFAULT_MLOCK,
00087 0,
00088 1,
00089 0,
00090 CMODE_j,
00091 0,
00092 1,
00093 1,
00094 NULL,
00095 0,
00096 1,
00097 0,
00098 1,
00099 0,
00100 0,
00101 0,
00102 0,
00103 0,
00104 NULL,
00105 0,
00106 1,
00107 0,
00108 NULL,
00109 1,
00110 }
00111 ,
00112 {NULL}
00113 };
00114
00115 IRCDCAPAB myIrcdcap[] = {
00116 {
00117 CAPAB_NOQUIT,
00118 CAPAB_TSMODE,
00119 CAPAB_UNCONNECT,
00120 0,
00121 0,
00122 0,
00123 CAPAB_BURST,
00124 0,
00125 0,
00126 CAPAB_DKEY,
00127 0,
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,
00144 CAPAB_DOZIP,
00145 0, 0, 0}
00146 };
00147
00148
00149 void bahamut_set_umode(User * user, int ac, char **av)
00150 {
00151 int add = 1;
00152 char *modes = av[0];
00153
00154 ac--;
00155
00156 if (debug)
00157 alog("debug: Changing mode for %s to %s", user->nick, modes);
00158
00159 while (*modes) {
00160
00161
00162
00163
00164 if (add)
00165 user->mode |= umodes[(int) *modes];
00166 else
00167 user->mode &= ~umodes[(int) *modes];
00168
00169 switch (*modes++) {
00170 case '+':
00171 add = 1;
00172 break;
00173 case '-':
00174 add = 0;
00175 break;
00176 case 'a':
00177 if (UnRestrictSAdmin) {
00178 break;
00179 }
00180 if (add && !is_services_admin(user)) {
00181 common_svsmode(user, "-a", NULL);
00182 user->mode &= ~UMODE_a;
00183 }
00184 break;
00185 case 'd':
00186 if (ac == 0) {
00187 alog("user: umode +d with no parameter (?) for user %s",
00188 user->nick);
00189 break;
00190 }
00191
00192 ac--;
00193 av++;
00194 user->svid = strtoul(*av, NULL, 0);
00195 break;
00196 case 'o':
00197 if (add) {
00198 opcnt++;
00199
00200 if (WallOper)
00201 anope_cmd_global(s_OperServ,
00202 "\2%s\2 is now an IRC operator.",
00203 user->nick);
00204 display_news(user, NEWS_OPER);
00205
00206 } else {
00207 opcnt--;
00208 }
00209 break;
00210 case 'r':
00211 if (add && !nick_identified(user)) {
00212 common_svsmode(user, "-r", NULL);
00213 user->mode &= ~UMODE_r;
00214 }
00215 break;
00216 }
00217 }
00218 }
00219
00220
00221 unsigned long umodes[128] = {
00222 0, 0, 0,
00223 0, 0, 0,
00224 0, 0, 0,
00225 0, 0, 0,
00226 0, 0, 0,
00227 0, 0, 0,
00228 0, 0, 0,
00229 0, 0, 0,
00230 0, 0, 0,
00231 0, 0, 0,
00232 0, 0, 0,
00233 0, 0, 0,
00234 0, 0, 0,
00235 0, 0, 0,
00236 0, 0, 0,
00237 0, 0, 0,
00238 0, 0,
00239 0, 0,
00240 0, 0,
00241 0, 0,
00242 0, 0,
00243 0, 0,
00244 0, 0, 0,
00245 0, 0,
00246 UMODE_A, 0, 0,
00247 UMODE_D, 0, UMODE_F,
00248 0, 0, UMODE_I,
00249 0, UMODE_K, 0,
00250 0, 0, UMODE_O,
00251 0, 0, UMODE_R,
00252 0, 0, 0,
00253 0, 0, UMODE_X,
00254 0,
00255 0,
00256 0, 0, 0,
00257 0, 0, 0,
00258 UMODE_a, UMODE_b, UMODE_c,
00259 UMODE_d, UMODE_e, UMODE_f,
00260 UMODE_g, UMODE_h, UMODE_i,
00261 UMODE_j, UMODE_k, 0,
00262 UMODE_m, UMODE_n, UMODE_o,
00263 0, 0, UMODE_r,
00264 UMODE_s, 0, 0,
00265 0, UMODE_w, UMODE_x,
00266 UMODE_y,
00267 0,
00268 0, 0, 0,
00269 0, 0
00270 };
00271
00272 char myCsmodes[128] = {
00273 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00274 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00275
00276 0,
00277 0,
00278 0, 0, 0,
00279 0,
00280 0, 0, 0, 0,
00281 0,
00282
00283 'v', 0, 0, 0, 0,
00284 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00285
00286 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00287 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00288
00289 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00290 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
00291 };
00292
00293
00294 CMMode myCmmodes[128] = {
00295 {NULL}, {NULL}, {NULL},
00296 {NULL}, {NULL}, {NULL},
00297 {NULL}, {NULL}, {NULL},
00298 {NULL}, {NULL}, {NULL},
00299 {NULL}, {NULL}, {NULL},
00300 {NULL}, {NULL}, {NULL},
00301 {NULL}, {NULL}, {NULL},
00302 {NULL}, {NULL}, {NULL},
00303 {NULL}, {NULL}, {NULL},
00304 {NULL}, {NULL}, {NULL},
00305 {NULL}, {NULL}, {NULL},
00306 {NULL}, {NULL}, {NULL},
00307 {NULL}, {NULL}, {NULL},
00308 {NULL}, {NULL}, {NULL},
00309 {NULL}, {NULL}, {NULL},
00310 {NULL}, {NULL}, {NULL},
00311 {NULL}, {NULL}, {NULL},
00312 {NULL}, {NULL}, {NULL},
00313 {NULL}, {NULL}, {NULL},
00314 {NULL}, {NULL}, {NULL},
00315 {NULL}, {NULL}, {NULL},
00316 {NULL}, {NULL}, {NULL},
00317 {NULL}, {NULL}, {NULL},
00318 {NULL}, {NULL}, {NULL},
00319 {NULL},
00320 {add_invite, del_invite},
00321 {NULL},
00322 {NULL}, {NULL}, {NULL},
00323 {NULL}, {NULL}, {NULL},
00324 {NULL}, {NULL}, {NULL},
00325 {NULL}, {NULL}, {NULL},
00326 {NULL}, {NULL}, {NULL},
00327 {NULL},
00328 {NULL}, {NULL},
00329 {NULL}, {NULL}, {NULL},
00330 {NULL},
00331 {NULL},
00332 {add_ban, del_ban},
00333 {NULL}, {NULL},
00334 {add_exception, del_exception},
00335 {NULL}, {NULL},
00336 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00337 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00338 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}
00339 };
00340
00341 CBMode myCbmodes[128] = {
00342 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00343 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
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 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00349 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00350 {0},
00351 {0},
00352 {0},
00353 {0},
00354 {0},
00355 {0},
00356 {0},
00357 {0},
00358 {0},
00359 {0},
00360 {0},
00361 {0},
00362 {0},
00363 {CMODE_M, 0, NULL, NULL},
00364 {0},
00365 {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL},
00366 {0},
00367 {0},
00368 {CMODE_R, 0, NULL, NULL},
00369 {0},
00370 {0},
00371 {0},
00372 {0},
00373 {0},
00374 {0},
00375 {0},
00376 {0},
00377 {0}, {0}, {0}, {0}, {0}, {0},
00378 {0},
00379 {0},
00380 {CMODE_c, 0, NULL, NULL},
00381 {0},
00382 {0},
00383 {0},
00384 {0},
00385 {0},
00386 {CMODE_i, 0, NULL, NULL},
00387 {CMODE_j, 0, set_flood, cs_set_flood},
00388 {CMODE_k, 0, chan_set_key, cs_set_key},
00389 {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit},
00390 {CMODE_m, 0, NULL, NULL},
00391 {CMODE_n, 0, NULL, NULL},
00392 {0},
00393 {CMODE_p, 0, NULL, NULL},
00394 {0},
00395 {CMODE_r, CBM_NO_MLOCK, NULL, NULL},
00396 {CMODE_s, 0, NULL, NULL},
00397 {CMODE_t, 0, NULL, NULL},
00398 {0},
00399 {0},
00400 {0},
00401 {0},
00402 {0},
00403 {0},
00404 {0}, {0}, {0}, {0}
00405 };
00406
00407 CBModeInfo myCbmodeinfos[] = {
00408 {'c', CMODE_c, 0, NULL, NULL},
00409 {'i', CMODE_i, 0, NULL, NULL},
00410 {'j', CMODE_j, 0, get_flood, cs_get_flood},
00411 {'k', CMODE_k, 0, get_key, cs_get_key},
00412 {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit},
00413 {'m', CMODE_m, 0, NULL, NULL},
00414 {'n', CMODE_n, 0, NULL, NULL},
00415 {'p', CMODE_p, 0, NULL, NULL},
00416 {'r', CMODE_r, 0, NULL, NULL},
00417 {'s', CMODE_s, 0, NULL, NULL},
00418 {'t', CMODE_t, 0, NULL, NULL},
00419 {'M', CMODE_M, 0, NULL, NULL},
00420 {'O', CMODE_O, 0, NULL, NULL},
00421 {'R', CMODE_R, 0, NULL, NULL},
00422 {0}
00423 };
00424
00425 CUMode myCumodes[128] = {
00426 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00427 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00428 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00429 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00430
00431 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00432 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00433 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00434 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00435
00436 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00437 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00438 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00439 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00440
00441 {0},
00442 {0},
00443 {0},
00444 {0},
00445 {0},
00446 {0},
00447 {0},
00448 {0},
00449 {0},
00450 {0},
00451 {0},
00452 {0},
00453 {0},
00454 {0},
00455 {0},
00456 {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op},
00457 {0},
00458 {0},
00459 {0},
00460 {0},
00461 {0},
00462 {0},
00463 {CUS_VOICE, 0, NULL},
00464 {0},
00465 {0},
00466 {0},
00467 {0},
00468 {0}, {0}, {0}, {0}, {0}
00469 };
00470
00471
00472
00473 void bahamut_cmd_mode(char *source, char *dest, char *buf)
00474 {
00475 if (!buf) {
00476 return;
00477 }
00478
00479 if (ircdcap->tsmode) {
00480 if (uplink_capab & ircdcap->tsmode) {
00481 send_cmd(source, "MODE %s 0 %s", dest, buf);
00482 } else {
00483 send_cmd(source, "MODE %s %s", dest, buf);
00484 }
00485 } else {
00486 send_cmd(source, "MODE %s %s", dest, buf);
00487 }
00488 }
00489
00490
00491 void bahamut_cmd_svshold(char *nick)
00492 {
00493 send_cmd(ServerName, "SVSHOLD %s %d :%s", nick, NSReleaseTimeout,
00494 "Being held for registered user");
00495 }
00496
00497
00498 void bahamut_cmd_release_svshold(char *nick)
00499 {
00500 send_cmd(ServerName, "SVSHOLD %s 0", nick);
00501 }
00502
00503
00504 void bahamut_cmd_unban(char *name, char *nick)
00505 {
00506 bahamut_cmd_svsmode_chan(name, "-b", nick);
00507 }
00508
00509
00510
00511
00512 void bahamut_cmd_svsmode_chan(char *name, char *mode, char *nick)
00513 {
00514 if (nick) {
00515 send_cmd(ServerName, "SVSMODE %s %s %s", name, mode, nick);
00516 } else {
00517 send_cmd(ServerName, "SVSMODE %s %s", name, mode);
00518 }
00519 }
00520
00521 void bahamut_cmd_bot_chan_mode(char *nick, char *chan)
00522 {
00523 anope_cmd_mode(nick, chan, "%s %s", ircd->botchanumode, nick);
00524 }
00525
00526
00527 int anope_event_sjoin(char *source, int ac, char **av)
00528 {
00529 do_sjoin(source, ac, av);
00530 return MOD_CONT;
00531 }
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551 int anope_event_nick(char *source, int ac, char **av)
00552 {
00553 User *user;
00554
00555 if (ac != 2) {
00556 user = do_nick(source, av[0], av[4], av[5], av[6], av[9],
00557 strtoul(av[2], NULL, 10), strtoul(av[7], NULL, 0),
00558 strtoul(av[8], NULL, 0), NULL, NULL);
00559 if (user) {
00560 anope_set_umode(user, 1, &av[3]);
00561 }
00562 } else {
00563 do_nick(source, av[0], NULL, NULL, NULL, NULL,
00564 strtoul(av[1], NULL, 10), 0, 0, NULL, NULL);
00565 }
00566 return MOD_CONT;
00567 }
00568
00569
00570 int anope_event_capab(char *source, int ac, char **av)
00571 {
00572 capab_parse(ac, av);
00573 return MOD_CONT;
00574 }
00575
00576
00577 int anope_event_os(char *source, int ac, char **av)
00578 {
00579 if (ac < 1)
00580 return MOD_CONT;
00581 m_privmsg(source, s_OperServ, av[0]);
00582 return MOD_CONT;
00583 }
00584
00585
00586 int anope_event_ns(char *source, int ac, char **av)
00587 {
00588 if (ac < 1)
00589 return MOD_CONT;
00590 m_privmsg(source, s_NickServ, av[0]);
00591 return MOD_CONT;
00592 }
00593
00594
00595 int anope_event_ms(char *source, int ac, char **av)
00596 {
00597 if (ac < 1)
00598 return MOD_CONT;
00599 m_privmsg(source, s_MemoServ, av[0]);
00600 return MOD_CONT;
00601 }
00602
00603
00604 int anope_event_hs(char *source, int ac, char **av)
00605 {
00606 if (ac < 1)
00607 return MOD_CONT;
00608 m_privmsg(source, s_HostServ, av[0]);
00609 return MOD_CONT;
00610 }
00611
00612
00613 int anope_event_cs(char *source, int ac, char **av)
00614 {
00615 if (ac < 1)
00616 return MOD_CONT;
00617 m_privmsg(source, s_ChanServ, av[0]);
00618 return MOD_CONT;
00619 }
00620
00621 int anope_event_436(char *source, int ac, char **av)
00622 {
00623 if (ac < 1)
00624 return MOD_CONT;
00625
00626 m_nickcoll(av[0]);
00627 return MOD_CONT;
00628 }
00629
00630
00631 void moduleAddIRCDMsgs(void) {
00632 Message *m;
00633
00634
00635
00636 updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+","-");
00637
00638
00639 m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m);
00640 m = createMessage("402", anope_event_null); addCoreMessage(IRCD,m);
00641 m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m);
00642 m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m);
00643 m = createMessage("INVITE", anope_event_null); addCoreMessage(IRCD,m);
00644 m = createMessage("JOIN", anope_event_join); addCoreMessage(IRCD,m);
00645 m = createMessage("KICK", anope_event_kick); addCoreMessage(IRCD,m);
00646 m = createMessage("KILL", anope_event_kill); addCoreMessage(IRCD,m);
00647 m = createMessage("MODE", anope_event_mode); addCoreMessage(IRCD,m);
00648 m = createMessage("MOTD", anope_event_motd); addCoreMessage(IRCD,m);
00649 m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m);
00650 m = createMessage("NOTICE", anope_event_notice); addCoreMessage(IRCD,m);
00651 m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m);
00652 m = createMessage("PASS", anope_event_pass); addCoreMessage(IRCD,m);
00653 m = createMessage("PING", anope_event_ping); addCoreMessage(IRCD,m);
00654 m = createMessage("PRIVMSG", anope_event_privmsg); addCoreMessage(IRCD,m);
00655 m = createMessage("QUIT", anope_event_quit); addCoreMessage(IRCD,m);
00656 m = createMessage("SERVER", anope_event_server); addCoreMessage(IRCD,m);
00657 m = createMessage("SQUIT", anope_event_squit); addCoreMessage(IRCD,m);
00658 m = createMessage("TOPIC", anope_event_topic); addCoreMessage(IRCD,m);
00659 m = createMessage("USER", anope_event_null); addCoreMessage(IRCD,m);
00660 m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m);
00661 m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m);
00662 m = createMessage("AKILL", anope_event_null); addCoreMessage(IRCD,m);
00663 m = createMessage("GLOBOPS", anope_event_null); addCoreMessage(IRCD,m);
00664 m = createMessage("GNOTICE", anope_event_gnotice); addCoreMessage(IRCD,m);
00665 m = createMessage("GOPER", anope_event_null); addCoreMessage(IRCD,m);
00666 m = createMessage("RAKILL", anope_event_null); addCoreMessage(IRCD,m);
00667 m = createMessage("SILENCE", anope_event_null); addCoreMessage(IRCD,m);
00668 m = createMessage("SVSKILL", anope_event_null); addCoreMessage(IRCD,m);
00669 m = createMessage("SVSMODE", anope_event_mode); addCoreMessage(IRCD,m);
00670 m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m);
00671 m = createMessage("SVSNOOP", anope_event_null); addCoreMessage(IRCD,m);
00672 m = createMessage("SQLINE", anope_event_sqline); addCoreMessage(IRCD,m);
00673 m = createMessage("UNSQLINE", anope_event_null); addCoreMessage(IRCD,m);
00674 m = createMessage("CAPAB", anope_event_capab); addCoreMessage(IRCD,m);
00675 m = createMessage("CS", anope_event_cs); addCoreMessage(IRCD,m);
00676 m = createMessage("HS", anope_event_hs); addCoreMessage(IRCD,m);
00677 m = createMessage("MS", anope_event_ms); addCoreMessage(IRCD,m);
00678 m = createMessage("NS", anope_event_ns); addCoreMessage(IRCD,m);
00679 m = createMessage("OS", anope_event_os); addCoreMessage(IRCD,m);
00680 m = createMessage("RS", anope_event_null); addCoreMessage(IRCD,m);
00681 m = createMessage("SGLINE", anope_event_null); addCoreMessage(IRCD,m);
00682 m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m);
00683 m = createMessage("SS", anope_event_null); addCoreMessage(IRCD,m);
00684 m = createMessage("SVINFO", anope_event_svinfo); addCoreMessage(IRCD,m);
00685 m = createMessage("SZLINE", anope_event_null); addCoreMessage(IRCD,m);
00686 m = createMessage("UNSGLINE", anope_event_null); addCoreMessage(IRCD,m);
00687 m = createMessage("UNSZLINE", anope_event_null); addCoreMessage(IRCD,m);
00688 m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m);
00689 m = createMessage("LUSERSLOCK",anope_event_luserslock); addCoreMessage(IRCD,m);
00690 m = createMessage("BURST", anope_event_burst); addCoreMessage(IRCD,m);
00691 m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m);
00692
00693 }
00694
00695
00696
00697
00698 void bahamut_cmd_sqline(char *mask, char *reason)
00699 {
00700 if (!mask || !reason) {
00701 return;
00702 }
00703
00704 send_cmd(NULL, "SQLINE %s :%s", mask, reason);
00705 }
00706
00707
00708 void bahamut_cmd_unsgline(char *mask)
00709 {
00710 send_cmd(NULL, "UNSGLINE 0 :%s", mask);
00711 }
00712
00713
00714 void bahamut_cmd_unszline(char *mask)
00715 {
00716
00717 send_cmd(NULL, "UNSZLINE 0 %s", mask);
00718
00719 send_cmd(NULL, "RAKILL %s *", mask);
00720 }
00721
00722
00723 void bahamut_cmd_szline(char *mask, char *reason, char *whom)
00724 {
00725
00726 send_cmd(NULL, "SZLINE %s :%s", mask, reason);
00727
00728 send_cmd(NULL, "AKILL %s * %d %s %ld :%s", mask, 86400 * 2, whom,
00729 (long int) time(NULL), reason);
00730 }
00731
00732
00733 void bahamut_cmd_svsnoop(char *server, int set)
00734 {
00735 send_cmd(NULL, "SVSNOOP %s %s", server, (set ? "+" : "-"));
00736 }
00737
00738 void bahamut_cmd_svsadmin(char *server, int set)
00739 {
00740 bahamut_cmd_svsnoop(server, set);
00741 }
00742
00743
00744 void bahamut_cmd_sgline(char *mask, char *reason)
00745 {
00746 send_cmd(NULL, "SGLINE %d :%s:%s", (int)strlen(mask), mask, reason);
00747 }
00748
00749
00750 void bahamut_cmd_remove_akill(char *user, char *host)
00751 {
00752 send_cmd(NULL, "RAKILL %s %s", host, user);
00753 }
00754
00755
00756 void bahamut_cmd_part(char *nick, char *chan, char *buf)
00757 {
00758 if (!nick || !chan) {
00759 return;
00760 }
00761
00762 if (buf) {
00763 send_cmd(nick, "PART %s :%s", chan, buf);
00764 } else {
00765 send_cmd(nick, "PART %s", chan);
00766 }
00767 }
00768
00769
00770 void bahamut_cmd_topic(char *whosets, char *chan, char *whosetit,
00771 char *topic, time_t when)
00772 {
00773 send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit,
00774 (unsigned long int) when, topic);
00775 }
00776
00777
00778 void bahamut_cmd_unsqline(char *user)
00779 {
00780 send_cmd(NULL, "UNSQLINE %s", user);
00781 }
00782
00783
00784 void bahamut_cmd_join(char *user, char *channel, time_t chantime)
00785 {
00786 send_cmd(user, "SJOIN %ld %s", (long int) chantime, channel);
00787 }
00788
00789 void bahamut_cmd_burst()
00790 {
00791 send_cmd(NULL, "BURST");
00792 }
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802 void bahamut_cmd_akill(char *user, char *host, char *who, time_t when,
00803 time_t expires, char *reason)
00804 {
00805 send_cmd(NULL, "AKILL %s %s %d %s %ld :%s", host, user, 86400 * 2, who,
00806 (long int) time(NULL), reason);
00807 }
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818 void bahamut_cmd_svskill(char *source, char *user, char *buf)
00819 {
00820
00821 if (!source || !user || !buf) {
00822 return;
00823 }
00824
00825 send_cmd(source, "SVSKILL %s :%s", user, buf);
00826 }
00827
00828
00829
00830
00831
00832
00833
00834
00835 void bahamut_cmd_svsmode(User * u, int ac, char **av)
00836 {
00837 send_cmd(ServerName, "SVSMODE %s %ld %s%s%s", u->nick,
00838 (long int) u->timestamp, av[0], (ac == 2 ? " " : ""),
00839 (ac == 2 ? av[1] : ""));
00840 }
00841
00842
00843
00844
00845
00846
00847
00848 void bahamut_cmd_squit(char *servname, char *message)
00849 {
00850 send_cmd(NULL, "SQUIT %s :%s", servname, message);
00851 }
00852
00853
00854 void bahamut_cmd_pong(char *servname, char *who)
00855 {
00856 send_cmd(servname, "PONG %s", who);
00857 }
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867 void bahamut_cmd_svinfo()
00868 {
00869 send_cmd(NULL, "SVINFO 3 1 0 :%ld", (long int) time(NULL));
00870 }
00871
00872
00873 void bahamut_cmd_pass(char *pass)
00874 {
00875 send_cmd(NULL, "PASS %s :TS", pass);
00876 }
00877
00878
00879 void bahamut_cmd_server(char *servname, int hop, char *descript)
00880 {
00881 send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript);
00882 }
00883
00884
00885 void bahamut_cmd_capab()
00886 {
00887 send_cmd(NULL,
00888 "CAPAB SSJOIN NOQUIT BURST UNCONNECT NICKIP TSMODE TS3");
00889 }
00890
00891 void bahamut_cmd_connect(int servernum)
00892 {
00893 me_server =
00894 new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL);
00895
00896 if (servernum == 1) {
00897 bahamut_cmd_pass(RemotePassword);
00898 } else if (servernum == 2) {
00899 bahamut_cmd_pass(RemotePassword2);
00900 } else if (servernum == 3) {
00901 bahamut_cmd_pass(RemotePassword3);
00902 }
00903 bahamut_cmd_capab();
00904 bahamut_cmd_server(ServerName, 1, ServerDesc);
00905 bahamut_cmd_svinfo();
00906 bahamut_cmd_burst();
00907 }
00908
00909
00910
00911
00912
00913
00914 int anope_event_server(char *source, int ac, char **av)
00915 {
00916 if (!stricmp(av[1], "1")) {
00917 uplink = sstrdup(av[0]);
00918 }
00919
00920 do_server(source, av[0], av[1], av[2], NULL);
00921 return MOD_CONT;
00922 }
00923
00924
00925 int anope_event_privmsg(char *source, int ac, char **av)
00926 {
00927 if (ac != 2)
00928 return MOD_CONT;
00929 m_privmsg(source, av[0], av[1]);
00930 return MOD_CONT;
00931 }
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941 int anope_event_svinfo(char *source, int ac, char **av)
00942 {
00943 return MOD_CONT;
00944 }
00945
00946
00947 int anope_event_part(char *source, int ac, char **av)
00948 {
00949 if (ac < 1 || ac > 2)
00950 return MOD_CONT;
00951 do_part(source, ac, av);
00952 return MOD_CONT;
00953 }
00954
00955 int anope_event_whois(char *source, int ac, char **av)
00956 {
00957 if (source && ac >= 1) {
00958 m_whois(source, av[0]);
00959 }
00960 return MOD_CONT;
00961 }
00962
00963 int anope_event_topic(char *source, int ac, char **av)
00964 {
00965 if (ac != 4)
00966 return MOD_CONT;
00967 do_topic(source, ac, av);
00968 return MOD_CONT;
00969 }
00970
00971 int anope_event_squit(char *source, int ac, char **av)
00972 {
00973 if (ac != 2)
00974 return MOD_CONT;
00975 do_squit(source, ac, av);
00976 return MOD_CONT;
00977 }
00978
00979 int anope_event_quit(char *source, int ac, char **av)
00980 {
00981 if (ac != 1)
00982 return MOD_CONT;
00983 do_quit(source, ac, av);
00984 return MOD_CONT;
00985 }
00986
00987
00988 int anope_event_mode(char *source, int ac, char **av)
00989 {
00990 if (ac < 2)
00991 return MOD_CONT;
00992
00993 if (*av[0] == '#' || *av[0] == '&') {
00994 do_cmode(source, ac, av);
00995 } else {
00996 do_umode(source, ac, av);
00997 }
00998 return MOD_CONT;
00999 }
01000
01001