00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "services.h"
00018 #include "pseudo.h"
00019 #include "inspircd10.h"
00020
00021 #ifndef _WIN32
00022 #include <sys/socket.h>
00023 #include <netinet/in.h>
00024 #include <arpa/inet.h>
00025 #endif
00026
00027 #ifdef _WIN32
00028 #include "winsock.h"
00029 int inet_aton (const char *name, struct in_addr *addr)
00030 {
00031 uint32 a = inet_addr (name);
00032 addr->s_addr = a;
00033 return a != (uint32)-1;
00034 }
00035 #endif
00036
00037 IRCDVar myIrcd[] = {
00038 {"InspIRCd 1.0",
00039 "+o",
00040 "+o",
00041 "+o",
00042 "+o",
00043 "+io",
00044 "+o",
00045 "+o",
00046 "+i",
00047 "+io",
00048 "+o",
00049 "+o",
00050 "+o",
00051 "+io",
00052 "+io",
00053 "+o",
00054 "+o",
00055 "+i",
00056 "+io",
00057 "+s",
00058 5,
00059 "-cilmnpstuzACGHKNOQRSV",
00060 "+ao",
00061 1,
00062 1,
00063 1,
00064 "+q",
00065 "-q",
00066 "+a",
00067 "-a",
00068 "+r",
00069 NULL,
00070 NULL,
00071 NULL,
00072 "-r",
00073 "-r",
00074 1,
00075 1,
00076 1,
00077 1,
00078 4,
00079 0,
00080 1,
00081 0,
00082 1,
00083 0,
00084 0,
00085 0,
00086 0,
00087 0,
00088 0,
00089 1,
00090 1,
00091 1,
00092 CMODE_r,
00093 0,
00094 0,
00095 0,
00096 0,
00097 1,
00098 0,
00099 1,
00100 0,
00101 CMODE_K,
00102 0,
00103 DEFAULT_MLOCK,
00104 UMODE_x,
00105 0,
00106 1,
00107 CMODE_f,
00108 CMODE_L,
00109 0,
00110 1,
00111 NULL,
00112 0,
00113 1,
00114 0,
00115 0,
00116 0,
00117 0,
00118 0,
00119 0,
00120 0,
00121 "x",
00122 0,
00123 1,
00124 0,
00125 NULL,
00126 0,
00127 }
00128 ,
00129 {NULL}
00130 };
00131
00132
00133 IRCDCAPAB myIrcdcap[] = {
00134 {
00135 CAPAB_NOQUIT,
00136 0,
00137 0,
00138 0,
00139 0,
00140 0,
00141 0,
00142 0,
00143 0,
00144 0,
00145 0,
00146 0,
00147 0,
00148 0,
00149 0,
00150 0,
00151 0,
00152 0,
00153 0,
00154 0,
00155 0,
00156 CAPAB_SSJ3,
00157 CAPAB_NICK2,
00158 0,
00159 CAPAB_VL,
00160 CAPAB_TLKEXT,
00161 0,
00162 0,
00163 0,
00164 0, 0}
00165 };
00166
00167 unsigned long umodes[128] = {
00168 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00169 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00170 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00171 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00172 0, UMODE_A, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00173 0,
00174 0,
00175 0,
00176 0, 0, 0, 0, 0, 0, 0,
00177 0,
00178 0, 0, 0, 0, 0,
00179 0, UMODE_a, 0, 0, 0, 0, 0,
00180 UMODE_g,
00181 UMODE_h, UMODE_i, 0, 0, 0, 0, 0, UMODE_o,
00182 0,
00183 0, UMODE_r, 0, 0, 0, 0, UMODE_w,
00184 UMODE_x,
00185 0,
00186 0,
00187 0, 0, 0, 0, 0
00188 };
00189
00190
00191 char myCsmodes[128] = {
00192 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00193 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00194
00195 0,
00196 0,
00197 0, 0, 0,
00198 'h',
00199 0,
00200 0, 0, 0,
00201 'q',
00202
00203 'v', 0, 0, 0, 0,
00204 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00205
00206 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00207 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00208
00209 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00210 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'a', 0
00211 };
00212
00213 CMMode myCmmodes[128] = {
00214 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00215 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00216 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00217 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00218 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00219 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00220 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00221 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00222 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00223 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00224 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00225 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00226 {NULL},
00227 {NULL},
00228 {add_ban, del_ban},
00229 {NULL},
00230 {NULL},
00231 {NULL, NULL},
00232 {NULL},
00233 {NULL},
00234 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00235 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00236 {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}
00237 };
00238
00239
00240
00241 CBMode myCbmodes[128] = {
00242 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00243 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00244 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00245 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00246 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00247 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00248 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00249 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00250 {0},
00251 {CMODE_A, CBM_NO_USER_MLOCK, NULL, NULL},
00252 {0},
00253 {CMODE_C, 0, NULL, NULL},
00254 {0},
00255 {0},
00256 {0},
00257 {CMODE_G, 0, NULL, NULL},
00258 {CMODE_H, CBM_NO_USER_MLOCK, NULL, NULL},
00259 {0},
00260 {0},
00261 {CMODE_K, 0, NULL, NULL},
00262 {CMODE_L, 0, set_redirect, cs_set_redirect},
00263 {0},
00264 {CMODE_N, 0, NULL, NULL},
00265 {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL},
00266 {0},
00267 {CMODE_Q, 0, NULL, NULL},
00268 {CMODE_R, 0, NULL, NULL},
00269 {CMODE_S, 0, NULL, NULL},
00270 {0},
00271 {0},
00272 {CMODE_V, 0, NULL, NULL},
00273 {0},
00274 {0},
00275 {0},
00276 {0},
00277 {0}, {0}, {0}, {0}, {0}, {0},
00278 {0},
00279 {0},
00280 {CMODE_c, 0, NULL, NULL},
00281 {0},
00282 {0},
00283 {CMODE_f, 0, set_flood, cs_set_flood},
00284 {0},
00285 {0},
00286 {CMODE_i, 0, NULL, NULL},
00287 {0},
00288 {CMODE_k, 0, chan_set_key, cs_set_key},
00289 {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit},
00290 {CMODE_m, 0, NULL, NULL},
00291 {CMODE_n, 0, NULL, NULL},
00292 {0},
00293 {CMODE_p, 0, NULL, NULL},
00294 {0},
00295 {CMODE_r, CBM_NO_MLOCK, NULL, NULL},
00296 {CMODE_s, 0, NULL, NULL},
00297 {CMODE_t, 0, NULL, NULL},
00298 {CMODE_u, 0, NULL, NULL},
00299 {0},
00300 {0},
00301 {0},
00302 {0},
00303 {CMODE_z, 0, NULL, NULL},
00304 {0}, {0}, {0}, {0}
00305 };
00306
00307 CBModeInfo myCbmodeinfos[] = {
00308 {'c', CMODE_c, 0, NULL, NULL},
00309 {'f', CMODE_f, 0, get_flood, cs_get_flood},
00310 {'i', CMODE_i, 0, NULL, NULL},
00311 {'k', CMODE_k, 0, get_key, cs_get_key},
00312 {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit},
00313 {'m', CMODE_m, 0, NULL, NULL},
00314 {'n', CMODE_n, 0, NULL, NULL},
00315 {'p', CMODE_p, 0, NULL, NULL},
00316 {'r', CMODE_r, 0, NULL, NULL},
00317 {'s', CMODE_s, 0, NULL, NULL},
00318 {'t', CMODE_t, 0, NULL, NULL},
00319 {'u', CMODE_u, 0, NULL, NULL},
00320 {'z', CMODE_z, 0, NULL, NULL},
00321 {'A', CMODE_A, 0, NULL, NULL},
00322 {'C', CMODE_C, 0, NULL, NULL},
00323 {'G', CMODE_G, 0, NULL, NULL},
00324 {'H', CMODE_H, 0, NULL, NULL},
00325 {'K', CMODE_K, 0, NULL, NULL},
00326 {'L', CMODE_L, 0, get_redirect, cs_get_redirect},
00327 {'N', CMODE_N, 0, NULL, NULL},
00328 {'O', CMODE_O, 0, NULL, NULL},
00329 {'Q', CMODE_Q, 0, NULL, NULL},
00330 {'R', CMODE_R, 0, NULL, NULL},
00331 {'S', CMODE_S, 0, NULL, NULL},
00332 {'V', CMODE_V, 0, NULL, NULL},
00333 {0}
00334 };
00335
00336 CUMode myCumodes[128] = {
00337 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00338 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00339 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00340 {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00341
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
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}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00351
00352 {0},
00353
00354 {CUS_PROTECT, CUF_PROTECT_BOTSERV, check_valid_op},
00355 {0},
00356 {0},
00357 {0},
00358 {0},
00359 {0},
00360 {0},
00361 {CUS_HALFOP, 0, check_valid_op},
00362 {0},
00363 {0},
00364 {0},
00365 {0},
00366 {0},
00367 {0},
00368 {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op},
00369 {0},
00370 {CUS_OWNER, 0, check_valid_op},
00371 {0},
00372 {0},
00373 {0},
00374 {0},
00375 {CUS_VOICE, 0, NULL},
00376 {0},
00377 {0},
00378 {0},
00379 {0},
00380 {0}, {0}, {0}, {0}, {0}
00381 };
00382
00383
00384 void inspircd_set_umode(User * user, int ac, char **av)
00385 {
00386 int add = 1;
00387 char *modes = av[0];
00388
00389 ac--;
00390
00391 if (debug)
00392 alog("debug: Changing mode for %s to %s", user->nick, modes);
00393
00394 while (*modes) {
00395
00396
00397
00398
00399 if (add)
00400 user->mode |= umodes[(int) *modes];
00401 else
00402 user->mode &= ~umodes[(int) *modes];
00403
00404 switch (*modes++) {
00405 case '+':
00406 add = 1;
00407 break;
00408 case '-':
00409 add = 0;
00410 break;
00411 case 'd':
00412 if (ac == 0) {
00413 break;
00414 }
00415
00416 ac--;
00417 av++;
00418 user->svid = strtoul(*av, NULL, 0);
00419 break;
00420 case 'o':
00421 if (add) {
00422 opcnt++;
00423 if (WallOper) {
00424 anope_cmd_global(s_OperServ,
00425 "\2%s\2 is now an IRC operator.",
00426 user->nick);
00427 }
00428 display_news(user, NEWS_OPER);
00429 } else {
00430 opcnt--;
00431 }
00432 break;
00433 case 'r':
00434 if (add && !nick_identified(user)) {
00435 common_svsmode(user, "-r", NULL);
00436 user->mode &= ~UMODE_r;
00437 }
00438 break;
00439 case 'x':
00440 update_host(user);
00441 break;
00442 }
00443 }
00444 }
00445
00446
00447
00448 void moduleAddIRCDMsgs(void) {
00449 Message *m;
00450
00451 updateProtectDetails("PROTECT","PROTECTME","!protect","!deprotect","AUTOPROTECT","+a","-a");
00452
00453 m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m);
00454 m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m);
00455 m = createMessage("INVITE", anope_event_null); addCoreMessage(IRCD,m);
00456 m = createMessage("JOIN", anope_event_join); addCoreMessage(IRCD,m);
00457 m = createMessage("KICK", anope_event_kick); addCoreMessage(IRCD,m);
00458 m = createMessage("KILL", anope_event_kill); addCoreMessage(IRCD,m);
00459 m = createMessage("MODE", anope_event_mode); addCoreMessage(IRCD,m);
00460 m = createMessage("MOTD", anope_event_motd); addCoreMessage(IRCD,m);
00461 m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m);
00462 m = createMessage("NOTICE", anope_event_null); addCoreMessage(IRCD,m);
00463 m = createMessage("CAPAB", anope_event_null); addCoreMessage(IRCD,m);
00464 m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m);
00465 m = createMessage("PING", anope_event_ping); addCoreMessage(IRCD,m);
00466 m = createMessage("PRIVMSG", anope_event_privmsg); addCoreMessage(IRCD,m);
00467 m = createMessage("QUIT", anope_event_quit); addCoreMessage(IRCD,m);
00468 m = createMessage("SERVER", anope_event_server); addCoreMessage(IRCD,m);
00469 m = createMessage("SQUIT", anope_event_squit); addCoreMessage(IRCD,m);
00470 m = createMessage("TOPIC", anope_event_topic); addCoreMessage(IRCD,m);
00471 m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m);
00472 m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m);
00473 m = createMessage("GLOBOPS", anope_event_null); addCoreMessage(IRCD,m);
00474 m = createMessage("SILENCE", anope_event_null); addCoreMessage(IRCD,m);
00475 m = createMessage("SAMODE", anope_event_samode); addCoreMessage(IRCD,m);
00476 m = createMessage("SANICK", anope_event_sanick); addCoreMessage(IRCD,m);
00477 m = createMessage("SAJOIN", anope_event_sajoin); addCoreMessage(IRCD,m);
00478 m = createMessage("SAPART", anope_event_sapart); addCoreMessage(IRCD,m);
00479 m = createMessage("SVSMODE", anope_event_mode) ;addCoreMessage(IRCD,m);
00480 m = createMessage("QLINE", anope_event_null); addCoreMessage(IRCD,m);
00481 m = createMessage("GLINE", anope_event_null); addCoreMessage(IRCD,m);
00482 m = createMessage("ELINE", anope_event_null); addCoreMessage(IRCD,m);
00483 m = createMessage("ZLINE", anope_event_null); addCoreMessage(IRCD,m);
00484 m = createMessage("ADDLINE", anope_event_null); addCoreMessage(IRCD,m);
00485 m = createMessage("FHOST", anope_event_chghost); addCoreMessage(IRCD,m);
00486 m = createMessage("CHGIDENT", anope_event_chgident); addCoreMessage(IRCD,m);
00487 m = createMessage("FNAME", anope_event_chgname); addCoreMessage(IRCD,m);
00488 m = createMessage("METADATA", anope_event_null); addCoreMessage(IRCD,m);
00489 m = createMessage("SETHOST", anope_event_sethost); addCoreMessage(IRCD,m);
00490 m = createMessage("SETIDENT", anope_event_setident); addCoreMessage(IRCD,m);
00491 m = createMessage("SETNAME", anope_event_setname); addCoreMessage(IRCD,m);
00492 m = createMessage("REHASH", anope_event_rehash); addCoreMessage(IRCD,m);
00493 m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m);
00494 m = createMessage("CREDITS", anope_event_credits); addCoreMessage(IRCD,m);
00495 m = createMessage("FJOIN", anope_event_fjoin); addCoreMessage(IRCD,m);
00496 m = createMessage("FMODE", anope_event_fmode); addCoreMessage(IRCD,m);
00497 m = createMessage("FTOPIC", anope_event_ftopic); addCoreMessage(IRCD,m);
00498 m = createMessage("VERSION", anope_event_version); addCoreMessage(IRCD,m);
00499 m = createMessage("OPERTYPE", anope_event_opertype); addCoreMessage(IRCD,m);
00500 m = createMessage("IDLE", anope_event_idle); addCoreMessage(IRCD,m);
00501 }
00502
00503
00504
00505 void inspircd_cmd_svsnoop(char *server, int set)
00506 {
00507
00508 }
00509
00510 void inspircd_cmd_svsadmin(char *server, int set)
00511 {
00512
00513 }
00514
00515 void inspircd_cmd_remove_akill(char *user, char *host)
00516 {
00517 send_cmd(s_OperServ, "GLINE %s@%s", user, host);
00518 }
00519
00520 void inspircd_cmd_topic(char *whosets, char *chan, char *whosetit,
00521 char *topic, time_t when)
00522 {
00523 send_cmd(whosets, "FTOPIC %s %lu %s :%s", chan, (unsigned long int) when, whosetit, topic);
00524 }
00525
00526 void inspircd_cmd_vhost_off(User * u)
00527 {
00528 send_cmd(s_HostServ, "MODE %s -x", u->nick);
00529 }
00530
00531 void inspircd_cmd_akill(char *user, char *host, char *who, time_t when,
00532 time_t expires, char *reason)
00533 {
00534 send_cmd(ServerName, "ADDLINE G %s@%s %s %ld %ld :%s", user, host, who, (long int) when, (long int) 86400 * 2, reason);
00535 }
00536
00537 void inspircd_cmd_svskill(char *source, char *user, char *buf)
00538 {
00539 if (!buf) {
00540 return;
00541 }
00542
00543 if (!source || !user) {
00544 return;
00545 }
00546
00547 send_cmd(source, "KILL %s :%s", user, buf);
00548 }
00549
00550 void inspircd_cmd_svsmode(User * u, int ac, char **av)
00551 {
00552 send_cmd(s_NickServ, "MODE %s %s%s%s", u->nick, av[0], (ac == 2 ? " " : ""), (ac == 2 ? av[1] : ""));
00553 }
00554
00555
00556 void inspircd_cmd_372(char *source, char *msg)
00557 {
00558 send_cmd(ServerName, "372 %s :- %s", source, msg);
00559 }
00560
00561 void inspircd_cmd_372_error(char *source)
00562 {
00563 send_cmd(ServerName, "422 %s :- MOTD file not found! Please "
00564 "contact your IRC administrator.", source);
00565 }
00566
00567 void inspircd_cmd_375(char *source)
00568 {
00569 send_cmd(ServerName, "375 %s :- %s Message of the Day",
00570 source, ServerName);
00571 }
00572
00573 void inspircd_cmd_376(char *source)
00574 {
00575 send_cmd(ServerName, "376 %s :End of /MOTD command.", source);
00576 }
00577
00578 void inspircd_cmd_nick(char *nick, char *name, char *modes)
00579 {
00580
00581 send_cmd(ServerName, "NICK %ld %s %s %s %s +%s 0.0.0.0 :%s",(long int) time(NULL),nick,ServiceHost,ServiceHost,ServiceUser,modes,name);
00582 send_cmd(ServerName, "OPERTYPE Service");
00583 }
00584
00585 void inspircd_cmd_guest_nick(char *nick, char *user, char *host, char *real,
00586 char *modes)
00587 {
00588 send_cmd(ServerName, "NICK %ld %s %s %s %s +%s 0.0.0.0 :%s",(long int) time(NULL),nick,host,host,user,modes,real);
00589 }
00590
00591 void inspircd_cmd_mode(char *source, char *dest, char *buf)
00592 {
00593 if (!buf) {
00594 return;
00595 }
00596 send_cmd(source ? source : s_OperServ, "MODE %s %s", dest, buf);
00597 }
00598
00599 int anope_event_version(char *source, int ac, char **av)
00600 {
00601 return MOD_CONT;
00602 }
00603
00604 int anope_event_idle(char *source, int ac, char **av)
00605 {
00606 if (ac == 1)
00607 {
00608 send_cmd(av[0],"IDLE %s %ld 0",source,(long int) time(NULL));
00609 }
00610 return MOD_CONT;
00611 }
00612
00613 int anope_event_ftopic(char *source, int ac, char **av)
00614 {
00615
00616 char* temp;
00617 if (ac < 4)
00618 return MOD_CONT;
00619 temp = av[1];
00620 av[1] = av[2];
00621 av[2] = temp;
00622 do_topic(source, ac, av);
00623 return MOD_CONT;
00624 }
00625
00626 int anope_event_opertype(char* source, int ac, char**av)
00627 {
00628
00629
00630 User* u;
00631 u = finduser(source);
00632 if (u && !is_oper(u)) {
00633 char* newav[2];
00634 newav[0] = source;
00635 newav[1] = "+o";
00636 return anope_event_mode(source, 2, newav);
00637 }
00638 else return MOD_CONT;
00639 }
00640
00641 int anope_event_fmode(char *source, int ac, char **av)
00642 {
00643
00644 if (ac != 2)
00645 return MOD_CONT;
00646 return anope_event_mode(source, ac, av);
00647 }
00648
00649 int anope_event_samode(char *source, int ac, char **av)
00650 {
00651
00652 if (ac < 2)
00653 return MOD_CONT;
00654 return anope_event_mode(source, ac, av);
00655 return MOD_CONT;
00656 }
00657
00658 int anope_event_sanick(char *source, int ac, char **av)
00659 {
00660
00661 if (ac != 2)
00662 return MOD_CONT;
00663 do_nick(av[0], av[1], NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
00664 return MOD_CONT;
00665 }
00666
00667 int anope_event_sajoin(char *source, int ac, char **av)
00668 {
00669 char* newav[1];
00670 if (ac != 2)
00671 return MOD_CONT;
00672 newav[0] = av[1];
00673 do_join(av[0], 1, newav);
00674 return MOD_CONT;
00675 }
00676
00677 int anope_event_sapart(char *source, int ac, char **av)
00678 {
00679 char* newav[1];
00680 if (ac < 2)
00681 return MOD_CONT;
00682 newav[0] = av[1];
00683 do_part(av[0], 1, newav);
00684 return MOD_CONT;
00685 }
00686
00687 int anope_event_fjoin(char *source, int ac, char **av)
00688 {
00689 char* newav[127];
00690 char people[1024];
00691 int i = 0;
00692
00693 if (ac < 3)
00694 return MOD_CONT;
00695
00696 newav[0] = av[1];
00697 newav[1] = av[0];
00698 newav[2] = "+";
00699 newav[3] = people;
00700
00701 *people = '\0';
00702
00703 for (i = 2; i < ac; i++)
00704 {
00705 if (i > 2)
00706 strncat(people," ",1023);
00707 strncat(people,av[i],1023);
00708 }
00709 do_sjoin(source, 4, newav);
00710 return MOD_CONT;
00711 }
00712
00713 void inspircd_cmd_bot_nick(char *nick, char *user, char *host, char *real,
00714 char *modes)
00715 {
00716 send_cmd(ServerName, "NICK %ld %s %s %s %s +%s 0.0.0.0 :%s",(long int) time(NULL),nick,host,host,user,modes,real);
00717 send_cmd(ServerName, "OPERTYPE Bot");
00718 }
00719
00720 void inspircd_cmd_kick(char *source, char *chan, char *user, char *buf)
00721 {
00722 if (buf) {
00723 send_cmd(source, "KICK %s %s :%s", chan, user, buf);
00724 } else {
00725 send_cmd(source, "KICK %s %s :%s", chan, user, user);
00726 }
00727 }
00728
00729 void inspircd_cmd_notice_ops(char *source, char *dest, char *buf)
00730 {
00731 if (!buf) {
00732 return;
00733 }
00734
00735 send_cmd(ServerName, "NOTICE @%s :%s", dest, buf);
00736 }
00737
00738
00739 void inspircd_cmd_notice(char *source, char *dest, char *buf)
00740 {
00741 if (!buf) {
00742 return;
00743 }
00744
00745 if (NSDefFlags & NI_MSG) {
00746 inspircd_cmd_privmsg2(source, dest, buf);
00747 } else {
00748 send_cmd(source, "NOTICE %s :%s", dest, buf);
00749 }
00750 }
00751
00752 void inspircd_cmd_notice2(char *source, char *dest, char *msg)
00753 {
00754 send_cmd(source, "NOTICE %s :%s", dest, msg);
00755 }
00756
00757 void inspircd_cmd_privmsg(char *source, char *dest, char *buf)
00758 {
00759 if (!buf) {
00760 return;
00761 }
00762
00763 send_cmd(source, "PRIVMSG %s :%s", dest, buf);
00764 }
00765
00766 void inspircd_cmd_privmsg2(char *source, char *dest, char *msg)
00767 {
00768 send_cmd(source, "PRIVMSG %s :%s", dest, msg);
00769 }
00770
00771 void inspircd_cmd_serv_notice(char *source, char *dest, char *msg)
00772 {
00773 send_cmd(source, "NOTICE $%s :%s", dest, msg);
00774 }
00775
00776 void inspircd_cmd_serv_privmsg(char *source, char *dest, char *msg)
00777 {
00778 send_cmd(source, "PRIVMSG $%s :%s", dest, msg);
00779 }
00780
00781
00782 void inspircd_cmd_bot_chan_mode(char *nick, char *chan)
00783 {
00784 anope_cmd_mode(nick, chan, "%s %s %s", ircd->botchanumode, nick, nick);
00785 }
00786
00787 void inspircd_cmd_351(char *source)
00788 {
00789 send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s",
00790 source, version_number, ServerName, ircd->name, version_flags,
00791 EncModule, version_build);
00792 }
00793
00794
00795 void inspircd_cmd_quit(char *source, char *buf)
00796 {
00797 if (buf) {
00798 send_cmd(source, "QUIT :%s", buf);
00799 } else {
00800 send_cmd(source, "QUIT :Exiting");
00801 }
00802 }
00803
00804
00805 void inspircd_cmd_protoctl()
00806 {
00807 }
00808
00809 static char currentpass[1024];
00810
00811
00812 void inspircd_cmd_pass(char *pass)
00813 {
00814 strncpy(currentpass,pass,1024);
00815 }
00816
00817
00818 void inspircd_cmd_server(char *servname, int hop, char *descript)
00819 {
00820 send_cmd(ServerName, "SERVER %s %s %d :%s", servname, currentpass, hop, descript);
00821 }
00822
00823
00824 void inspircd_cmd_pong(char *servname, char *who)
00825 {
00826 send_cmd(servname, "PONG %s", who);
00827 }
00828
00829
00830
00831
00832 void inspircd_cmd_join(char *user, char *channel, time_t chantime)
00833 {
00834 send_cmd(user, "JOIN %s", channel);
00835 }
00836
00837
00838 void inspircd_cmd_unsqline(char *user)
00839 {
00840 if (!user) {
00841 return;
00842 }
00843 send_cmd(s_OperServ, "QLINE %s", user);
00844 }
00845
00846
00847 void inspircd_cmd_chghost(char *nick, char *vhost)
00848 {
00849 if (!nick || !vhost) {
00850 return;
00851 }
00852 send_cmd(s_OperServ,"CHGHOST %s %s", nick, vhost);
00853 }
00854
00855
00856 void inspircd_cmd_chgident(char *nick, char *vIdent)
00857 {
00858 if (!nick || !vIdent) {
00859 return;
00860 }
00861 send_cmd(s_OperServ, "CHGIDENT %s %s", nick, vIdent);
00862 }
00863
00864
00865 void inspircd_cmd_invite(char *source, char *chan, char *nick)
00866 {
00867 if (!source || !chan || !nick) {
00868 return;
00869 }
00870
00871 send_cmd(source, "INVITE %s %s", nick, chan);
00872 }
00873
00874
00875 void inspircd_cmd_part(char *nick, char *chan, char *buf)
00876 {
00877 if (!nick || !chan) {
00878 return;
00879 }
00880
00881 if (buf) {
00882 send_cmd(nick, "PART %s :%s", chan, buf);
00883 } else {
00884 send_cmd(nick, "PART %s :Leaving", chan);
00885 }
00886 }
00887
00888
00889 void inspircd_cmd_391(char *source, char *timestr)
00890 {
00891 if (!timestr) {
00892 return;
00893 }
00894 send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr);
00895 }
00896
00897
00898 void inspircd_cmd_250(char *buf)
00899 {
00900 if (!buf) {
00901 return;
00902 }
00903
00904 send_cmd(NULL, "250 %s", buf);
00905 }
00906
00907
00908 void inspircd_cmd_307(char *buf)
00909 {
00910 if (!buf) {
00911 return;
00912 }
00913
00914 send_cmd(ServerName, "307 %s", buf);
00915 }
00916
00917
00918 void inspircd_cmd_311(char *buf)
00919 {
00920 if (!buf) {
00921 return;
00922 }
00923
00924 send_cmd(ServerName, "311 %s", buf);
00925 }
00926
00927
00928 void inspircd_cmd_312(char *buf)
00929 {
00930 if (!buf) {
00931 return;
00932 }
00933
00934 send_cmd(ServerName, "312 %s", buf);
00935 }
00936
00937
00938 void inspircd_cmd_317(char *buf)
00939 {
00940 if (!buf) {
00941 return;
00942 }
00943
00944 send_cmd(ServerName, "317 %s", buf);
00945 }
00946
00947
00948 void inspircd_cmd_219(char *source, char *letter)
00949 {
00950 if (!source) {
00951 return;
00952 }
00953
00954 if (letter) {
00955 send_cmd(NULL, "219 %s %c :End of /STATS report.", source,
00956 *letter);
00957 } else {
00958 send_cmd(NULL, "219 %s l :End of /STATS report.", source);
00959 }
00960 }
00961
00962
00963 void inspircd_cmd_401(char *source, char *who)
00964 {
00965 if (!source || !who) {
00966 return;
00967 }
00968 send_cmd(ServerName, "401 %s %s :No such service.", source, who);
00969 }
00970
00971
00972 void inspircd_cmd_318(char *source, char *who)
00973 {
00974 if (!source || !who) {
00975 return;
00976 }
00977
00978 send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who);
00979 }
00980
00981
00982 void inspircd_cmd_242(char *buf)
00983 {
00984 if (!buf) {
00985 return;
00986 }
00987
00988 send_cmd(NULL, "242 %s", buf);
00989 }
00990
00991
00992 void inspircd_cmd_243(char *buf)
00993 {
00994 if (!buf) {
00995 return;
00996 }
00997
00998 send_cmd(NULL, "243 %s", buf);
00999 }
01000
01001
01002 void inspircd_cmd_211(char *buf)
01003 {
01004 if (!buf) {
01005 return;
01006 }
01007
01008 send_cmd(NULL, "211 %s", buf);
01009 }
01010
01011
01012 void inspircd_cmd_global(char *source, char *buf)
01013 {
01014 if (!buf) {
01015 return;
01016 }
01017
01018 send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf);
01019 }
01020
01021
01022 void inspircd_cmd_sqline(char *mask, char