00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "services.h"
00013 #include "pseudo.h"
00014 #include "plexus2.h"
00015
00016 IRCDVar myIrcd[] = {
00017 {"PleXusIRCd 2.0+",
00018 "+oiSR",
00019 "+oiSR",
00020 "+oiSR",
00021 "+oiSR",
00022 "+oaiSR",
00023 "+oiSR",
00024 "+oiSR",
00025 "+oiSR",
00026 "+oiSR",
00027 "+oiSR",
00028 "+oiSR",
00029 "+oiSR",
00030 "+oiSR",
00031 "+oaiSR",
00032 "+oiSR",
00033 "+oiSR",
00034 "+oiSR",
00035 "+oiSR",
00036 "+iSR",
00037 3,
00038 "-acilmnpstMNORZ",
00039 "+o",
00040 1,
00041 1,
00042 0,
00043 NULL,
00044 NULL,
00045 NULL,
00046 NULL,
00047 "+R",
00048 NULL,
00049 NULL,
00050 NULL,
00051 "-R",
00052 "-R",
00053 1,
00054 1,
00055 0,
00056 1,
00057 3,
00058 0,
00059 0,
00060 1,
00061 0,
00062 0,
00063 0,
00064 0,
00065 1,
00066 0,
00067 0,
00068 0,
00069 0,
00070 0,
00071 0,
00072 0,
00073 0,
00074 1,
00075 0,
00076 0,
00077 1,
00078 1,
00079 0,
00080 CMODE_p,
00081 0,
00082 DEFAULT_MLOCK,
00083 UMODE_h,
00084 0,
00085 0,
00086 0,
00087 0,
00088 0,
00089 0,
00090 NULL,
00091 0,
00092 1,
00093 0,
00094 1,
00095 0,
00096 0,
00097 0,
00098 0,
00099 0,
00100 "h",
00101 0,
00102 0,
00103 0,
00104 NULL,
00105 1,
00106 }
00107 ,
00108 {NULL}
00109 };
00110
00111 IRCDCAPAB myIrcdcap[] = {
00112 {
00113 0,
00114 0,
00115 0,
00116 0,
00117 0,
00118 CAPAB_ZIP,
00119 0,
00120 CAPAB_TS5,
00121 0,
00122 0,
00123 0,
00124 0,
00125 CAPAB_QS,
00126 CAPAB_UID,
00127 CAPAB_KNOCK,
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, 0, 0}
00142 };
00143
00144
00145
00146 void
00147 plexus_set_umode (User * user, int ac, char **av)
00148 {
00149 int add = 1;
00150 char *modes = av[0];
00151
00152 ac--;
00153
00154 if (debug)
00155 alog ("debug: Changing mode for %s to %s", user->nick, modes);
00156
00157 while (*modes)
00158 {
00159
00160
00161
00162
00163 if (add)
00164 user->mode |= umodes[(int) *modes];
00165 else
00166 user->mode &= ~umodes[(int) *modes];
00167
00168 switch (*modes++)
00169 {
00170 case '+':
00171 add = 1;
00172 break;
00173 case '-':
00174 add = 0;
00175 break;
00176 case 'h':
00177 update_host (user);
00178 break;
00179 case 'o':
00180 if (add)
00181 {
00182 opcnt++;
00183
00184 if (WallOper)
00185 anope_cmd_global (s_OperServ,
00186 "\2%s\2 is now an IRC operator.",
00187 user->nick);
00188 display_news (user, NEWS_OPER);
00189
00190 }
00191 else
00192 {
00193 opcnt--;
00194 }
00195 break;
00196 case 'R':
00197 if (add && !nick_identified (user))
00198 {
00199 common_svsmode (user, "-R", NULL);
00200 user->mode &= ~UMODE_R;
00201 }
00202 break;
00203
00204 }
00205 }
00206 }
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216 int
00217 plexus_check_valid_halfop (User * user, Channel * chan, int servermode)
00218 {
00219 if (!chan || !chan->ci)
00220 return 1;
00221
00222
00223 if (chan->ci->flags & CI_VERBOTEN)
00224 return 0;
00225
00226 if (servermode && !check_access (user, chan->ci, CA_AUTOHALFOP))
00227 {
00228 notice_lang (s_ChanServ, user, CHAN_IS_REGISTERED, s_ChanServ);
00229 anope_cmd_mode (whosends (chan->ci), chan->name, "-h %s", user->nick);
00230 return 0;
00231 }
00232
00233 if (check_access (user, chan->ci, CA_AUTODEOP))
00234 {
00235 anope_cmd_mode (whosends (chan->ci), chan->name, "-h %s", user->nick);
00236 return 0;
00237 }
00238
00239 return 1;
00240 }
00241
00242 int
00243 plexus_check_valid_op (User * user, Channel * chan, int servermode)
00244 {
00245 if (!chan || !chan->ci)
00246 return 1;
00247
00248
00249 if (chan->ci->flags & CI_VERBOTEN)
00250 return 0;
00251
00252 if (servermode && !check_access (user, chan->ci, CA_AUTOOP))
00253 {
00254 notice_lang (s_ChanServ, user, CHAN_IS_REGISTERED, s_ChanServ);
00255 if (check_access (user, chan->ci, CA_AUTOHALFOP))
00256 {
00257 anope_cmd_mode (whosends (chan->ci), chan->name,
00258 "-o+h %s %s", user->nick, user->nick);
00259 }
00260 else
00261 {
00262 anope_cmd_mode (whosends (chan->ci), chan->name, "-o %s",
00263 user->nick);
00264 }
00265 return 0;
00266 }
00267
00268 if (check_access (user, chan->ci, CA_AUTODEOP))
00269 {
00270 anope_cmd_mode (whosends (chan->ci), chan->name, "-o %s", user->nick);
00271 return 0;
00272 }
00273
00274 return 1;
00275 }
00276
00277 unsigned long umodes[128] = {
00278 0, 0, 0,
00279 0, 0, 0,
00280 0, 0, 0,
00281 0, 0, 0,
00282 0, 0, 0,
00283 0, 0, 0,
00284 0, 0, 0,
00285 0, 0, 0,
00286 0, 0, 0,
00287 0, 0, 0,
00288 0, 0, 0,
00289 0, 0, 0,
00290 0, 0, 0,
00291 0, 0, 0,
00292 0, 0, 0,
00293 0, 0, 0,
00294 0, 0,
00295 0, 0,
00296 0, 0,
00297 0, 0,
00298 0, 0,
00299 0, 0,
00300 0, 0, 0,
00301 0, 0,
00302 0, 0, 0,
00303 0, 0, 0,
00304 0, 0, 0,
00305 0, 0, 0,
00306 0, 0, 0,
00307 0, 0, UMODE_R,
00308 UMODE_S, 0, 0,
00309 0, 0, 0,
00310 0,
00311 0,
00312 0, 0, 0,
00313 0, 0, 0,
00314 UMODE_a, UMODE_b, 0,
00315 UMODE_d, 0, 0,
00316 0, UMODE_h, UMODE_i,
00317 0, 0, UMODE_l,
00318 UMODE_g, UMODE_n, UMODE_o,
00319 0, 0, 0,
00320 0, 0, UMODE_u,
00321 0, UMODE_w, UMODE_x,
00322 0,
00323 0,
00324 0, 0, 0,
00325 0, 0
00326 };
00327
00328
00329 char myCsmodes[128] = {
00330 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00331 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00332
00333 0,
00334 0,
00335 0, 0, 0,
00336 'h',
00337 0, 0, 0, 0,
00338 0,
00339
00340 'v', 0, 0, 0, 0,
00341 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00342
00343 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00344 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00345
00346 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00347 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
00348 };
00349
00350 CMMode myCmmodes[128] = {
00351 {NULL}, {NULL}, {NULL},
00352 {NULL}, {NULL}, {NULL},
00353 {NULL}, {NULL}, {NULL},
00354 {NULL}, {NULL}, {NULL},
00355 {NULL}, {NULL}, {NULL},
00356 {NULL}, {NULL}, {NULL},
00357 {NULL}, {NULL}, {NULL},
00358 {NULL}, {NULL}, {NULL},
00359 {NULL}, {NULL}, {NULL},
00360 {NULL}, {NULL}, {NULL},
00361 {NULL}, {NULL}, {NULL},
00362 {NULL}, {NULL}, {NULL},
00363 {NULL}, {NULL}, {NULL},
00364 {NULL}, {NULL}, {NULL},
00365 {NULL}, {NULL}, {NULL},
00366 {NULL}, {NULL}, {NULL},
00367 {NULL}, {NULL}, {NULL},
00368 {NULL}, {NULL}, {NULL},
00369 {NULL}, {NULL}, {NULL},
00370 {NULL}, {NULL}, {NULL},
00371 {NULL}, {NULL}, {NULL},
00372 {NULL}, {NULL}, {NULL},
00373 {NULL}, {NULL}, {NULL},
00374 {NULL}, {NULL}, {NULL},
00375 {NULL},
00376 {add_invite, del_invite},
00377 {NULL},
00378 {NULL}, {NULL}, {NULL},
00379 {NULL}, {NULL}, {NULL},
00380 {NULL}, {NULL}, {NULL},
00381 {NULL}, {NULL}, {NULL},
00382 {NULL}, {NULL}, {NULL},
00383 {NULL},
00384 {NULL}, {NULL},
00385 {NULL}, {NULL}, {NULL},
00386 {NULL},
00387 {NULL},
00388 {add_ban, del_ban},
00389 {NULL},
00390 {NULL},
00391 {add_exception, del_exception},
00392 {NULL},
00393 {NULL},
00394 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00395 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00396 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}
00397 };
00398
00399
00400 CBMode myCbmodes[128] = {
00401 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00402 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00403 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00404 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00405 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00406 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00407 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00408 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00409 {0},
00410 {0},
00411 {0},
00412 {0},
00413 {0},
00414 {0},
00415 {0},
00416 {0},
00417 {0},
00418 {0},
00419 {0},
00420 {0},
00421 {0},
00422 {CMODE_M, 0, NULL, NULL},
00423 {CMODE_N, 0, NULL, NULL},
00424 {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL},
00425 {0},
00426 {0},
00427 {CMODE_R, 0, NULL, NULL},
00428 {0},
00429 {0},
00430 {0},
00431 {0},
00432 {0},
00433 {0},
00434 {0},
00435 {CMODE_Z, 0, NULL, NULL},
00436 {0}, {0}, {0}, {0}, {0}, {0},
00437 {CMODE_a, 0, NULL, NULL},
00438 {0},
00439 {CMODE_c, 0, NULL, NULL},
00440 {0},
00441 {0},
00442 {0},
00443 {0},
00444 {0},
00445 {CMODE_i, 0, NULL, NULL},
00446 {0},
00447 {CMODE_k, 0, chan_set_key, cs_set_key},
00448 {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit},
00449 {CMODE_m, 0, NULL, NULL},
00450 {CMODE_n, 0, NULL, NULL},
00451 {0},
00452 {CMODE_p, 0, NULL, NULL},
00453 {0},
00454 {0},
00455 {CMODE_s, 0, NULL, NULL},
00456 {CMODE_t, 0, NULL, NULL},
00457 {0},
00458 {0},
00459 {0},
00460 {0},
00461 {0},
00462 {0},
00463 {0}, {0}, {0}, {0}
00464 };
00465
00466 CBModeInfo myCbmodeinfos[] = {
00467 {'a', CMODE_a, 0, NULL, NULL},
00468 {'i', CMODE_i, 0, NULL, NULL},
00469 {'k', CMODE_k, 0, get_key, cs_get_key},
00470 {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit},
00471 {'m', CMODE_m, 0, NULL, NULL},
00472 {'n', CMODE_n, 0, NULL, NULL},
00473 {'p', CMODE_p, 0, NULL, NULL},
00474 {'s', CMODE_s, 0, NULL, NULL},
00475 {'t', CMODE_t, 0, NULL, NULL},
00476 {'M', CMODE_M, 0, NULL, NULL},
00477 {'N', CMODE_N, 0, NULL, NULL},
00478 {'O', CMODE_O, 0, NULL, NULL},
00479 {'R', CMODE_R, 0, NULL, NULL},
00480 {'Z', CMODE_Z, 0, NULL, NULL},
00481 {0}
00482 };
00483
00484
00485 CUMode myCumodes[128] = {
00486 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00487 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00488 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00489 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00490
00491 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00492 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00493 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00494 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00495
00496 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00497 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00498 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00499 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00500
00501 {0},
00502
00503 {0},
00504 {0},
00505 {0},
00506 {0},
00507 {0},
00508 {0},
00509 {0},
00510 {CUS_HALFOP, 0, plexus_check_valid_halfop},
00511 {0},
00512 {0},
00513 {0},
00514 {0},
00515 {0},
00516 {0},
00517 {CUS_OP, CUF_PROTECT_BOTSERV, plexus_check_valid_op},
00518 {0},
00519 {0},
00520 {0},
00521 {0},
00522 {0},
00523 {0},
00524 {CUS_VOICE, 0, NULL},
00525 {0},
00526 {0},
00527 {0},
00528 {0},
00529 {0}, {0}, {0}, {0}, {0}
00530 };
00531
00532
00533
00534 void
00535 plexus_cmd_notice (char *source, char *dest, char *buf)
00536 {
00537 if (!buf)
00538 {
00539 return;
00540 }
00541
00542 if (NSDefFlags & NI_MSG)
00543 {
00544 plexus_cmd_privmsg2 (source, dest, buf);
00545 }
00546 else
00547 {
00548 send_cmd (source, "NOTICE %s :%s", dest, buf);
00549 }
00550 }
00551
00552 void
00553 plexus_cmd_notice2 (char *source, char *dest, char *msg)
00554 {
00555 send_cmd (source, "NOTICE %s :%s", dest, msg);
00556 }
00557
00558 void
00559 plexus_cmd_privmsg (char *source, char *dest, char *buf)
00560 {
00561 if (!buf)
00562 {
00563 return;
00564 }
00565
00566 send_cmd (source, "PRIVMSG %s :%s", dest, buf);
00567 }
00568
00569 void
00570 plexus_cmd_privmsg2 (char *source, char *dest, char *msg)
00571 {
00572 send_cmd (source, "PRIVMSG %s :%s", dest, msg);
00573 }
00574
00575 void
00576 plexus_cmd_serv_notice (char *source, char *dest, char *msg)
00577 {
00578 send_cmd (source, "NOTICE $$%s :%s", dest, msg);
00579 }
00580
00581 void
00582 plexus_cmd_serv_privmsg (char *source, char *dest, char *msg)
00583 {
00584 send_cmd (source, "PRIVMSG $$%s :%s", dest, msg);
00585 }
00586
00587
00588 void
00589 plexus_cmd_global (char *source, char *buf)
00590 {
00591 if (!buf)
00592 {
00593 return;
00594 }
00595
00596 send_cmd (source ? source : ServerName, "OPERWALL :%s", buf);
00597 }
00598
00599
00600 void
00601 plexus_cmd_global_legacy (char *source, char *fmt)
00602 {
00603 send_cmd (source ? source : ServerName, "OPERWALL :%s", fmt);
00604 }
00605
00606 int
00607 anope_event_sjoin (char *source, int ac, char **av)
00608 {
00609 do_sjoin (source, ac, av);
00610 return MOD_CONT;
00611 }
00612
00613 int
00614 anope_event_nick (char *source, int ac, char **av)
00615 {
00616 if (ac != 2)
00617 {
00618 User *user = do_nick (source, av[0], av[4], av[5], av[7], av[9],
00619 strtoul (av[2], NULL, 10),
00620 strtoul (av[8], NULL, 0), 0, av[6], NULL);
00621 if (user)
00622 anope_set_umode (user, 1, &av[3]);
00623 }
00624 else
00625 {
00626 do_nick (source, av[0], NULL, NULL, NULL, NULL,
00627 strtoul (av[1], NULL, 10), 0, 0, NULL, NULL);
00628 }
00629 return MOD_CONT;
00630 }
00631
00632 int
00633 anope_event_topic (char *source, int ac, char **av)
00634 {
00635 if (ac == 4)
00636 {
00637 do_topic (source, ac, av);
00638 }
00639 else
00640 {
00641 Channel *c = findchan (av[0]);
00642 time_t topic_time = time (NULL);
00643
00644 if (!c)
00645 {
00646 if (debug)
00647 {
00648 alog ("debug: TOPIC %s for nonexistent channel %s",
00649 merge_args (ac - 1, av + 1), av[0]);
00650 }
00651 return MOD_CONT;
00652 }
00653
00654 if (check_topiclock (c, topic_time))
00655 return MOD_CONT;
00656
00657 if (c->topic)
00658 {
00659 free (c->topic);
00660 c->topic = NULL;
00661 }
00662 if (ac > 1 && *av[1])
00663 c->topic = sstrdup (av[1]);
00664
00665 strscpy (c->topic_setter, source, sizeof (c->topic_setter));
00666 c->topic_time = topic_time;
00667
00668 record_topic (av[0]);
00669
00670 if (ac > 1 && *av[1])
00671 send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[1]);
00672 else
00673 send_event(EVENT_TOPIC_UPDATED, 2, av[0], "");
00674
00675 }
00676 return MOD_CONT;
00677 }
00678
00679 int
00680 anope_event_tburst (char *source, int ac, char **av)
00681 {
00682 if (ac != 5)
00683 return MOD_CONT;
00684
00685 av[0] = av[1];
00686 av[1] = av[3];
00687 av[3] = av[4];
00688 do_topic (source, 4, av);
00689 return MOD_CONT;
00690 }
00691
00692 int
00693 anope_event_436 (char *source, int ac, char **av)
00694 {
00695 if (ac < 1)
00696 return MOD_CONT;
00697
00698 m_nickcoll (av[0]);
00699 return MOD_CONT;
00700 }
00701
00702
00703 void
00704 moduleAddIRCDMsgs (void)
00705 {
00706 Message *m;
00707
00708 updateProtectDetails ("PROTECT", "PROTECTME", "protect", "deprotect",
00709 "AUTOPROTECT", "+", "-");
00710
00711 m = createMessage ("401", anope_event_null);
00712 addCoreMessage (IRCD, m);
00713 m = createMessage ("402", anope_event_null);
00714 addCoreMessage (IRCD, m);
00715 m = createMessage ("436", anope_event_436);
00716 addCoreMessage (IRCD, m);
00717 m = createMessage ("AWAY", anope_event_away);
00718 addCoreMessage (IRCD, m);
00719 m = createMessage ("INVITE", anope_event_invite);
00720 addCoreMessage (IRCD, m);
00721 m = createMessage ("JOIN", anope_event_join);
00722 addCoreMessage (IRCD, m);
00723 m = createMessage ("KICK", anope_event_kick);
00724 addCoreMessage (IRCD, m);
00725 m = createMessage ("KILL", anope_event_kill);
00726 addCoreMessage (IRCD, m);
00727 m = createMessage ("MODE", anope_event_mode);
00728 addCoreMessage (IRCD, m);
00729 m = createMessage ("MOTD", anope_event_motd);
00730 addCoreMessage (IRCD, m);
00731 m = createMessage ("NICK", anope_event_nick);
00732 addCoreMessage (IRCD, m);
00733 m = createMessage ("NOTICE", anope_event_notice);
00734 addCoreMessage (IRCD, m);
00735 m = createMessage ("PART", anope_event_part);
00736 addCoreMessage (IRCD, m);
00737 m = createMessage ("PASS", anope_event_pass);
00738 addCoreMessage (IRCD, m);
00739 m = createMessage ("PING", anope_event_ping);
00740 addCoreMessage (IRCD, m);
00741 m = createMessage ("PRIVMSG", anope_event_privmsg);
00742 addCoreMessage (IRCD, m);
00743 m = createMessage ("QUIT", anope_event_quit);
00744 addCoreMessage (IRCD, m);
00745 m = createMessage ("SERVER", anope_event_server);
00746 addCoreMessage (IRCD, m);
00747 m = createMessage ("SQUIT", anope_event_squit);
00748 addCoreMessage (IRCD, m);
00749 m = createMessage ("TOPIC", anope_event_topic);
00750 addCoreMessage (IRCD, m);
00751 m = createMessage ("TBURST", anope_event_tburst);
00752 addCoreMessage (IRCD, m);
00753 m = createMessage ("USER", anope_event_null);
00754 addCoreMessage (IRCD, m);
00755 m = createMessage ("WALLOPS", anope_event_null);
00756 addCoreMessage (IRCD, m);
00757 m = createMessage ("WHOIS", anope_event_whois);
00758 addCoreMessage (IRCD, m);
00759 m = createMessage ("SVSMODE", anope_event_mode);
00760 addCoreMessage (IRCD, m);
00761 m = createMessage ("SVSNICK", anope_event_null);
00762 addCoreMessage (IRCD, m);
00763 m = createMessage ("CAPAB", anope_event_capab);
00764 addCoreMessage (IRCD, m);
00765 m = createMessage ("SJOIN", anope_event_sjoin);
00766 addCoreMessage (IRCD, m);
00767 m = createMessage ("SVINFO", anope_event_svinfo);
00768 addCoreMessage (IRCD, m);
00769 m = createMessage ("EOB", anope_event_eob);
00770 addCoreMessage (IRCD, m);
00771 m = createMessage ("ADMIN", anope_event_admin);
00772 addCoreMessage (IRCD, m);
00773 m = createMessage ("ERROR", anope_event_error);
00774 addCoreMessage (IRCD, m);
00775 m = createMessage ("SETHOST", anope_event_sethost);
00776 addCoreMessage (IRCD, m);
00777 }
00778
00779 void
00780 plexus_cmd_sqline (char *mask, char *reason)
00781 {
00782 send_cmd (s_OperServ, "RESV * %s :%s", mask, reason);
00783 }
00784
00785 void
00786 plexus_cmd_unsgline (char *mask)
00787 {
00788 send_cmd (s_OperServ, "UNXLINE * %s", mask);
00789 }
00790
00791 void
00792 plexus_cmd_unszline (char *mask)
00793 {
00794
00795 }
00796
00797 void
00798 plexus_cmd_szline (char *mask, char *reason, char *whom)
00799 {
00800
00801 }
00802
00803 void
00804 plexus_cmd_svsnoop (char *server, int set)
00805 {
00806
00807 }
00808
00809 void
00810 plexus_cmd_svsadmin (char *server, int set)
00811 {
00812 plexus_cmd_svsnoop (server, set);
00813 }
00814
00815 void
00816 plexus_cmd_sgline (char *mask, char *reason)
00817 {
00818 send_cmd (s_OperServ, "XLINE * %s :%s", mask, reason);
00819 }
00820
00821 void
00822 plexus_cmd_remove_akill (char *user, char *host)
00823 {
00824 send_cmd (s_OperServ, "UNKLINE * %s %s", user, host);
00825 }
00826
00827 void
00828 plexus_cmd_topic (char *whosets, char *chan, char *whosetit,
00829 char *topic, time_t when)
00830 {
00831 send_cmd (whosets, "SVSTOPIC %s %s %lu :%s", chan, whosetit,
00832 (unsigned long int) when, topic);
00833 }
00834
00835 void
00836 plexus_cmd_vhost_off (User * u)
00837 {
00838 send_cmd (ServerName, "SVSMODE %s -h", u->nick);
00839 }
00840
00841 void
00842 plexus_cmd_vhost_on (char *nick, char *vIdent, char *vhost)
00843 {
00844 User *u;
00845
00846 if (!nick)
00847 {
00848 return;
00849 }
00850
00851 u = finduser (nick);
00852
00853 if (u)
00854 {
00855 send_cmd (ServerName, "SVSHOST %s %s", nick, vhost);
00856 u->mode |= UMODE_h;
00857 }
00858 }
00859
00860 void
00861 plexus_cmd_unsqline (char *user)
00862 {
00863 send_cmd (s_OperServ, "UNRESV * %s", user);
00864 }
00865
00866 void
00867 plexus_cmd_join (char *user, char *channel, time_t chantime)
00868 {
00869 send_cmd (ServerName, "SJOIN %ld %s + :%s", (long int) chantime, channel,
00870 user);
00871 }
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882 void
00883 plexus_cmd_akill (char *user, char *host, char *who, time_t when,
00884 time_t expires, char *reason)
00885 {
00886 send_cmd (s_OperServ, "KLINE * %ld %s %s :%s",
00887 (long int) (expires - (long) time (NULL)), user, host, reason);
00888 }
00889
00890 void
00891 plexus_cmd_svskill (char *source, char *user, char *buf)
00892 {
00893 if (!buf)
00894 {
00895 return;
00896 }
00897
00898 if (!source || !user)
00899 {
00900 return;
00901 }
00902
00903 send_cmd (source, "KILL %s :%s", user, buf);
00904 }
00905
00906 void
00907 plexus_cmd_svsmode (User * u, int ac, char **av)
00908 {
00909 send_cmd (ServerName, "SVSMODE %s %s", u->nick, av[0]);
00910
00911 if ((ac == 2) && isdigit (*av[1]))
00912 send_cmd (ServerName, "SVSID %s %s", u->nick, av[1]);
00913 }
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923 void
00924 plexus_cmd_svinfo ()
00925 {
00926 send_cmd (NULL, "SVINFO 5 5 0 :%ld", (long int) time (NULL));
00927 }
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950 void
00951 plexus_cmd_capab ()
00952 {
00953 send_cmd (NULL,
00954 "CAPAB :QS EX CHW IE EOB KLN GLN HOPS HUB KNOCK TBURST PARA");
00955 }
00956
00957
00958 void
00959 plexus_cmd_pass (char *pass)
00960 {
00961 send_cmd (NULL, "PASS %s :TS", pass);
00962 }
00963
00964
00965 void
00966 plexus_cmd_server (char *servname, int hop, char *descript)
00967 {
00968 send_cmd (NULL, "SERVER %s %d :%s", servname, hop, descript);
00969 }
00970
00971 void
00972 plexus_cmd_connect (int servernum)
00973 {
00974 me_server = new_server (NULL, ServerName, ServerDesc, SERVER_ISME, NULL);
00975
00976 if (servernum == 1)
00977 plexus_cmd_pass (RemotePassword);
00978 else if (servernum == 2)
00979 plexus_cmd_pass (RemotePassword2);
00980 else if (servernum == 3)
00981 plexus_cmd_pass (RemotePassword3);
00982
00983 plexus_cmd_capab ();
00984 plexus_cmd_server (ServerName, 1, ServerDesc);
00985 plexus_cmd_svinfo ();
00986 }
00987
00988 void
00989 plexus_cmd_svsinfo ()
00990 {
00991
00992 }
00993
00994
00995
00996 void
00997 plexus_cmd_bot_nick (char *nick, char *user, char *host, char *real,
00998 char *modes)
00999 {
01000 EnforceQlinedNick (nick, NULL);
01001 send_cmd (ServerName, "NICK %s 1 %ld %s %s %s %s %s 0 :%s", nick,
01002 (long int) time (NULL), modes, user, host, "*", ServerName, real);
01003 plexus_cmd_sqline (nick, "Reserved for services");
01004
01005 }
01006
01007 void
01008 plexus_cmd_part (char *nick, char *chan, char *buf)
01009 {
01010 if (buf)
01011 {
01012 send_cmd (nick, "PART %s :%s", chan, buf);
01013 }
01014 else
01015 {
01016 send_cmd (nick, "PART %s", chan);
01017 }
01018 }
01019
01020 int
01021 anope_event_sethost (char *source, int ac, char **av)
01022 {
01023 User *u;
01024
01025 if (ac != 2)
01026 return MOD_CONT;
01027
01028 u = finduser (av[0]);
01029 if (!u)
01030 {
01031 if (debug)
01032 {
01033 alog ("debug: SETHOST for nonexistent user %s", source);
01034 }
01035 return MOD_CONT;
01036 }
01037
01038 change_user_host (u, av[1]);
01039 return MOD_CONT;
01040 }
01041
01042 int
01043 anope_event_ping (char *source, int ac, char **av)
01044 {
01045 if (ac < 1)
01046 return MOD_CONT;
01047 plexus_cmd_pong (ac > 1 ? av[1] : ServerName, av[0]);
01048 return MOD_CONT;
01049 }
01050
01051 int
01052 anope_event_away (char *source, int ac, char **av)
01053 {
01054 if (!source)
01055 {
01056 return MOD_CONT;
01057 }
01058 m_away (source, (ac ? av[0] : NULL));
01059 return MOD_CONT;
01060 }
01061
01062 int
01063 anope_event_kill (char *source, int ac, char **av)
01064 {
01065 if (ac != 2)
01066 return MOD_CONT;
01067
01068 m_kill (av[0], av[1]);
01069 return MOD_CONT;
01070 }
01071
01072 int
01073 anope_event_kick (char *source, int ac, char **av)
01074 {
01075 if (ac != 3)
01076 return MOD_CONT;
01077 do_kick (source, ac, av);
01078 return MOD_CONT;
01079 }
01080
01081 int
01082 anope_event_eob (char *source, int ac, char **av)
01083 {
01084 Server *s;
01085 s = findserver (servlist, source);
01086
01087
01088
01089
01090 if (!s && serv_uplink)
01091 s = serv_uplink;
01092 finish_sync (s, 1);
01093
01094 return MOD_CONT;
01095 }
01096
01097 void
01098 plexus_cmd_eob ()
01099 {
01100 send_cmd (ServerName, "EOB");
01101 }
01102
01103
01104 int
01105 anope_event_join (char *source, int ac, char **av)
01106 {
01107 if (ac != 1)
01108 return MOD_CONT;
01109 do_join (source, ac, av);
01110 return MOD_CONT;
01111 }
01112
01113 int
01114 anope_event_motd (char *source, int ac, char **av)
01115 {
01116 if (!source)
01117 {
01118 return MOD_CONT;
01119 }
01120
01121 m_motd (source);
01122 return MOD_CONT;
01123 }
01124
01125 int
01126 anope_event_privmsg (char *source, int ac, char **av)
01127 {
01128 if (ac != 2)
01129 return MOD_CONT;
01130 m_privmsg (source, av[0], av[1]);
01131 return MOD_CONT;
01132 }
01133
01134 int
01135 anope_event_part (char *source, int ac, char **av)
01136 {
01137 if (ac < 1 || ac > 2)
01138 return MOD_CONT;
01139 do_part (source, ac, av);
01140 return MOD_CONT;
01141 }
01142
01143 int
01144 anope_event_whois (char *source, int ac, char **av)
01145 {
01146 if (source && ac >= 1)
01147 {
01148 m_whois (source, av[0]);
01149 }
01150 return MOD_CONT;
01151 }
01152
01153
01154 int
01155 anope_event_server (char *source, int ac, char **av)
01156 {
01157 if (!stricmp (av[1], "1"))
01158 {
01159 uplink = sstrdup (av[0]);
01160 }
01161 do_server (source, av[0], av[1], av[2], NULL);
01162 return MOD_CONT;
01163 }
01164
01165 int
01166 anope_event_squit (char *source, int ac, char **av)
01167 {
01168 if (ac != 2)
01169 return MOD_CONT;
01170 do_squit (source, ac, av);
01171 return MOD_CONT;
01172 }
01173
01174 int
01175 anope_event_quit (char *source, int ac, char **av)
01176 {
01177 if (ac != 1)
01178 return MOD_CONT;
01179 do_quit (source, ac, av);
01180 return MOD_CONT;
01181 }
01182
<