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