dreamforge.c

Go to the documentation of this file.
00001 /* DreamForge IRCD functions
00002  *
00003  * (C) 2003-2007 Anope Team
00004  * Contact us at info@anope.org
00005  *
00006  * Please read COPYING and README for further details.
00007  *
00008  * Based on the original code of Epona by Lara.
00009  * Based on the original code of Services by Andy Church. 
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",        /* ircd name */
00020      "+o",                      /* nickserv mode */
00021      "+o",                      /* chanserv mode */
00022      "+o",                      /* memoserv mode */
00023      "+",                       /* hostserv mode */
00024      "+io",                     /* operserv mode */
00025      "+o",                      /* botserv mode  */
00026      "+h",                      /* helpserv mode */
00027      "+i",                      /* Dev/Null mode */
00028      "+io",                     /* Global mode   */
00029      "+o",                      /* nickserv alias mode */
00030      "+o",                      /* chanserv alias mode */
00031      "+o",                      /* memoserv alias mode */
00032      "+",                       /* hostserv alias mode */
00033      "+io",                     /* operserv alias mode */
00034      "+o",                      /* botserv alias mode  */
00035      "+h",                      /* helpserv alias mode */
00036      "+i",                      /* Dev/Null alias mode */
00037      "+io",                     /* Global alias mode   */
00038      "+",                       /* Used by BotServ Bots */
00039      2,                         /* Chan Max Symbols     */
00040      "-iklmnpstR",              /* Modes to Remove */
00041      "+o",                      /* Channel Umode used by Botserv bots */
00042      1,                         /* SVSNICK */
00043      0,                         /* Vhost  */
00044      0,                         /* Has Owner */
00045      NULL,                      /* Mode to set for an owner */
00046      NULL,                      /* Mode to unset for an owner */
00047      NULL,                      /* Mode to set for chan admin */
00048      NULL,                      /* Mode to unset for chan admin */
00049      "+rd",                     /* Mode On Reg          */
00050      NULL,                      /* Mode on ID for Roots */
00051      NULL,                      /* Mode on ID for Admins */
00052      NULL,                      /* Mode on ID for Opers */
00053      "-r+d",                    /* Mode on UnReg        */
00054      "+d",                      /* Mode on Nick Change  */
00055      0,                         /* Supports SGlines     */
00056      1,                         /* Supports SQlines     */
00057      0,                         /* Supports SZlines     */
00058      0,                         /* Supports Halfop +h   */
00059      3,                         /* Number of server args */
00060      0,                         /* Join 2 Set           */
00061      0,                         /* Join 2 Message       */
00062      0,                         /* Has exceptions +e    */
00063      0,                         /* TS Topic Forward     */
00064      1,                         /* TS Topci Backward    */
00065      0,                         /* Protected Umode      */
00066      0,                         /* Has Admin            */
00067      0,                         /* Chan SQlines         */
00068      0,                         /* Quit on Kill         */
00069      0,                         /* SVSMODE unban        */
00070      0,                         /* Has Protect          */
00071      1,                         /* Reverse              */
00072      1,                         /* Chan Reg             */
00073      CMODE_r,                   /* Channel Mode         */
00074      0,                         /* vidents              */
00075      0,                         /* svshold              */
00076      1,                         /* time stamp on mode   */
00077      0,                         /* NICKIP               */
00078      0,                         /* O:LINE               */
00079      1,                         /* UMODE               */
00080      0,                         /* VHOST ON NICK        */
00081      0,                         /* Change RealName      */
00082      0,                         /* No Knock             */
00083      0,                         /* Admin Only           */
00084      DEFAULT_MLOCK,             /* Default MLOCK       */
00085      0,                         /* Vhost Mode           */
00086      0,                         /* +f                   */
00087      0,                         /* +L                   */
00088      0,                         /* Mode */
00089      0,                         /* Mode */
00090      0,
00091      1,                         /* No Knock requires +i */
00092      NULL,                      /* CAPAB Chan Modes             */
00093      0,                         /* We support TOKENS */
00094      1,                         /* TOKENS are CASE inSensitive */
00095      0,                         /* TIME STAMPS are BASE64 */
00096      0,                         /* +I support */
00097      0,                         /* SJOIN ban char */
00098      0,                         /* SJOIN except char */
00099      0,                         /* SJOIN invite char */
00100      0,                         /* Can remove User Channel Modes with SVSMODE */
00101      0,                         /* Sglines are not enforced until user reconnects */
00102      NULL,                      /* vhost char */
00103      0,                         /* ts6 */
00104      1,                         /* support helper umode */
00105      0,                         /* p10 */
00106      NULL,                      /* character set */
00107      0,                         /* reports sync state */
00108      }
00109     ,
00110     {NULL}
00111 };
00112 
00113 IRCDCAPAB myIrcdcap[] = {
00114     {
00115      CAPAB_NOQUIT,              /* NOQUIT       */
00116      0,                         /* TSMODE       */
00117      0,                         /* UNCONNECT    */
00118      0,                         /* NICKIP       */
00119      0,                         /* SJOIN        */
00120      0,                         /* ZIP          */
00121      0,                         /* BURST        */
00122      0,                         /* TS5          */
00123      0,                         /* TS3          */
00124      0,                         /* DKEY         */
00125      0,                         /* PT4          */
00126      0,                         /* SCS          */
00127      0,                         /* QS           */
00128      0,                         /* UID          */
00129      0,                         /* KNOCK        */
00130      0,                         /* CLIENT       */
00131      0,                         /* IPV6         */
00132      0,                         /* SSJ5         */
00133      0,                         /* SN2          */
00134      CAPAB_TOKEN,               /* TOKEN        */
00135      0,                         /* VHOST        */
00136      0,                         /* SSJ3         */
00137      0,                         /* NICK2        */
00138      0,                         /* UMODE2       */
00139      0,                         /* VL           */
00140      0,                         /* TLKEXT       */
00141      0,                         /* DODKEY       */
00142      0,                         /* DOZIP        */
00143      0, 0, 0}
00144 };
00145 
00146 void dreamforge_set_umode(User * user, int ac, char **av)
00147 {
00148     int add = 1;                /* 1 if adding modes, 0 if deleting */
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         /* This looks better, much better than "add ? (do_add) : (do_remove)".
00159          * At least this is readable without paying much attention :) -GD
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,                    /* Unused */
00211     0, 0, 0,                    /* Unused */
00212     0, 0, 0,                    /* Unused, Unused, Horzontal Tab */
00213     0, 0, 0,                    /* Line Feed, Unused, Unused */
00214     0, 0, 0,                    /* Carriage Return, Unused, Unused */
00215     0, 0, 0,                    /* Unused */
00216     0, 0, 0,                    /* Unused */
00217     0, 0, 0,                    /* Unused */
00218     0, 0, 0,                    /* Unused */
00219     0, 0, 0,                    /* Unused */
00220     0, 0, 0,                    /* Unused, Unused, Space */
00221     0, 0, 0,                    /* ! " #  */
00222     0, 0, 0,                    /* $ % &  */
00223     0, 0, 0,                    /* ! ( )  */
00224     0, 0, 0,                    /* * + ,  */
00225     0, 0, 0,                    /* - . /  */
00226     0, 0,                       /* 0 1 */
00227     0, 0,                       /* 2 3 */
00228     0, 0,                       /* 4 5 */
00229     0, 0,                       /* 6 7 */
00230     0, 0,                       /* 8 9 */
00231     0, 0,                       /* : ; */
00232     0, 0, 0,                    /* < = > */
00233     0, 0,                       /* ? @ */
00234     UMODE_A, 0, 0,              /* A B C */
00235     0, 0, 0,                    /* D E F */
00236     0, 0, 0,                    /* G H I */
00237     0, 0, 0,                    /* J K L */
00238     0, 0, UMODE_O,              /* M N O */
00239     0, 0, 0,                    /* P Q R */
00240     0, 0, 0,                    /* S T U */
00241     0, 0, 0,                    /* V W X */
00242     0,                          /* Y */
00243     0,                          /* Z */
00244     0, 0, 0,                    /* [ \ ] */
00245     0, 0, 0,                    /* ^ _ ` */
00246     UMODE_a, 0, UMODE_c,        /* a b c */
00247     0, 0, UMODE_f,              /* d e f */
00248     UMODE_g, UMODE_h, UMODE_i,  /* g h i */
00249     0, UMODE_k, 0,              /* j k l */
00250     0, 0, UMODE_o,              /* m n o */
00251     0, 0, UMODE_r,              /* p q r */
00252     UMODE_s, 0, 0,              /* s t u */
00253     0, UMODE_w, 0,              /* v w x */
00254     0,                          /* y */
00255     0,                          /* z */
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},                        /* A */
00319     {0},                        /* B */
00320     {0},                        /* C */
00321     {0},                        /* D */
00322     {0},                        /* E */
00323     {0},                        /* F */
00324     {0},                        /* G */
00325     {0},                        /* H */
00326     {0},                        /* I */
00327     {0},                        /* J */
00328     {0},                        /* K */
00329     {0},                        /* L */
00330     {0},                        /* M */
00331     {0},                        /* N */
00332     {0},                        /* O */
00333     {0},                        /* P */
00334     {0},                        /* Q */
00335     {CMODE_R, 0, NULL, NULL},   /* R */
00336     {0},                        /* S */
00337     {0},                        /* T */
00338     {0},                        /* U */
00339     {0},                        /* V */
00340     {0},                        /* W */
00341     {0},                        /* X */
00342     {0},                        /* Y */
00343     {0},                        /* Z */
00344     {0}, {0}, {0}, {0}, {0}, {0},
00345     {0},                        /* a */
00346     {0},                        /* b */
00347     {0},                        /* c */
00348     {0},                        /* d */
00349     {0},                        /* e */
00350     {0},                        /* f */
00351     {0},                        /* g */
00352     {0},                        /* h */
00353     {CMODE_i, 0, NULL, NULL},
00354     {0},                        /* j */
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},                        /* o */
00360     {CMODE_p, 0, NULL, NULL},
00361     {0},                        /* q */
00362     {CMODE_r, CBM_NO_MLOCK, NULL, NULL},
00363     {CMODE_s, 0, NULL, NULL},
00364     {CMODE_t, 0, NULL, NULL},
00365     {0},
00366     {0},                        /* v */
00367     {0},                        /* w */
00368     {0},                        /* x */
00369     {0},                        /* y */
00370     {0},                        /* z */
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},                        /* a */
00406     {0},                        /* b */
00407     {0},                        /* c */
00408     {0},                        /* d */
00409     {0},                        /* e */
00410     {0},                        /* f */
00411     {0},                        /* g */
00412     {0},                        /* h */
00413     {0},                        /* i */
00414     {0},                        /* j */
00415     {0},                        /* k */
00416     {0},                        /* l */
00417     {0},                        /* m */
00418     {0},                        /* n */
00419     {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op},
00420     {0},                        /* p */
00421     {0},                        /* q */
00422     {0},                        /* r */
00423     {0},                        /* s */
00424     {0},                        /* t */
00425     {0},                        /* u */
00426     {CUS_VOICE, 0, NULL},
00427     {0},                        /* w */
00428     {0},                        /* x */
00429     {0},                        /* y */
00430     {0},                        /* z */
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 /* *INDENT-OFF* */
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 /* *INDENT-ON* */
00510 
00511 /* Event: PROTOCTL */
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 /* PART */
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 /* PASS */
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 /* SERVER name hop descript */
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 /* GLOBOPS */
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 /* QUIT */
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 /* 391 */
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 /* 250 */
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 /* 307 */
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 /* 311 */
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 /* 312 */
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 /* 317 */
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 /* 219 */
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 /* 401 */
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 /* 318 */
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 /* 242 */
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 /* 243 */
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 /* 211 */
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 /* EVENT: SERVER */
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 /* INVITE */
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 /* PONG */
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 /* SVSHOLD - set */
01053 void dreamforge_cmd_svshold(char *nick)
01054 {
01055     /* Not supported by this IRCD */
01056 }
01057 
01058