00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "services.h"
00015 #include "pseudo.h"
00016 #include "rageircd.h"
00017
00018 IRCDVar myIrcd[] = {
00019 {"RageIRCd 2.0.*",
00020 "+d",
00021 "+d",
00022 "+d",
00023 "+d",
00024 "+di",
00025 "+d",
00026 "+dh",
00027 "+di",
00028 "+di",
00029 "+o",
00030 "+o",
00031 "+o",
00032 "+io",
00033 "+io",
00034 "+o",
00035 "+o",
00036 "+i",
00037 "+io",
00038 "+",
00039 3,
00040 "-ilmnpRstcOACNM",
00041 "+o",
00042 1,
00043 1,
00044 0,
00045 NULL,
00046 NULL,
00047 "+a",
00048 "-a",
00049 "+rd",
00050 NULL,
00051 NULL,
00052 NULL,
00053 "-rd",
00054 "-r+d",
00055 1,
00056 1,
00057 0,
00058 1,
00059 3,
00060 0,
00061 0,
00062 1,
00063 0,
00064 0,
00065 0,
00066 1,
00067 1,
00068 1,
00069 0,
00070 0,
00071 0,
00072 1,
00073 CMODE_r,
00074 0,
00075 1,
00076 1,
00077 1,
00078 0,
00079 1,
00080 1,
00081 0,
00082 CMODE_p,
00083 CMODE_A,
00084 DEFAULT_MLOCK,
00085 UMODE_x,
00086 0,
00087 0,
00088 0,
00089 0,
00090 1,
00091 0,
00092 NULL,
00093 0,
00094 1,
00095 0,
00096 1,
00097 0,
00098 0,
00099 0,
00100 0,
00101 0,
00102 "x",
00103 0,
00104 1,
00105 0,
00106 NULL,
00107 1,
00108 }
00109 ,
00110 {NULL}
00111 };
00112
00113 IRCDCAPAB myIrcdcap[] = {
00114 {
00115 CAPAB_NOQUIT,
00116 CAPAB_TSMODE,
00117 CAPAB_UNCONNECT,
00118 0,
00119 0,
00120 CAPAB_ZIP,
00121 CAPAB_BURST,
00122 0,
00123 0,
00124 CAPAB_DKEY,
00125 0,
00126 0,
00127 0,
00128 CAPAB_UID,
00129 0,
00130 0,
00131 0,
00132 0,
00133 CAPAB_SN2,
00134 CAPAB_TOKEN,
00135 CAPAB_VHOST,
00136 CAPAB_SSJ3,
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, 0, 0,
00173 0, 0, 0,
00174 0, 0, 0,
00175 0, 0, 0,
00176 0, 0, 0,
00177 0, 0, UMODE_R,
00178 0, 0, 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 0, 0, UMODE_r,
00190 0, 0, 0,
00191 0, UMODE_w, 0,
00192 0,
00193 0,
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 'h',
00206 0, 0, 0, 0,
00207 'a',
00208
00209 'v', 0, 0, 0, 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},
00222 {NULL}, {NULL}, {NULL},
00223 {NULL}, {NULL}, {NULL},
00224 {NULL}, {NULL}, {NULL},
00225 {NULL}, {NULL}, {NULL},
00226 {NULL}, {NULL}, {NULL},
00227 {NULL}, {NULL}, {NULL},
00228 {NULL}, {NULL}, {NULL},
00229 {NULL}, {NULL}, {NULL},
00230 {NULL}, {NULL}, {NULL},
00231 {NULL}, {NULL}, {NULL},
00232 {NULL}, {NULL}, {NULL},
00233 {NULL}, {NULL}, {NULL},
00234 {NULL}, {NULL}, {NULL},
00235 {NULL}, {NULL}, {NULL},
00236 {NULL}, {NULL}, {NULL},
00237 {NULL}, {NULL}, {NULL},
00238 {NULL}, {NULL}, {NULL},
00239 {NULL}, {NULL}, {NULL},
00240 {NULL}, {NULL}, {NULL},
00241 {NULL}, {NULL}, {NULL},
00242 {NULL}, {NULL}, {NULL},
00243 {NULL}, {NULL}, {NULL},
00244 {NULL}, {NULL}, {NULL},
00245 {NULL},
00246 {add_invite, del_invite},
00247 {NULL},
00248 {NULL}, {NULL}, {NULL},
00249 {NULL}, {NULL}, {NULL},
00250 {NULL}, {NULL}, {NULL},
00251 {NULL}, {NULL}, {NULL},
00252 {NULL}, {NULL}, {NULL},
00253 {NULL},
00254 {NULL}, {NULL},
00255 {NULL}, {NULL}, {NULL},
00256 {NULL},
00257 {NULL},
00258 {add_ban, del_ban},
00259 {NULL},
00260 {NULL},
00261 {add_exception, del_exception},
00262 {NULL},
00263 {NULL},
00264 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00265 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00266 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}
00267 };
00268
00269
00270 CBMode myCbmodes[128] = {
00271 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00272 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00273 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00274 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00275 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00276 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00277 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00278 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00279 {0},
00280 {CMODE_A, CBM_NO_USER_MLOCK, NULL, NULL},
00281 {0},
00282 {CMODE_C, 0, NULL, NULL},
00283 {0},
00284 {0},
00285 {0},
00286 {0},
00287 {0},
00288 {0},
00289 {0},
00290 {0},
00291 {0},
00292 {CMODE_M, 0, NULL, NULL},
00293 {CMODE_N, 0, NULL, NULL},
00294 {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL},
00295 {0},
00296 {0},
00297 {CMODE_R, 0, NULL, NULL},
00298 {CMODE_S, 0, NULL, NULL},
00299 {0},
00300 {0},
00301 {0},
00302 {0},
00303 {0},
00304 {0},
00305 {0},
00306 {0}, {0}, {0}, {0}, {0}, {0},
00307 {0},
00308 {0},
00309 {CMODE_c, 0, NULL, NULL},
00310 {0},
00311 {0},
00312 {0},
00313 {0},
00314 {0},
00315 {CMODE_i, 0, NULL, NULL},
00316 {0},
00317 {CMODE_k, 0, chan_set_key, cs_set_key},
00318 {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit},
00319 {CMODE_m, 0, NULL, NULL},
00320 {CMODE_n, 0, NULL, NULL},
00321 {0},
00322 {CMODE_p, 0, NULL, NULL},
00323 {0},
00324 {CMODE_r, CBM_NO_MLOCK, NULL, NULL},
00325 {CMODE_s, 0, NULL, NULL},
00326 {CMODE_t, 0, NULL, NULL},
00327 {0},
00328 {0},
00329 {0},
00330 {0},
00331 {0},
00332 {0},
00333 {0}, {0}, {0}, {0}
00334 };
00335
00336 CBModeInfo myCbmodeinfos[] = {
00337 {'c', CMODE_c, 0, NULL, NULL},
00338 {'i', CMODE_i, 0, NULL, NULL},
00339 {'k', CMODE_k, 0, get_key, cs_get_key},
00340 {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit},
00341 {'m', CMODE_m, 0, NULL, NULL},
00342 {'n', CMODE_n, 0, NULL, NULL},
00343 {'p', CMODE_p, 0, NULL, NULL},
00344 {'r', CMODE_r, 0, NULL, NULL},
00345 {'s', CMODE_s, 0, NULL, NULL},
00346 {'t', CMODE_t, 0, NULL, NULL},
00347 {'A', CMODE_A, 0, NULL, NULL},
00348 {'C', CMODE_C, 0, NULL, NULL},
00349 {'M', CMODE_M, 0, NULL, NULL},
00350 {'N', CMODE_N, 0, NULL, NULL},
00351 {'O', CMODE_O, 0, NULL, NULL},
00352 {'R', CMODE_R, 0, NULL, NULL},
00353 {0}
00354 };
00355
00356 CUMode myCumodes[128] = {
00357 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00358 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00359 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00360 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00361
00362 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00363 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00364 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00365 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00366
00367 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00368 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00369 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00370 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00371
00372 {0},
00373 {CUS_PROTECT, CUF_PROTECT_BOTSERV, check_valid_admin},
00374 {0},
00375 {0},
00376 {0},
00377 {0},
00378 {0},
00379 {0},
00380 {CUS_HALFOP, 0, check_valid_op},
00381 {0},
00382 {0},
00383 {0},
00384 {0},
00385 {0},
00386 {0},
00387 {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op},
00388 {0},
00389 {0},
00390 {0},
00391 {0},
00392 {0},
00393 {0},
00394 {CUS_VOICE, 0, NULL},
00395 {0},
00396 {0},
00397 {0},
00398 {0},
00399 {0}, {0}, {0}, {0}, {0}
00400 };
00401
00402
00403
00404 void rageircd_cmd_bot_unban(ChannelInfo * ci, char *nick)
00405 {
00406 send_cmd(ServerName, "SVSMODE %s -b %s", ci->name, nick);
00407 }
00408
00409 int anope_event_sjoin(char *source, int ac, char **av)
00410 {
00411 do_sjoin(source, ac, av);
00412 return MOD_CONT;
00413 }
00414
00415 int anope_event_nick(char *source, int ac, char **av)
00416 {
00417 User *user;
00418
00419 if (ac != 2) {
00420 user = do_nick(source, av[0], av[4], av[5], av[6], av[9],
00421 strtoul(av[2], NULL, 10), strtoul(av[7], NULL, 0),
00422 strtoul(av[8], NULL, 0), "*", NULL);
00423 if (user)
00424 anope_set_umode(user, 1, &av[3]);
00425 } else {
00426 do_nick(source, av[0], NULL, NULL, NULL, NULL,
00427 strtoul(av[1], NULL, 10), 0, 0, NULL, NULL);
00428 }
00429 return MOD_CONT;
00430 }
00431
00432
00433 int anope_event_capab(char *source, int ac, char **av)
00434 {
00435 capab_parse(ac, av);
00436 return MOD_CONT;
00437 }
00438
00439 int anope_event_vhost(char *source, int ac, char **av)
00440 {
00441 User *u;
00442
00443 if (ac != 2)
00444 return MOD_CONT;
00445
00446 u = finduser(av[0]);
00447 if (!u) {
00448 if (debug) {
00449 alog("debug: VHOST for nonexistent user %s", av[0]);
00450 }
00451 return MOD_CONT;
00452 }
00453
00454 change_user_host(u, av[1]);
00455 return MOD_CONT;
00456 }
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474 int anope_event_snick(char *source, int ac, char **av)
00475 {
00476 User *user;
00477
00478 if (ac != 2) {
00479 user = do_nick(source, av[0], av[3], av[4], av[7], av[10],
00480 strtoul(av[1], NULL, 10), strtoul(av[8], NULL, 0),
00481 strtoul(av[5], NULL, 0), av[6], NULL);
00482 if (user) {
00483 anope_set_umode(user, 1, &av[9]);
00484 }
00485 }
00486 return MOD_CONT;
00487 }
00488
00489 int anope_event_436(char *source, int ac, char **av)
00490 {
00491 if (ac < 1)
00492 return MOD_CONT;
00493
00494 m_nickcoll(av[0]);
00495 return MOD_CONT;
00496 }
00497
00498
00499
00500 void moduleAddIRCDMsgs(void) {
00501 Message *m;
00502
00503 updateProtectDetails("ADMIN","ADMINME","admin","deadmin","AUTOADMIN","+a","-a");
00504
00505 m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m);
00506 m = createMessage("402", anope_event_null); addCoreMessage(IRCD,m);
00507 m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m);
00508 m = createMessage("482", anope_event_482); addCoreMessage(IRCD,m);
00509 m = createMessage("461", anope_event_null); addCoreMessage(IRCD,m);
00510 m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m);
00511 m = createMessage("INVITE", anope_event_null); addCoreMessage(IRCD,m);
00512 m = createMessage("JOIN", anope_event_join); addCoreMessage(IRCD,m);
00513 m = createMessage("KICK", anope_event_kick); addCoreMessage(IRCD,m);
00514 m = createMessage("KILL", anope_event_kill); addCoreMessage(IRCD,m);
00515 m = createMessage("MODE", anope_event_mode); addCoreMessage(IRCD,m);
00516 m = createMessage("MOTD", anope_event_motd); addCoreMessage(IRCD,m);
00517 m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m);
00518 m = createMessage("NOTICE", anope_event_notice); addCoreMessage(IRCD,m);
00519 m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m);
00520 m = createMessage("PASS", anope_event_pass); addCoreMessage(IRCD,m);
00521 m = createMessage("PING", anope_event_ping); addCoreMessage(IRCD,m);
00522 m = createMessage("PRIVMSG", anope_event_privmsg); addCoreMessage(IRCD,m);
00523 m = createMessage("QUIT", anope_event_quit); addCoreMessage(IRCD,m);
00524 m = createMessage("SERVER", anope_event_server); addCoreMessage(IRCD,m);
00525 m = createMessage("SQUIT", anope_event_squit); addCoreMessage(IRCD,m);
00526 m = createMessage("TOPIC", anope_event_topic); addCoreMessage(IRCD,m);
00527 m = createMessage("USER", anope_event_null); addCoreMessage(IRCD,m);
00528 m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m);
00529 m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m);
00530 m = createMessage("AKILL", anope_event_null); addCoreMessage(IRCD,m);
00531 m = createMessage("GLOBOPS", anope_event_globops); addCoreMessage(IRCD,m);
00532 m = createMessage("GOPER", anope_event_null); addCoreMessage(IRCD,m);
00533 m = createMessage("RAKILL", anope_event_null); addCoreMessage(IRCD,m);
00534 m = createMessage("SILENCE", anope_event_null); addCoreMessage(IRCD,m);
00535 m = createMessage("SVSKILL", anope_event_null); addCoreMessage(IRCD,m);
00536 m = createMessage("SVSMODE", anope_event_mode); addCoreMessage(IRCD,m);
00537 m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m);
00538 m = createMessage("SVSNOOP", anope_event_null); addCoreMessage(IRCD,m);
00539 m = createMessage("SQLINE", anope_event_sqline); addCoreMessage(IRCD,m);
00540 m = createMessage("UNSQLINE", anope_event_null); addCoreMessage(IRCD,m);
00541 m = createMessage("CAPAB", anope_event_capab); addCoreMessage(IRCD,m);
00542 m = createMessage("CS", anope_event_cs); addCoreMessage(IRCD,m);
00543 m = createMessage("HS", anope_event_hs); addCoreMessage(IRCD,m);
00544 m = createMessage("MS", anope_event_ms); addCoreMessage(IRCD,m);
00545 m = createMessage("NS", anope_event_ns); addCoreMessage(IRCD,m);
00546 m = createMessage("OS", anope_event_os); addCoreMessage(IRCD,m);
00547 m = createMessage("RS", anope_event_null); addCoreMessage(IRCD,m);
00548 m = createMessage("SGLINE", anope_event_null); addCoreMessage(IRCD,m);
00549 m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m);
00550 m = createMessage("SS", anope_event_null); addCoreMessage(IRCD,m);
00551 m = createMessage("SVINFO", anope_event_svinfo); addCoreMessage(IRCD,m);
00552 m = createMessage("SZLINE", anope_event_null); addCoreMessage(IRCD,m);
00553 m = createMessage("UNSGLINE", anope_event_null); addCoreMessage(IRCD,m);
00554 m = createMessage("UNSZLINE", anope_event_null); addCoreMessage(IRCD,m);
00555 m = createMessage("SNICK", anope_event_snick); addCoreMessage(IRCD,m);
00556 m = createMessage("VHOST", anope_event_vhost); addCoreMessage(IRCD,m);
00557 m = createMessage("MYID", anope_event_myid); addCoreMessage(IRCD,m);
00558 m = createMessage("GNOTICE", anope_event_notice); addCoreMessage(IRCD,m);
00559 m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m);
00560 m = createMessage("BURST", anope_event_burst); addCoreMessage(IRCD,m);
00561 m = createMessage("REHASH", anope_event_rehash); addCoreMessage(IRCD,m);
00562 m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m);
00563 m = createMessage("CREDITS", anope_event_credits); addCoreMessage(IRCD,m);
00564 }
00565
00566
00567 int anope_event_error(char *source, int ac, char **av)
00568 {
00569 if (ac >= 1) {
00570 if (debug) {
00571 alog("debug: %s", av[0]);
00572 }
00573 }
00574 return MOD_CONT;
00575 }
00576
00577
00578 int anope_event_burst(char *source, int ac, char **av)
00579 {
00580 Server *s;
00581 s = findserver(servlist, source);
00582 if (ac > 1) {
00583
00584 } else {
00585
00586
00587
00588
00589
00590 if (!s && serv_uplink)
00591 s = serv_uplink;
00592 finish_sync(s, 1);
00593 }
00594
00595 return MOD_CONT;
00596 }
00597
00598 void rageircd_cmd_sqline(char *mask, char *reason)
00599 {
00600 if (!mask || !reason) {
00601 return;
00602 }
00603
00604 send_cmd(NULL, "SQLINE %s :%s", mask, reason);
00605 }
00606
00607 void rageircd_cmd_unsgline(char *mask)
00608 {
00609 send_cmd(NULL, "UNSGLINE 0 :%s", mask);
00610 }
00611
00612 void rageircd_cmd_unszline(char *mask)
00613 {
00614 send_cmd(NULL, "UNSZLINE 0 %s", mask);
00615 }
00616
00617 void rageircd_cmd_szline(char *mask, char *reason, char *whom)
00618 {
00619 send_cmd(NULL, "SZLINE %s :%s", mask, reason);
00620 }
00621
00622 void rageircd_cmd_svsnoop(char *server, int set)
00623 {
00624 send_cmd(NULL, "SVSNOOP %s %s", server, (set ? "+" : "-"));
00625 }
00626
00627 void rageircd_cmd_svsadmin(char *server, int set)
00628 {
00629 rageircd_cmd_svsnoop(server, set);
00630 }
00631
00632 void rageircd_cmd_sgline(char *mask, char *reason)
00633 {
00634 send_cmd(NULL, "SGLINE %d :%s:%s", (int)strlen(mask), mask, reason);
00635
00636 }
00637
00638 void rageircd_cmd_remove_akill(char *user, char *host)
00639 {
00640 send_cmd(NULL, "RAKILL %s %s", host, user);
00641 }
00642
00643
00644
00645 void rageircd_cmd_part(char *nick, char *chan, char *buf)
00646 {
00647 if (!nick || !chan) {
00648 return;
00649 }
00650
00651 if (buf) {
00652 send_cmd(nick, "PART %s :%s", chan, buf);
00653 } else {
00654 send_cmd(nick, "PART %s", chan);
00655 }
00656 }
00657
00658 void rageircd_cmd_topic(char *whosets, char *chan, char *whosetit,
00659 char *topic, time_t when)
00660 {
00661 send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit,
00662 (unsigned long int) when, topic);
00663 }
00664
00665 void rageircd_cmd_vhost_off(User * u)
00666 {
00667 send_cmd(s_HostServ, "SVSMODE %s -x", u->nick);
00668 notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick, ircd->vhostchar);
00669 }
00670
00671 void rageircd_cmd_chghost(char *nick, char *vhost)
00672 {
00673 if (!nick || !vhost) {
00674 return;
00675 }
00676 send_cmd(ServerName, "VHOST %s %s", nick, vhost);
00677 }
00678
00679 void rageircd_cmd_vhost_on(char *nick, char *vIdent, char *vhost)
00680 {
00681 send_cmd(s_HostServ, "SVSMODE %s +x", nick);
00682 rageircd_cmd_chghost(nick, vhost);
00683 }
00684
00685 void rageircd_cmd_unsqline(char *user)
00686 {
00687 send_cmd(NULL, "UNSQLINE %s", user);
00688 }
00689
00690 void rageircd_cmd_join(char *user, char *channel, time_t chantime)
00691 {
00692 send_cmd(user, "SJOIN %ld %s", (long int) chantime, channel);
00693 }
00694
00695 void rageircd_cmd_akill(char *user, char *host, char *who, time_t when,
00696 time_t expires, char *reason)
00697 {
00698 send_cmd(NULL, "AKILL %s %s %d %s %ld :%s", host, user, 86400 * 2, who,
00699 (long int) time(NULL), reason);
00700 }
00701
00702 void rageircd_cmd_svskill(char *source, char *user, char *buf)
00703 {
00704 if (!buf) {
00705 return;
00706 }
00707
00708 if (!source || !user) {
00709 return;
00710 }
00711
00712 send_cmd(source, "SVSKILL %s :%s", user, buf);
00713 }
00714
00715 void rageircd_cmd_svsmode(User * u, int ac, char **av)
00716 {
00717 send_cmd(ServerName, "SVSMODE %s %ld %s%s%s", u->nick,
00718 (long int) u->timestamp, av[0], (ac == 2 ? " " : ""),
00719 (ac == 2 ? av[1] : ""));
00720 }
00721
00722 void rageircd_cmd_squit(char *servname, char *message)
00723 {
00724 send_cmd(NULL, "SQUIT %s :%s", servname, message);
00725 }
00726
00727
00728 void rageircd_cmd_pong(char *servname, char *who)
00729 {
00730 send_cmd(servname, "PONG %s", who);
00731 }
00732
00733 void rageircd_cmd_svinfo()
00734 {
00735 send_cmd(NULL, "SVINFO 5 3 0 %ld bluemoon 0", (long int) time(NULL));
00736 }
00737
00738 void rageircd_cmd_capab()
00739 {
00740
00741 send_cmd(NULL, "CAPAB BURST UNCONNECT SSJ3 SN2 VHOST TSMODE");
00742 }
00743
00744 void rageircd_cmd_server(char *servname, int hop, char *descript)
00745 {
00746 send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript);
00747 }
00748
00749
00750 void rageircd_cmd_pass(char *pass)
00751 {
00752 send_cmd(NULL, "PASS %s :TS", pass);
00753 }
00754
00755 void rageircd_cmd_burst()
00756 {
00757 send_cmd(NULL, "BURST");
00758 }
00759
00760 void rageircd_cmd_connect(int servernum)
00761 {
00762 if (Numeric) {
00763 me_server =
00764 new_server(NULL, ServerName, ServerDesc, SERVER_ISME, Numeric);
00765 } else {
00766 me_server =
00767 new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL);
00768 }
00769
00770 if (servernum == 1)
00771 rageircd_cmd_pass(RemotePassword);
00772 else if (servernum == 2)
00773 rageircd_cmd_pass(RemotePassword2);
00774 else if (servernum == 3)
00775 rageircd_cmd_pass(RemotePassword3);
00776 rageircd_cmd_capab();
00777 if (Numeric) {
00778 send_cmd(NULL, "MYID !%s", Numeric);
00779 }
00780 rageircd_cmd_server(ServerName, 1, ServerDesc);
00781 rageircd_cmd_svinfo();
00782 rageircd_cmd_burst();
00783 }
00784
00785 void rageircd_set_umode(User * user, int ac, char **av)
00786 {
00787 int add = 1;
00788 char *modes = av[0];
00789
00790 ac--;
00791
00792 if (debug)
00793 alog("debug: Changing mode for %s to %s", user->nick, modes);
00794
00795 while (*modes) {
00796
00797
00798
00799
00800 if (add)
00801 user->mode |= umodes[(int) *modes];
00802 else
00803 user->mode &= ~umodes[(int) *modes];
00804
00805 switch (*modes++) {
00806 case '+':
00807 add = 1;
00808 break;
00809 case '-':
00810 add = 0;
00811 break;
00812 case 'd':
00813 if (ac == 0) {
00814 alog("user: umode +d with no parameter (?) for user %s",
00815 user->nick);
00816 break;
00817 }
00818
00819 ac--;
00820 av++;
00821 user->svid = strtoul(*av, NULL, 0);
00822 break;
00823 case 'o':
00824 if (add) {
00825 opcnt++;
00826
00827 if (WallOper)
00828 anope_cmd_global(s_OperServ,
00829 "\2%s\2 is now an IRC operator.",
00830 user->nick);
00831 display_news(user, NEWS_OPER);
00832 if (is_services_oper(user)) {
00833 common_svsmode(user, "+a", NULL);
00834 user->mode |= UMODE_a;
00835 }
00836 } else {
00837 opcnt--;
00838 }
00839 break;
00840 case 'r':
00841 if (add && !nick_identified(user)) {
00842 common_svsmode(user, "-r", NULL);
00843 user->mode &= ~UMODE_r;
00844 }
00845 break;
00846 case 'x':
00847 update_host(user);
00848 break;
00849 }
00850 }
00851 }
00852
00853
00854 void rageircd_cmd_global(char *source, char *buf)
00855 {
00856 if (!buf) {
00857 return;
00858 }
00859
00860 send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf);
00861 }
00862
00863 void rageircd_cmd_notice_ops(char *source, char *dest, char *buf)
00864 {
00865 if (!buf) {
00866 return;
00867 }
00868
00869 send_cmd(NULL, "NOTICE @%s :%s", dest, buf);
00870 }
00871
00872
00873 void rageircd_cmd_notice(char *source, char *dest, char *buf)
00874 {
00875 if (!buf) {
00876 return;
00877 }
00878
00879 if (NSDefFlags & NI_MSG) {
00880 rageircd_cmd_privmsg2(source, dest, buf);
00881 } else {
00882 send_cmd(source, "NOTICE %s :%s", dest, buf);
00883 }
00884 }
00885
00886 void rageircd_cmd_notice2(char *source, char *dest, char *msg)
00887 {
00888 send_cmd(source, "NOTICE %s :%s", dest, msg);
00889 }
00890
00891 void rageircd_cmd_privmsg(char *source, char *dest, char *buf)
00892 {
00893 if (!buf) {
00894 return;
00895 }
00896
00897 send_cmd(source, "PRIVMSG %s :%s", dest, buf);
00898 }
00899
00900 void rageircd_cmd_privmsg2(char *source, char *dest, char *msg)
00901 {
00902 send_cmd(source, "PRIVMSG %s :%s", dest, msg);
00903 }
00904
00905 void rageircd_cmd_serv_notice(char *source, char *dest, char *msg)
00906 {
00907 send_cmd(source, "NOTICE $%s :%s", dest, msg);
00908 }
00909
00910 void rageircd_cmd_serv_privmsg(char *source, char *dest, char *msg)
00911 {
00912 send_cmd(source, "PRIVMSG $%s :%s", dest, msg);
00913 }
00914
00915 int anope_event_away(char *source, int ac, char **av)
00916 {
00917 if (!source) {
00918 return MOD_CONT;
00919 }
00920 m_away(source, (ac ? av[0] : NULL));
00921 return MOD_CONT;
00922 }
00923
00924 int anope_event_ping(char *source, int ac, char **av)
00925 {
00926 if (ac < 1)
00927 return MOD_CONT;
00928 rageircd_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]);
00929 return MOD_CONT;
00930 }
00931
00932 void rageircd_cmd_351(char *source)
00933 {
00934 send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s",
00935 source, version_number, ServerName, ircd->name, version_flags,
00936 EncModule, version_build);
00937 }
00938
00939 void rageircd_cmd_mode(char *source, char *dest, char *buf)
00940 {
00941 if (!buf) {
00942 return;
00943 }
00944
00945 if (ircdcap->tsmode) {
00946 if (uplink_capab & ircdcap->tsmode || UseTSMODE) {
00947 send_cmd(source, "MODE %s 0 %s", dest, buf);
00948 } else {
00949 send_cmd(source, "MODE %s %s", dest, buf);
00950 }
00951 } else {
00952 send_cmd(source, "MODE %s %s", dest, buf);
00953 }
00954 }
00955
00956
00957 void rageircd_cmd_kick(char *source, char *chan, char *user, char *buf)
00958 {
00959 if (buf) {
00960 send_cmd(source, "KICK %s %s :%s", chan, user, buf);
00961 } else {
00962 send_cmd(source, "KICK %s %s", chan, user);
00963 }
00964 }
00965