inspircd11.c

Go to the documentation of this file.
00001 /* inspircd 1.1 beta 6+ functions
00002  *
00003  * (C) 2005-2007 Craig Edwards <brain@inspircd.org>
00004  * (C) 2003-2013 Anope Team
00005  * Contact us at team@anope.org
00006  *
00007  * Please read COPYING and README for further details.
00008  *
00009  * Based on the original code of Epona by Lara.
00010  * Based on the original code of Services by Andy Church. 
00011  * 
00012  *
00013  */
00014 
00015 /*************************************************************************/
00016 
00017 #include "services.h"
00018 #include "pseudo.h"
00019 #include "inspircd11.h"
00020 #include "version.h"
00021 
00022 #ifndef _WIN32
00023 #include <sys/socket.h>
00024 #include <netinet/in.h>
00025 #include <arpa/inet.h>
00026 #endif
00027 
00028 #ifdef _WIN32
00029 #include "winsock.h"
00030 int inet_aton(const char *name, struct in_addr *addr)
00031 {
00032     uint32 a = inet_addr(name);
00033     addr->s_addr = a;
00034     return a != (uint32) - 1;
00035 }
00036 #endif
00037 
00038 IRCDVar myIrcd[] = {
00039     {"InspIRCd 1.1",            /* ircd name */
00040      "+I",                      /* nickserv mode */
00041      "+I",                      /* chanserv mode */
00042      "+I",                      /* memoserv mode */
00043      "+I",                      /* hostserv mode */
00044      "+ioI",                    /* operserv mode */
00045      "+I",                      /* botserv mode  */
00046      "+I",                      /* helpserv mode */
00047      "+iI",                     /* Dev/Null mode */
00048      "+iI",                     /* Global mode   */
00049      "+I",                      /* nickserv alias mode */
00050      "+I",                      /* chanserv alias mode */
00051      "+I",                      /* memoserv alias mode */
00052      "+I",                      /* hostserv alias mode */
00053      "+ioI",                    /* operserv alias mode */
00054      "+I",                      /* botserv alias mode  */
00055      "+I",                      /* helpserv alias mode */
00056      "+iI",                     /* Dev/Null alias mode */
00057      "+iI",                     /* Global alias mode   */
00058      "+I",                      /* Used by BotServ Bots */
00059      5,                         /* Chan Max Symbols     */
00060      "-cijlmnpstuzACGHKNOQRSV", /* Modes to Remove */
00061      "+ao",                     /* Channel Umode used by Botserv bots */
00062      1,                         /* SVSNICK */
00063      1,                         /* Vhost  */
00064      1,                         /* Has Owner */
00065      "+q",                      /* Mode to set for an owner */
00066      "-q",                      /* Mode to unset for an owner */
00067      "+a",                      /* Mode to set for channel admin */
00068      "-a",                      /* Mode to unset for channel admin */
00069      "+r",                      /* Mode On Reg          */
00070      NULL,                      /* Mode on ID for Roots */
00071      NULL,                      /* Mode on ID for Admins */
00072      NULL,                      /* Mode on ID for Opers */
00073      "-r",                      /* Mode on UnReg        */
00074      "-r",                      /* Mode on Nick Change  */
00075      1,                         /* Supports SGlines     */
00076      1,                         /* Supports SQlines     */
00077      1,                         /* Supports SZlines     */
00078      1,                         /* Supports Halfop +h   */
00079      4,                         /* Number of server args */
00080      0,                         /* Join 2 Set           */
00081      1,                         /* Join 2 Message       */
00082      0,                         /* Has exceptions +e    */
00083      1,                         /* TS Topic Forward     */
00084      0,                         /* TS Topci Backward    */
00085      0,                         /* Protected Umode      */
00086      0,                         /* Has Admin            */
00087      0,                         /* Chan SQlines         */
00088      0,                         /* Quit on Kill         */
00089      0,                         /* SVSMODE unban        */
00090      1,                         /* Has Protect          */
00091      1,                         /* Reverse              */
00092      1,                         /* Chan Reg             */
00093      CMODE_r,                   /* Channel Mode         */
00094      1,                         /* vidents              */
00095      0,                         /* svshold              */
00096      0,                         /* time stamp on mode   */
00097      0,                         /* NICKIP               */
00098      1,                         /* O:LINE               */
00099      1,                         /* UMODE               */
00100      1,                         /* VHOST ON NICK        */
00101      0,                         /* Change RealName      */
00102      CMODE_K,                   /* No Knock             */
00103      0,                         /* Admin Only           */
00104      DEFAULT_MLOCK,             /* Default MLOCK       */
00105      UMODE_x,                   /* Vhost Mode           */
00106      0,                         /* +f                   */
00107      1,                         /* +L                   */
00108      CMODE_f,
00109      CMODE_L,
00110      0,
00111      1,                         /* No Knock requires +i */
00112      NULL,                      /* CAPAB Chan Modes             */
00113      0,                         /* We support inspircd TOKENS */
00114      1,                         /* TOKENS are CASE inSensitive */
00115      0,                         /* TIME STAMPS are BASE64 */
00116      0,                         /* +I support */
00117      0,                         /* SJOIN ban char */
00118      0,                         /* SJOIN except char */
00119      0,                         /* SJOIN invite char */
00120      0,                         /* Can remove User Channel Modes with SVSMODE */
00121      0,                         /* Sglines are not enforced until user reconnects */
00122      "x",                       /* vhost char */
00123      0,                         /* ts6 */
00124      1,                         /* support helper umode */
00125      0,                         /* p10 */
00126      NULL,                      /* character set */
00127      0,                         /* reports sync state */
00128      1,                         /* CIDR channelbans */
00129      1,                         /* +j */
00130      CMODE_j,                   /* +j Mode */
00131      0,                         /* Use delayed client introduction. */
00132      }
00133     ,
00134     {NULL}
00135 };
00136 
00137 
00138 IRCDCAPAB myIrcdcap[] = {
00139     {
00140      CAPAB_NOQUIT,              /* NOQUIT       */
00141      0,                         /* TSMODE       */
00142      1,                         /* UNCONNECT    */
00143      0,                         /* NICKIP       */
00144      0,                         /* SJOIN        */
00145      0,                         /* ZIP          */
00146      0,                         /* BURST        */
00147      0,                         /* TS5          */
00148      0,                         /* TS3          */
00149      0,                         /* DKEY         */
00150      0,                         /* PT4          */
00151      0,                         /* SCS          */
00152      0,                         /* QS           */
00153      0,                         /* UID          */
00154      0,                         /* KNOCK        */
00155      0,                         /* CLIENT       */
00156      0,                         /* IPV6         */
00157      0,                         /* SSJ5         */
00158      0,                         /* SN2          */
00159      0,                         /* TOKEN        */
00160      0,                         /* VHOST        */
00161      CAPAB_SSJ3,                /* SSJ3         */
00162      CAPAB_NICK2,               /* NICK2        */
00163      0,                         /* UMODE2       */
00164      CAPAB_VL,                  /* VL           */
00165      CAPAB_TLKEXT,              /* TLKEXT       */
00166      0,                         /* DODKEY       */
00167      0,                         /* DOZIP        */
00168      0,
00169      0, 0}
00170 };
00171 
00172 unsigned long umodes[128] = {
00173     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00174     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00175     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00176     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00177     0, UMODE_A, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00178     0,
00179     0,
00180     0,
00181     0, 0, 0, 0, 0, 0, 0,
00182     0,
00183     0, 0, 0, 0, 0,
00184     0, UMODE_a, 0, 0, 0, 0, 0,
00185     UMODE_g,
00186     UMODE_h, UMODE_i, 0, 0, 0, 0, 0, UMODE_o,
00187     0,
00188     0, UMODE_r, 0, 0, 0, 0, UMODE_w,
00189     UMODE_x,
00190     0,
00191     0,
00192     0, 0, 0, 0, 0
00193 };
00194 
00195 
00196 char myCsmodes[128] = {
00197     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00198     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00199 
00200     0,
00201     0,
00202     0, 0, 0,
00203     'h',                        /* (37) % Channel halfops */
00204     'a',
00205     0, 0, 0, 0,
00206 
00207     'v', 0, 0, 0, 0,
00208     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00209 
00210     'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00211     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00212 
00213     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00214     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'q', 0
00215 };
00216 
00217 CMMode myCmmodes[128] = {
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}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00227     {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00228     {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00229     {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00230     {NULL},
00231     {NULL},
00232     {add_ban, del_ban},
00233     {NULL},
00234     {NULL},
00235     {NULL, NULL},
00236     {NULL},
00237     {NULL},
00238     {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00239     {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL},
00240     {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}
00241 };
00242 
00243 
00244 
00245 CBMode myCbmodes[128] = {
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}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00251     {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00252     {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00253     {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00254     {0},
00255     {CMODE_A, CBM_NO_USER_MLOCK, NULL, NULL},
00256     {0},                        /* B */
00257     {CMODE_C, 0, NULL, NULL},   /* C */
00258     {0},                        /* D */
00259     {0},                        /* E */
00260     {0},                        /* F */
00261     {CMODE_G, 0, NULL, NULL},   /* G */
00262     {CMODE_H, CBM_NO_USER_MLOCK, NULL, NULL},
00263     {0},                        /* I */
00264     {0},                        /* J */
00265     {CMODE_K, 0, NULL, NULL},   /* K */
00266     {CMODE_L, 0, set_redirect, cs_set_redirect},
00267     {0},                        /* M */
00268     {CMODE_N, 0, NULL, NULL},   /* N */
00269     {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL},
00270     {0},                        /* P */
00271     {CMODE_Q, 0, NULL, NULL},   /* Q */
00272     {CMODE_R, 0, NULL, NULL},   /* R */
00273     {CMODE_S, 0, NULL, NULL},   /* S */
00274     {0},                        /* T */
00275     {0},                        /* U */
00276     {CMODE_V, 0, NULL, NULL},   /* V */
00277     {0},                        /* W */
00278     {0},                        /* X */
00279     {0},                        /* Y */
00280     {0},                        /* Z */
00281     {0}, {0}, {0}, {0}, {0}, {0},
00282     {0},                        /* a */
00283     {0},                        /* b */
00284     {CMODE_c, 0, NULL, NULL},
00285     {0},                        /* d */
00286     {0},                        /* e */
00287     {0},                        /* f */
00288     {0},                        /* g */
00289     {0},                        /* h */
00290     {CMODE_i, 0, NULL, NULL},
00291     {CMODE_j, CBM_MINUS_NO_ARG | CBM_NO_MLOCK, chan_set_throttle, cs_set_throttle}, /* j */
00292     {CMODE_k, 0, chan_set_key, cs_set_key},
00293     {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit},
00294     {CMODE_m, 0, NULL, NULL},
00295     {CMODE_n, 0, NULL, NULL},
00296     {0},                        /* o */
00297     {CMODE_p, 0, NULL, NULL},
00298     {0},                        /* q */
00299     {CMODE_r, CBM_NO_MLOCK, NULL, NULL},
00300     {CMODE_s, 0, NULL, NULL},
00301     {CMODE_t, 0, NULL, NULL},
00302     {CMODE_u, 0, NULL, NULL},
00303     {0},                        /* v */
00304     {0},                        /* w */
00305     {0},                        /* x */
00306     {0},                        /* y */
00307     {CMODE_z, 0, NULL, NULL},
00308     {0}, {0}, {0}, {0}
00309 };
00310 
00311 CBModeInfo myCbmodeinfos[] = {
00312     {'f', CMODE_f, 0, NULL, NULL},
00313     {'c', CMODE_c, 0, NULL, NULL},
00314     {'i', CMODE_i, 0, NULL, NULL},
00315     {'j', CMODE_j, 0, get_throttle, cs_get_throttle},
00316     {'k', CMODE_k, 0, get_key, cs_get_key},
00317     {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit},
00318     {'m', CMODE_m, 0, NULL, NULL},
00319     {'n', CMODE_n, 0, NULL, NULL},
00320     {'p', CMODE_p, 0, NULL, NULL},
00321     {'r', CMODE_r, 0, NULL, NULL},
00322     {'s', CMODE_s, 0, NULL, NULL},
00323     {'t', CMODE_t, 0, NULL, NULL},
00324     {'u', CMODE_u, 0, NULL, NULL},
00325     {'z', CMODE_z, 0, NULL, NULL},
00326     {'A', CMODE_A, 0, NULL, NULL},
00327     {'C', CMODE_C, 0, NULL, NULL},
00328     {'G', CMODE_G, 0, NULL, NULL},
00329     {'H', CMODE_H, 0, NULL, NULL},
00330     {'K', CMODE_K, 0, NULL, NULL},
00331     {'L', CMODE_L, 0, get_redirect, cs_get_redirect},
00332     {'N', CMODE_N, 0, NULL, NULL},
00333     {'O', CMODE_O, 0, NULL, NULL},
00334     {'Q', CMODE_Q, 0, NULL, NULL},
00335     {'R', CMODE_R, 0, NULL, NULL},
00336     {'S', CMODE_S, 0, NULL, NULL},
00337     {'V', CMODE_V, 0, NULL, NULL},
00338     {0}
00339 };
00340 
00341 CUMode myCumodes[128] = {
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}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00353     {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00354     {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00355     {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
00356 
00357     {0},
00358 
00359     {CUS_PROTECT, CUF_PROTECT_BOTSERV, check_valid_op},
00360     {0},                        /* b */
00361     {0},                        /* c */
00362     {0},                        /* d */
00363     {0},                        /* e */
00364     {0},                        /* f */
00365     {0},                        /* g */
00366     {CUS_HALFOP, 0, check_valid_op},
00367     {0},                        /* i */
00368     {0},                        /* j */
00369     {0},                        /* k */
00370     {0},                        /* l */
00371     {0},                        /* m */
00372     {0},                        /* n */
00373     {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op},
00374     {0},                        /* p */
00375     {CUS_OWNER, 0, check_valid_op},
00376     {0},                        /* r */
00377     {0},                        /* s */
00378     {0},                        /* t */
00379     {0},                        /* u */
00380     {CUS_VOICE, 0, NULL},
00381     {0},                        /* w */
00382     {0},                        /* x */
00383     {0},                        /* y */
00384     {0},                        /* z */
00385     {0}, {0}, {0}, {0}, {0}
00386 };
00387 
00388 static int has_servicesmod = 0;
00389 static int has_globopsmod = 0;
00390 
00391 /* These are sanity checks to insure we are supported. 
00392    The ircd tends to /squit us if we issue unsupported cmds.
00393    - katsklaw */
00394 static int has_svsholdmod = 0;
00395 static int has_chghostmod = 0;
00396 static int has_chgidentmod = 0;
00397 static int has_messagefloodmod = 0;
00398 static int has_banexceptionmod = 0;
00399 static int has_inviteexceptionmod = 0;
00400 
00401 void inspircd_set_umode(User * user, int ac, char **av)
00402 {
00403     int add = 1;                /* 1 if adding modes, 0 if deleting */
00404     char *modes = av[0];
00405 
00406     ac--;
00407 
00408     if (debug)
00409         alog("debug: Changing mode for %s to %s", user->nick, modes);
00410 
00411     while (*modes) {
00412 
00413         /* This looks better, much better than "add ? (do_add) : (do_remove)".
00414          * At least this is readable without paying much attention :) -GD
00415          */
00416         if (add)
00417             user->mode |= umodes[(int) *modes];
00418         else
00419             user->mode &= ~umodes[(int) *modes];
00420 
00421         switch (*modes++) {
00422         case '+':
00423             add = 1;
00424             break;
00425         case '-':
00426             add = 0;
00427             break;
00428         case 'd':
00429             if (ac == 0) {
00430                 break;
00431             }
00432 
00433             ac--;
00434             av++;
00435             user->svid = strtoul(*av, NULL, 0);
00436             break;
00437         case 'o':
00438             if (add) {
00439                 opcnt++;
00440                 if (WallOper) {
00441                     anope_cmd_global(s_OperServ,
00442                                      "\2%s\2 is now an IRC operator.",
00443                                      user->nick);
00444                 }
00445                 display_news(user, NEWS_OPER);
00446             } else {
00447                 opcnt--;
00448             }
00449             break;
00450         case 'a':
00451             if (UnRestrictSAdmin) {
00452                 break;
00453             }
00454             if (add && !is_services_admin(user)) {
00455                 common_svsmode(user, "-a", NULL);
00456                 user->mode &= ~UMODE_a;
00457             }
00458             break;
00459         case 'r':
00460                         user->svid = (add ? user->timestamp : 0);
00461             if (add && !nick_identified(user)) {
00462                 common_svsmode(user, "-r", NULL);
00463                 user->mode &= ~UMODE_r;
00464             }
00465             break;
00466         case 'x':
00467             update_host(user);
00468             break;
00469         }
00470     }
00471 }
00472 
00473 
00474 /* *INDENT-OFF* */
00475 void moduleAddIRCDMsgs(void) {
00476     Message *m;
00477 
00478     updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+a","-a");
00479 
00480     m = createMessage("436",       anope_event_436); addCoreMessage(IRCD,m);
00481     m = createMessage("AWAY",      anope_event_away); addCoreMessage(IRCD,m);
00482     m = createMessage("INVITE",    anope_event_null); addCoreMessage(IRCD,m);
00483     m = createMessage("JOIN",      anope_event_join); addCoreMessage(IRCD,m);
00484     m = createMessage("KICK",      anope_event_kick); addCoreMessage(IRCD,m);
00485     m = createMessage("KILL",      anope_event_kill); addCoreMessage(IRCD,m);
00486     m = createMessage("MODE",      anope_event_mode); addCoreMessage(IRCD,m);
00487     m = createMessage("MOTD",      anope_event_motd); addCoreMessage(IRCD,m);
00488     m = createMessage("NICK",      anope_event_nick); addCoreMessage(IRCD,m);
00489     m = createMessage("NOTICE",    anope_event_null); addCoreMessage(IRCD,m);
00490     m = createMessage("BURST",     anope_event_null); addCoreMessage(IRCD,m);
00491     m = createMessage("ENDBURST",  anope_event_null); addCoreMessage(IRCD,m);
00492     m = createMessage("CAPAB",     anope_event_capab); addCoreMessage(IRCD,m);
00493     m = createMessage("PART",      anope_event_part); addCoreMessage(IRCD,m);
00494     m = createMessage("PING",      anope_event_ping); addCoreMessage(IRCD,m);
00495     m = createMessage("PRIVMSG",   anope_event_privmsg); addCoreMessage(IRCD,m);
00496     m = createMessage("QUIT",      anope_event_quit); addCoreMessage(IRCD,m);
00497     m = createMessage("SERVER",    anope_event_server); addCoreMessage(IRCD,m);
00498     m = createMessage("SQUIT",     anope_event_squit); addCoreMessage(IRCD,m);
00499     m = createMessage("RSQUIT",    anope_event_rsquit); addCoreMessage(IRCD,m);
00500     m = createMessage("TOPIC",     anope_event_topic); addCoreMessage(IRCD,m);
00501     m = createMessage("WALLOPS",   anope_event_null); addCoreMessage(IRCD,m);
00502     m = createMessage("WHOIS",     anope_event_whois); addCoreMessage(IRCD,m);
00503     m = createMessage("GLOBOPS",   anope_event_null); addCoreMessage(IRCD,m);
00504     m = createMessage("SILENCE",   anope_event_null); addCoreMessage(IRCD,m);
00505     m = createMessage("SVSMODE",   anope_event_mode) ;addCoreMessage(IRCD,m);
00506     m = createMessage("QLINE",     anope_event_null); addCoreMessage(IRCD,m);
00507     m = createMessage("GLINE",     anope_event_null); addCoreMessage(IRCD,m);
00508     m = createMessage("ELINE",     anope_event_null); addCoreMessage(IRCD,m);
00509     m = createMessage("ZLINE",     anope_event_null); addCoreMessage(IRCD,m);
00510     m = createMessage("ADDLINE",   anope_event_null); addCoreMessage(IRCD,m);
00511     m = createMessage("FHOST",     anope_event_chghost); addCoreMessage(IRCD,m);
00512     m = createMessage("CHGIDENT",  anope_event_chgident); addCoreMessage(IRCD,m);
00513     m = createMessage("FNAME",     anope_event_chgname); addCoreMessage(IRCD,m);
00514     m = createMessage("METADATA",  anope_event_null); addCoreMessage(IRCD,m);
00515     m = createMessage("SETHOST",   anope_event_sethost); addCoreMessage(IRCD,m);
00516     m = createMessage("SETIDENT",  anope_event_setident); addCoreMessage(IRCD,m);
00517     m = createMessage("SETNAME",   anope_event_setname); addCoreMessage(IRCD,m);
00518     m = createMessage("REHASH",    anope_event_rehash); addCoreMessage(IRCD,m);
00519     m = createMessage("ADMIN",     anope_event_admin); addCoreMessage(IRCD,m);
00520     m = createMessage("CREDITS",   anope_event_credits); addCoreMessage(IRCD,m);
00521     m = createMessage("FJOIN",     anope_event_fjoin); addCoreMessage(IRCD,m);
00522     m = createMessage("FMODE",     anope_event_fmode); addCoreMessage(IRCD,m);
00523     m = createMessage("FTOPIC",    anope_event_ftopic); addCoreMessage(IRCD,m);
00524     m = createMessage("VERSION",   anope_event_version); addCoreMessage(IRCD,m);
00525     m = createMessage("OPERTYPE",  anope_event_opertype); addCoreMessage(IRCD,m);
00526     m = createMessage("IDLE",      anope_event_idle); addCoreMessage(IRCD,m);
00527 }
00528 
00529 /* *INDENT-ON* */
00530 
00531 void inspircd_cmd_svsnoop(char *server, int set)
00532 {
00533     /* Not Supported by this IRCD */
00534 }
00535 
00536 void inspircd_cmd_svsadmin(char *server, int set)
00537 {
00538     /* Not Supported by this IRCD */
00539 }
00540 
00541 void inspircd_cmd_remove_akill(char *user, char *host)
00542 {
00543     send_cmd(s_OperServ, "GLINE %s@%s", user, host);
00544 }
00545 
00546 void
00547 inspircd_cmd_topic(char *whosets, char *chan, char *whosetit,
00548                    char *topic, time_t when)
00549 {
00550     send_cmd(whosets, "FTOPIC %s %lu %s :%s", chan,
00551              (unsigned long int) when, whosetit, topic);
00552 }
00553 
00554 void inspircd_cmd_vhost_off(User * u)
00555 {
00556          send_cmd(s_OperServ,  "MODE %s -%s",  u->nick,  myIrcd->vhostchar);
00557          inspircd_cmd_chghost(u->nick, u->host);
00558 
00559          if (has_chgidentmod && u->username && u->vident && strcmp(u->username, u->vident) > 0)
00560          {
00561                  inspircd_cmd_chgident(u->nick, u->username);
00562          }
00563 }
00564 
00565 void
00566 inspircd_cmd_akill(char *user, char *host, char *who, time_t when,
00567                    time_t expires, char *reason)
00568 {
00569     send_cmd(ServerName, "ADDLINE G %s@%s %s %ld %ld :%s", user, host, who,
00570              (long int) time(NULL), (long int) 86400 * 2, reason);
00571 }
00572 
00573 void inspircd_cmd_svskill(char *source, char *user, char *buf)
00574 {
00575     if (!buf || !source || !user)
00576         return;
00577 
00578     send_cmd(source, "KILL %s :%s", user, buf);
00579 }
00580 
00581 void inspircd_cmd_svsmode(User * u, int ac, char **av)
00582 {
00583     /* This was originally done using this:
00584        send_cmd(s_NickServ, "MODE %s %s%s%s", u->nick, av[0], (ac == 2 ? " " : ""), (ac == 2 ? av[1] : ""));
00585        * but that's the dirty way of doing things...
00586      */
00587     send_cmd(s_NickServ, "MODE %s %s", u->nick, merge_args(ac, av));
00588 }
00589 
00590 
00591 void inspircd_cmd_372(char *source, char *msg)
00592 {
00593     send_cmd(ServerName, "372 %s :- %s", source, msg);
00594 }
00595 
00596 void inspircd_cmd_372_error(char *source)
00597 {
00598     send_cmd(ServerName, "422 %s :- MOTD file not found!  Please "
00599              "contact your IRC administrator.", source);
00600 }
00601 
00602 void inspircd_cmd_375(char *source)
00603 {
00604     send_cmd(ServerName, "375 %s :- %s Message of the Day",
00605              source, ServerName);
00606 }
00607 
00608 void inspircd_cmd_376(char *source)
00609 {
00610     send_cmd(ServerName, "376 %s :End of /MOTD command.", source);
00611 }
00612 
00613 void inspircd_cmd_nick(char *nick, char *name, char *modes)
00614 {
00615     /* :test.chatspike.net NICK 1133519355 Brain synapse.brainbox.winbot.co.uk netadmin.chatspike.net ~brain +xwsioS 10.0.0.2 :Craig Edwards */
00616     send_cmd(ServerName, "NICK %ld %s %s %s %s +%s 0.0.0.0 :%s",
00617              (long int) time(NULL), nick, ServiceHost, ServiceHost,
00618              ServiceUser, modes, name);
00619     if (strchr(modes, 'o') != NULL)
00620         /* Don't send ServerName as the source here... -GD */
00621         send_cmd(nick, "OPERTYPE Service");
00622 }
00623 
00624 void
00625 inspircd_cmd_guest_nick(char *nick, char *user, char *host,
00626                         char *real, char *modes)
00627 {
00628     send_cmd(ServerName, "NICK %ld %s %s %s %s +%s 0.0.0.0 :%s",
00629              (long int) time(NULL), nick, host, host, user, modes, real);
00630 }
00631 
00632 void inspircd_cmd_mode(char *source, char *dest, char *buf)
00633 {
00634     Channel *c;
00635     if (!buf) {
00636         return;
00637     }
00638     
00639     c = findchan(dest);
00640     send_cmd(source ? source : s_OperServ, "FMODE %s %u %s", dest, (unsigned int)((c) ? c->creation_time : time(NULL)), buf);
00641 }
00642 
00643 int anope_event_version(char *source, int ac, char **av)
00644 {
00645     return MOD_CONT;
00646 }
00647 
00648 int anope_event_idle(char *source, int ac, char **av)
00649 {
00650     if (ac == 1) {
00651         send_cmd(av[0], "IDLE %s %ld 0", source, (long int) time(NULL));
00652     }
00653     return MOD_CONT;
00654 }
00655 
00656 int anope_event_ftopic(char *source, int ac, char **av)
00657 {
00658     /* :source FTOPIC channel ts setby :topic */
00659     char *temp;
00660     if (ac < 4)
00661         return MOD_CONT;
00662     temp = av[1];               /* temp now holds ts */
00663     av[1] = av[2];              /* av[1] now holds set by */
00664     av[2] = temp;               /* av[2] now holds ts */
00665     do_topic(source, ac, av);
00666     return MOD_CONT;
00667 }
00668 
00669 int anope_event_opertype(char *source, int ac, char **av)
00670 {
00671     /* opertype is equivalent to mode +o because servers
00672        dont do this directly */
00673     User *u;
00674     u = finduser(source);
00675     if (u && !is_oper(u)) {
00676         char *newav[2];
00677         newav[0] = source;
00678         newav[1] = "+o";
00679         return anope_event_mode(source, 2, newav);
00680     } else
00681         return MOD_CONT;
00682 }
00683 
00684 int anope_event_fmode(char *source, int ac, char **av)
00685 {
00686     char *newav[128];
00687     int n, o;
00688     Channel *c;
00689 
00690     /* :source FMODE #test 12345678 +nto foo */
00691     if (ac < 3)
00692         return MOD_CONT;
00693 
00694     /* Checking the TS for validity to avoid desyncs */
00695     if ((c = findchan(av[0]))) {
00696         if (c->creation_time > strtol(av[1], NULL, 10)) {
00697             /* Our TS is bigger, we should lower it */
00698             c->creation_time = strtol(av[1], NULL, 10);
00699         } else if (c->creation_time < strtol(av[1], NULL, 10)) {
00700             /* The TS we got is bigger, we should ignore this message. */
00701             return MOD_CONT;
00702         }
00703     } else {
00704         /* Got FMODE for a non-existing channel */
00705         return MOD_CONT;
00706     }
00707     
00708     /* TS's are equal now, so we can proceed with parsing */
00709     n = o = 0;
00710     while (n < ac) {
00711         if (n != 1) {
00712             newav[o] = av[n];
00713             o++;
00714             if (debug)
00715                 alog("Param: %s", newav[o - 1]);
00716         }
00717         n++;
00718     }
00719 
00720     return anope_event_mode(source, ac - 1, newav);
00721 }
00722 
00723 int anope_event_fjoin(char *source, int ac, char **av)
00724 {
00725     char *newav[10];
00726 
00727     /* value used for myStrGetToken */
00728     int curtoken = 0;
00729 
00730     /* storing the current nick */
00731     char *curnick;
00732 
00733     /* these are used to generate the final string that is passed to ircservices' core */
00734     int nlen = 0;
00735     char nicklist[514];
00736 
00737     /* temporary buffer */
00738     char prefixandnick[60];
00739 
00740     *nicklist = '\0';
00741     *prefixandnick = '\0';
00742 
00743     if (ac < 3)
00744         return MOD_CONT;
00745 
00746     curnick = myStrGetToken(av[2], ' ', curtoken);
00747     while (curnick != NULL) {
00748         for (; *curnick; curnick++) {
00749             /* I bet theres a better way to do this... */
00750             if ((*curnick == '&') ||
00751                 (*curnick == '~') || (*curnick == '@') || (*curnick == '%')
00752                 || (*curnick == '+')) {
00753                 prefixandnick[nlen++] = *curnick;
00754                 continue;
00755             } else {
00756                 if (*curnick == ',') {
00757                     curnick++;
00758                     strncpy(prefixandnick + nlen, curnick,
00759                             sizeof(prefixandnick) - nlen);
00760                     break;
00761                 } else {
00762                     alog("fjoin: unrecognised prefix: %c", *curnick);
00763                 }
00764             }
00765         }
00766         strncat(nicklist, prefixandnick, 513);
00767         strncat(nicklist, " ", 513);
00768         curtoken++;
00769         curnick = myStrGetToken(av[2], ' ', curtoken);
00770         nlen = 0;
00771     }
00772 
00773     newav[0] = av[1];           /* timestamp */
00774     newav[1] = av[0];           /* channel name */
00775     newav[2] = "+";             /* channel modes */
00776     newav[3] = nicklist;
00777     do_sjoin(source, 4, newav);
00778 
00779     return MOD_CONT;
00780 }
00781 
00782 void
00783 inspircd_cmd_bot_nick(char *nick, char *user, char *host, char *real,
00784                       char *modes)
00785 {
00786     send_cmd(ServerName, "NICK %ld %s %s %s %s +%s 0.0.0.0 :%s",
00787              (long int) time(NULL), nick, host, host, user, modes, real);
00788     if (strchr(modes, 'o') != NULL)
00789         send_cmd(nick, "OPERTYPE Bot");
00790 }
00791 
00792 void inspircd_cmd_kick(char *source, char *chan, char *user, char *buf)
00793 {
00794     if (buf) {
00795         send_cmd(source, "KICK %s %s :%s", chan, user, buf);
00796     } else {
00797         send_cmd(source, "KICK %s %s :%s", chan, user, user);
00798     }
00799 }
00800 
00801 void inspircd_cmd_notice_ops(char *source, char *dest, char *buf)
00802 {
00803     if (!buf) {
00804         return;
00805     }
00806 
00807     send_cmd(ServerName, "NOTICE @%s :%s", dest, buf);
00808 }
00809 
00810 
00811 void inspircd_cmd_notice(char *source, char *dest, char *buf)
00812 {
00813     if (!buf) {
00814         return;
00815     }
00816 
00817     if (NSDefFlags & NI_MSG) {
00818         inspircd_cmd_privmsg2(source, dest, buf);
00819     } else {
00820         send_cmd(source, "NOTICE %s :%s", dest, buf);
00821     }
00822 }
00823 
00824 void inspircd_cmd_notice2(char *source, char *dest, char *msg)
00825 {
00826     send_cmd(source, "NOTICE %s :%s", dest, msg);
00827 }
00828 
00829 void inspircd_cmd_privmsg(char *source, char *dest, char *buf)
00830 {
00831     if (!buf) {
00832         return;
00833     }
00834 
00835     send_cmd(source, "PRIVMSG %s :%s", dest, buf);
00836 }
00837 
00838 void inspircd_cmd_privmsg2(char *source, char *dest, char *msg)
00839 {
00840     send_cmd(source, "PRIVMSG %s :%s", dest, msg);
00841 }
00842 
00843 void inspircd_cmd_serv_notice(char *source, char *dest, char *msg)
00844 {
00845     send_cmd(source, "NOTICE $%s :%s", dest, msg);
00846 }
00847 
00848 void inspircd_cmd_serv_privmsg(char *source, char *dest, char *msg)
00849 {
00850     send_cmd(source, "PRIVMSG $%s :%s", dest, msg);
00851 }
00852 
00853 
00854 void inspircd_cmd_bot_chan_mode(char *nick, char *chan)
00855 {
00856     anope_cmd_mode(nick, chan, "%s %s %s", ircd->botchanumode, nick, nick);
00857 }
00858 
00859 void inspircd_cmd_351(char *source)
00860 {
00861     send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s",
00862              source, version_number, ServerName, ircd->name, version_flags,
00863              EncModule, version_build);
00864 }
00865 
00866 /* QUIT */
00867 void inspircd_cmd_quit(char *source, char *buf)
00868 {
00869     if (buf) {
00870         send_cmd(source, "QUIT :%s", buf);
00871     } else {
00872         send_cmd(source, "QUIT :Exiting");
00873     }
00874 }
00875 
00876 /* PROTOCTL */
00877 void inspircd_cmd_protoctl()
00878 {
00879 }
00880 
00881 static char currentpass[1024];
00882 
00883 /* PASS */
00884 void inspircd_cmd_pass(char *pass)
00885 {
00886     strncpy(currentpass, pass, 1024);
00887 }
00888 
00889 /* SERVER services-dev.chatspike.net password 0 :Description here */
00890 void inspircd_cmd_server(char *servname, int hop, char *descript)
00891 {
00892     send_cmd(ServerName, "SERVER %s %s %d :%s", servname, currentpass, hop,
00893              descript);
00894 }
00895 
00896 /* PONG */
00897 void inspircd_cmd_pong(char *servname, char *who)
00898 {
00899     send_cmd(servname, "PONG %s", who);
00900 }
00901 
00902 /* JOIN */
00903 void inspircd_cmd_join(char *user, char *channel, time_t chantime)
00904 {
00905     send_cmd(user, "JOIN %s %ld", channel, chantime);
00906 }
00907 
00908 /* UNSQLINE */
00909 void inspircd_cmd_unsqline(char *user)
00910 {
00911     if (!user) {
00912         return;
00913     }
00914     send_cmd(s_OperServ, "QLINE %s", user);
00915 }
00916 
00917 /* CHGHOST */
00918 void inspircd_cmd_chghost(char *nick, char *vhost)
00919 {
00920     if (has_chghostmod == 1) {
00921     if (!nick || !vhost) {
00922         return;
00923     }
00924     send_cmd(s_OperServ, "CHGHOST %s %s", nick, vhost);
00925     } else {
00926         anope_cmd_global(s_OperServ, "CHGHOST not loaded!");
00927     }
00928 }
00929 
00930 /* CHGIDENT */
00931 void inspircd_cmd_chgident(char *nick, char *vIdent)
00932 {
00933         if (has_chgidentmod == 1) {
00934                 if (!nick || !vIdent || !*vIdent) {
00935                 return;
00936         }
00937         send_cmd(s_OperServ, "CHGIDENT %s %s", nick, vIdent);
00938     } else {
00939                 anope_cmd_global(s_OperServ, "CHGIDENT not loaded!");
00940     }
00941 }
00942 
00943 /* INVITE */
00944 void inspircd_cmd_invite(char *source, char *chan, char *nick)
00945 {
00946     if (!source || !chan || !nick) {
00947         return;
00948     }
00949 
00950     send_cmd(source, "INVITE %s %s", nick, chan);
00951 }
00952 
00953 /* PART */
00954 void inspircd_cmd_part(char *nick, char *chan, char *buf)
00955 {
00956     if (!nick || !chan) {
00957         return;
00958     }
00959 
00960     if (buf) {
00961         send_cmd(nick, "PART %s :%s", chan, buf);
00962     } else {
00963         send_cmd(nick, "PART %s :Leaving", chan);
00964     }
00965 }
00966 
00967 /* 391 */
00968 void inspircd_cmd_391(char *source, char *timestr)
00969 {
00970     if (!timestr) {
00971         return;
00972     }
00973     send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr);
00974 }
00975 
00976 /* 250 */
00977 void inspircd_cmd_250(char *buf)
00978 {
00979     if (!buf) {
00980         return;
00981     }
00982 
00983     send_cmd(NULL, "250 %s", buf);
00984 }
00985 
00986 /* 307 */
00987 void inspircd_cmd_307(char *buf)
00988 {
00989     if (!buf) {
00990         return;
00991     }
00992 
00993     send_cmd(ServerName, "307 %s", buf);
00994 }
00995 
00996 /* 311 */
00997 void inspircd_cmd_311(char *buf)
00998 {
00999     if (!buf) {
01000         return;
01001     }
01002 
01003     send_cmd(ServerName, "311 %s", buf);
01004 }
01005 
01006 /* 312 */
01007 void inspircd_cmd_312(char *buf)
01008 {
01009     if (!buf) {
01010         return;
01011     }
01012 
01013     send_cmd(ServerName, "312 %s", buf);
01014 }
01015 
01016 /* 317 */
01017 void inspircd_cmd_317(char *buf)
01018 {
01019     if (!buf) {
01020         return;
01021     }
01022 
01023     send_cmd(ServerName, "317 %s", buf);
01024 }
01025 
01026 /* 219 */
01027 void inspircd_cmd_219(char *source, char *letter)
01028 {
01029     if (!source) {
01030         return;
01031     }
01032 
01033     if (letter) {
01034         send_cmd(NULL, "219 %s %c :End of /STATS report.", source,
01035                  *letter);
01036     } else {
01037         send_cmd(NULL, "219 %s l :End of /STATS report.", source);
01038     }
01039 }
01040 
01041 /* 401 */
01042 void inspircd_cmd_401(char *source, char *who)
01043 {
01044     if (!source || !who) {
01045         return;
01046     }
01047     send_cmd(ServerName, "401 %s %s :No such service.", source, who);
01048 }
01049 
01050 /* 318 */
01051 void inspircd_cmd_318(char *source, char *who)
01052 {
01053     if (!source || !who) {
01054         return;
01055     }
01056 
01057     send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who);
01058 }
01059 
01060 /* 242 */
01061 void inspircd_cmd_242(char *buf)
01062 {
01063     if (!buf) {
01064         return;
01065     }
01066 
01067     send_cmd(NULL, "242 %s", buf);
01068 }
01069 
01070 /* 243 */
01071 void inspircd_cmd_243(char *buf)
01072 {
01073     if (!buf) {
01074         return;
01075     }
01076 
01077     send_cmd(NULL, "243 %s", buf);
01078 }
01079 
01080 /* 211 */
01081 void inspircd_cmd_211(char *buf)
01082 {
01083     if (!buf) {
01084         return;
01085     }
01086 
01087     send_cmd(NULL, "211 %s", buf);
01088 }
01089 
01090 /* GLOBOPS */
01091 void inspircd_cmd_global(char *source, char *buf)
01092 {
01093     if (!buf) {
01094         return;
01095     }
01096 
01097     send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf);
01098 }
01099 
01100 /* SQLINE */
01101 void inspircd_cmd_sqline(char *mask, char *reason)
01102 {
01103     if (!mask || !reason) {
01104         return;
01105     }
01106 
01107     send_cmd(ServerName, "ADDLINE Q %s %s %ld 0 :%s", mask, s_OperServ,
01108              (long int) time(NULL), reason);
01109 }
01110 
01111 /* SQUIT */
01112 void inspircd_cmd_squit(char *servname, char *message)
01113 {
01114     if (!servname || !message) {
01115         return;
01116     }
01117 
01118     send_cmd(ServerName, "SQUIT %s :%s", servname, message);
01119 }
01120 
01121 /* SVSO */
01122 void inspircd_cmd_svso(char *source, char *nick, char *flag)
01123 {
01124 }
01125 
01126 /* NICK <newnick>  */
01127 void inspircd_cmd_chg_nick(char *oldnick, char *newnick)
01128 {
01129     if (!oldnick || !newnick) {
01130         return;
01131     }
01132 
01133     send_cmd(oldnick, "NICK %s", newnick);
01134 }
01135 
01136 /* SVSNICK */
01137 void inspircd_cmd_svsnick(char *source, char *guest, time_t when)
01138 {
01139     if (!source || !guest) {
01140         return;
01141     }
01142     /* Please note that inspircd will now echo back a nickchange for this SVSNICK */
01143     send_cmd(ServerName, "SVSNICK %s %s :%lu", source, guest,
01144              (unsigned long) when);
01145 }
01146 
01147 /* Functions that use serval cmd functions */
01148 
01149 void inspircd_cmd_vhost_on(char *nick, char *vIdent, char *vhost)
01150 {
01151     if (!nick) {
01152         return;
01153     }
01154     if (vIdent) {
01155         inspircd_cmd_chgident(nick, vIdent);
01156     }
01157     inspircd_cmd_chghost(nick, vhost);
01158 }
01159 
01160 void inspircd_cmd_connect(int servernum)
01161 {
01162     if (servernum == 1) {
01163         inspircd_cmd_pass(RemotePassword);
01164     }
01165     if (servernum == 2) {
01166         inspircd_cmd_pass(RemotePassword2);
01167     }
01168     if (servernum == 3) {
01169         inspircd_cmd_pass(RemotePassword3);
01170     }
01171     inspircd_cmd_server(ServerName, 0, ServerDesc);
01172     send_cmd(NULL, "BURST");
01173     send_cmd(ServerName, "VERSION :Anope-%s %s :%s - %s (%s) -- %s",
01174              version_number, ServerName, ircd->name, version_flags,
01175              EncModule, version_build);
01176 
01177     me_server =
01178         new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL);
01179 }
01180 
01181 void inspircd_cmd_bob()
01182 {
01183     /* Not used */
01184 }
01185 
01186 /* Events */
01187 
01188 int anope_event_ping(char *source, int ac, char **av)
01189 {
01190     if (ac < 1)
01191         return MOD_CONT;
01192     /* ((ac > 1) ? av[1] : ServerName) */
01193     inspircd_cmd_pong(ServerName, av[0]);
01194     return MOD_CONT;
01195 }
01196 
01197 int anope_event_436(char *source, int ac, char **av)
01198 {
01199     if (ac < 1)
01200         return MOD_CONT;
01201 
01202     m_nickcoll(av[0]);
01203     return MOD_CONT;
01204 }
01205 
01206 int anope_event_away(char *source, int ac, char **av)
01207 {
01208     if (!source) {
01209         return MOD_CONT;
01210     }
01211     m_away(source, (ac ? av[0] : NULL));
01212     return MOD_CONT;
01213 }
01214 
01215 /* Taken from hybrid.c, topic syntax is identical */
01216 
01217 int anope_event_topic(char *source, int ac, char **av)
01218 {
01219     Channel *c = findchan(av[0]);
01220     time_t topic_time = time(NULL);
01221 
01222     if (!c) {
01223         if (debug) {
01224             alog("debug: TOPIC %s for nonexistent channel %s",
01225                  merge_args(ac - 1, av + 1), av[0]);
01226         }
01227         return MOD_CONT;
01228     }
01229 
01230     if (check_topiclock(c, topic_time))
01231         return MOD_CONT;
01232 
01233     if (c->topic) {
01234         free(c->topic);
01235         c->topic = NULL;
01236     }
01237     if (ac > 1 && *av[1])
01238         c->topic = sstrdup(av[1]);
01239 
01240     strscpy(c->topic_setter, source, sizeof(c->topic_setter));
01241     c->topic_time = topic_time;
01242 
01243     record_topic(av[0]);
01244 
01245     if (ac > 1 && *av[1])
01246         send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[1]);
01247     else
01248         send_event(EVENT_TOPIC_UPDATED, 2, av[0], "");
01249 
01250     return MOD_CONT;
01251 }
01252 
01253 int anope_event_squit(char *source, int ac, char **av)
01254 {
01255     if (ac != 2)
01256         return MOD_CONT;
01257     do_squit(source, ac, av);
01258     return MOD_CONT;
01259 }
01260 
01261 int anope_event_rsquit(char *source, int ac, char **av)
01262 {
01263     if (ac < 1 || ac > 3)
01264         return MOD_CONT;
01265     
01266     /* Horrible workaround to an insp bug (#) in how RSQUITs are sent - mark */
01267     if (ac > 1 && strcmp(ServerName, av[0]) == 0)
01268         do_squit(source, ac - 1, av + 1);
01269     else
01270         do_squit(source, ac, av);
01271     
01272     return MOD_CONT;
01273 }
01274 
01275 int anope_event_quit(char *source, int ac, char **av)
01276 {
01277     if (ac != 1)
01278         return MOD_CONT;
01279     do_quit(source, ac, av);
01280     return MOD_CONT;
01281 }
01282 
01283 
01284 int anope_event_mode(char *source, int ac, char **av)
01285 {
01286     if (ac < 2)
01287         return MOD_CONT;
01288 
01289     if (*av[0] == '#' || *av[0] == '&') {
01290         do_cmode(source, ac, av);
01291     } else {
01292         /* InspIRCd lets opers change another
01293            users modes, we have to kludge this
01294            as it slightly breaks RFC1459
01295          */
01296         if (!strcasecmp(source, av[0])) {
01297             do_umode(source, ac, av);
01298         } else {
01299             do_umode(av[0], ac, av);
01300         }
01301     }
01302     return MOD_CONT;
01303 }
01304 
01305 
01306 int anope_event_kill(char *source, int ac, char **av)
01307 {
01308     if (ac != 2)
01309         return MOD_CONT;
01310 
01311     m_kill(av[0], av[1]);
01312     return MOD_CONT;
01313 }
01314 
01315 int anope_event_kick(char *source, int ac, char **av)
01316 {
01317     if (ac != 3)
01318         return MOD_CONT;
01319     do_kick(source, ac, av);
01320     return MOD_CONT;
01321 }
01322 
01323 
01324 int anope_event_join(char *source, int ac, char **av)
01325 {
01326     if (ac != 2)
01327         return MOD_CONT;
01328     do_join(source, ac, av);
01329     return MOD_CONT;
01330 }
01331 
01332 int anope_event_motd(char *source, int ac, char **av)
01333 {
01334     if (!source) {
01335         return MOD_CONT;
01336     }
01337 
01338     m_motd(source);
01339     return MOD_CONT;
01340 }
01341 
01342 int anope_event_setname(char *source, int ac, char **av)
01343 {
01344     User *u;
01345 
01346     if (ac != 1)
01347         return MOD_CONT;
01348 
01349     u = finduser(source);
01350     if (!u) {
01351         if (debug) {
01352             alog("debug: SETNAME for nonexistent user %s", source);
01353         }
01354         return MOD_CONT;
01355     }
01356 
01357     change_user_realname(u, av[0]);
01358     return MOD_CONT;
01359 }
01360 
01361 int anope_event_chgname(char *source, int ac, char **av)
01362 {
01363     User *u;
01364 
01365     if (ac != 2)
01366         return MOD_CONT;
01367 
01368     u = finduser(source);
01369     if (!u) {
01370         if (debug) {
01371             alog("debug: FNAME for nonexistent user %s", source);
01372         }
01373         return MOD_CONT;
01374     }
01375 
01376     change_user_realname(u, av[0]);
01377     return MOD_CONT;
01378 }
01379 
01380 int anope_event_setident(char *source, int ac, char **av)
01381 {
01382     User *u;
01383 
01384     if (ac != 1)
01385         return MOD_CONT;
01386 
01387     u = finduser(source);
01388     if (!u) {
01389         if (debug) {
01390             alog("debug: SETIDENT for nonexistent user %s", source);
01391         }
01392         return MOD_CONT;
01393     }
01394 
01395     change_user_username(u, av[0]);
01396     return MOD_CONT;
01397 }
01398 
01399 int anope_event_chgident(char *source, int ac, char **av)
01400 {
01401     User *u;
01402 
01403     if (ac != 2)
01404         return MOD_CONT;
01405 
01406     u = finduser(av[0]);
01407     if (!u) {
01408         if (debug) {
01409             alog("debug: CHGIDENT for nonexistent user %s", av[0]);
01410         }
01411         return MOD_CONT;
01412     }
01413 
01414     change_user_username(u, av[1]);
01415     return MOD_CONT;
01416 }
01417 
01418 int anope_event_sethost(char *source, int ac, char **av)
01419 {
01420     User *u;
01421 
01422     if (ac != 1)
01423         return MOD_CONT;
01424 
01425     u = finduser(source);
01426     if (!u) {
01427         if (debug) {
01428             alog("debug: SETHOST for nonexistent user %s", source);
01429         }
01430         return MOD_CONT;
01431     }
01432 
01433     change_user_host(u, av[0]);
01434     return MOD_CONT;
01435 }
01436 
01437 
01438 int anope_event_nick(char *source, int ac, char **av)
01439 {
01440     User *user;
01441     struct in_addr addy;
01442     uint32 *ad = (uint32 *) & addy;
01443 
01444     if (ac != 1) {
01445         if (ac == 8) {
01446                         int svid = 0;
01447                         int ts = strtoul(av[0], NULL, 10);
01448                         
01449                         if (strchr(av[5], 'r') != NULL)
01450                                 svid = ts;
01451                         
01452             inet_aton(av[6], &addy);
01453             user = do_nick("", av[1],   /* nick */
01454                            av[4],   /* username */
01455                            av[2],   /* realhost */
01456                            source,  /* server */
01457                            av[7],   /* realname */
01458                            ts, svid, htonl(*ad), av[3], NULL);
01459             if (user)
01460                 anope_set_umode(user, 1, &av[5]);
01461         }
01462     } else {
01463         do_nick(source, av[0], NULL, NULL, NULL, NULL, 0, 0, 0, NULL,
01464                 NULL);
01465     }
01466     return MOD_CONT;
01467 }
01468 
01469 
01470 int anope_event_chghost(char *source, int ac, char **av)
01471 {
01472     User *u;
01473 
01474     if (ac != 1)
01475         return MOD_CONT;
01476 
01477     u = finduser(source);
01478     if (!u) {
01479         if (debug) {
01480             alog("debug: FHOST for nonexistent user %s", source);
01481         }
01482         return MOD_CONT;
01483     }
01484 
01485     change_user_host(u, av[0]);
01486     return MOD_CONT;
01487 }
01488 
01489 /* EVENT: SERVER */
01490 int anope_event_server(char *source, int ac, char **av)
01491 {
01492     if (!stricmp(av[1], "1")) {
01493         uplink = sstrdup(av[0]);
01494     }
01495     do_server(source, av[0], av[1], av[2], NULL);
01496     return MOD_CONT;
01497 }
01498 
01499 
01500 int anope_event_privmsg(char *source, int ac, char **av)
01501 {
01502     if (ac != 2)
01503         return MOD_CONT;
01504     m_privmsg(source, av[0], av[1]);
01505     return MOD_CONT;
01506 }
01507 
01508 int anope_event_part(char *source, int ac, char **av)
01509 {
01510     if (ac < 1 || ac > 2)
01511         return MOD_CONT;
01512     do_part(source, ac, av);
01513     return MOD_CONT;
01514 }
01515 
01516 int anope_event_whois(char *source, int ac, char **av)
01517 {
01518     if (source && ac >= 1) {
01519         m_whois(source, av[0]);
01520     }
01521     return MOD_CONT;
01522 }
01523 
01524 int anope_event_capab(char *source, int ac, char **av)
01525 {
01526     int argc;
01527     char **argv;
01528     CBModeInfo *cbmi;
01529 
01530     if (strcasecmp(av[0], "START") == 0) {
01531         /* reset CAPAB */
01532         has_servicesmod = 0;
01533         has_globopsmod = 0;
01534         has_svsholdmod = 0;
01535         has_chghostmod = 0;
01536         has_chgidentmod = 0;
01537 
01538     } else if (strcasecmp(av[0], "MODULES") == 0) {
01539         if (strstr(av[1], "m_globops.so")) {
01540             has_globopsmod = 1;
01541         }
01542         if (strstr(av[1], "m_services.so")) {
01543             has_servicesmod = 1;
01544         }
01545         if (strstr(av[1], "m_svshold.so")) {      
01546             has_svsholdmod = 1;
01547         }
01548         if (strstr(av[1], "m_chghost.so")) {
01549             has_chghostmod = 1;
01550         }
01551         if (strstr(av[1], "m_chgident.so")) {      
01552             has_chgidentmod = 1;
01553         }
01554         if (strstr(av[1], "m_messageflood.so")) {
01555             has_messagefloodmod = 1;
01556         }
01557         if (strstr(av[1], "m_banexception.so")) {
01558             has_banexceptionmod = 1;
01559         }
01560         if (strstr(av[1], "m_inviteexception.so")) {
01561             has_inviteexceptionmod = 1;
01562         }
01563     } else if (strcasecmp(av[0], "END") == 0) {
01564         if (!has_globopsmod) {
01565             send_cmd(NULL,
01566                      "ERROR :m_globops is not loaded. This is required by Anope");
01567             quitmsg = "Remote server does not have the m_globops module loaded, and this is required.";
01568             quitting = 1;
01569             return MOD_STOP;
01570         }
01571         if (!has_servicesmod) {
01572             send_cmd(NULL,
01573                      "ERROR :m_services is not loaded. This is required by Anope");
01574             quitmsg = "Remote server does not have the m_services module loaded, and this is required.";
01575             quitting = 1;
01576             return MOD_STOP;
01577         }
01578         if (!has_svsholdmod) {
01579             anope_cmd_global(s_OperServ, "SVSHOLD missing, Usage disabled until module is loaded.");
01580         }
01581         if (!has_chghostmod) {
01582             anope_cmd_global(s_OperServ, "CHGHOST missing, Usage disabled until module is loaded.");
01583         }
01584         if (!has_chgidentmod) {
01585             anope_cmd_global(s_OperServ, "CHGIDENT missing, Usage disabled until module is loaded.");
01586         }
01587         if (has_messagefloodmod) {       
01588             cbmi = myCbmodeinfos;
01589             
01590             /* Find 'f' in myCbmodeinfos and add the relevant bits to myCbmodes and myCbmodeinfos
01591              * to enable +f support if found. This is needed because we're really not set up to
01592              * handle modular ircds which can have modes enabled/disabled as they please :( - mark
01593              */
01594             while ((cbmi->mode != 'f')) {
01595                 cbmi++;
01596             }
01597             if (cbmi) {
01598                 cbmi->getvalue = get_flood;
01599                 cbmi->csgetvalue = cs_get_flood;
01600                 
01601                 myCbmodes['f'].flag = CMODE_f;
01602                 myCbmodes['f'].flags = 0;
01603                 myCbmodes['f'].setvalue = set_flood;
01604                 myCbmodes['f'].cssetvalue = cs_set_flood;
01605                 
01606                 pmodule_ircd_cbmodeinfos(myCbmodeinfos);
01607                 pmodule_ircd_cbmodes(myCbmodes);
01608                 
01609                 ircd->fmode = 1;
01610             }
01611             else {
01612                 alog("Support for channelmode +f can not be enabled");
01613                 if (debug) {
01614                     alog("debug: 'f' missing from myCbmodeinfos");
01615                 }
01616             }
01617         }
01618         if (has_banexceptionmod) {
01619             myCmmodes['e'].addmask = add_exception;
01620             myCmmodes['e'].delmask = del_exception;
01621             ircd->except = 1;
01622         }
01623         if (has_inviteexceptionmod) {
01624             myCmmodes['I'].addmask = add_invite;
01625             myCmmodes['I'].delmask = del_invite;
01626             ircd->invitemode = 1;
01627         }
01628         ircd->svshold = has_svsholdmod;
01629 
01630         if (has_banexceptionmod || has_inviteexceptionmod) {
01631             pmodule_ircd_cmmodes(myCmmodes);
01632         }
01633         
01634         /* Generate a fake capabs parsing call so things like NOQUIT work
01635          * fine. It's ugly, but it works....
01636          */
01637         argc = 6;
01638         argv = scalloc(argc, sizeof(char *));
01639         argv[0] = "NOQUIT";
01640         argv[1] = "SSJ3";
01641         argv[2] = "NICK2";
01642         argv[3] = "VL";
01643         argv[4] = "TLKEXT";
01644         argv[5] = "UNCONNECT";
01645 
01646         capab_parse(argc, argv);
01647     }
01648     return MOD_CONT;
01649 }
01650 
01651 /* SVSHOLD - set */
01652 void inspircd_cmd_svshold(char *nick)
01653 {
01654         send_cmd(s_OperServ, "SVSHOLD %s %ds :%s", nick, NSReleaseTimeout,
01655              "Being held for registered user");
01656 }
01657 
01658 /* SVSHOLD - release */
01659 void inspircd_cmd_release_svshold(char *nick)
01660 {
01661         send_cmd(s_OperServ, "SVSHOLD %s", nick);
01662 }
01663 
01664 /* UNSGLINE */
01665 void inspircd_cmd_unsgline(char *mask)
01666 {
01667     /* Not Supported by this IRCD */
01668 }
01669 
01670 /* UNSZLINE */
01671 void inspircd_cmd_unszline(char *mask)
01672 {
01673     send_cmd(s_OperServ, "ZLINE %s", mask);
01674 }
01675 
01676 /* SZLINE */
01677 void inspircd_cmd_szline(char *mask, char *reason, char *whom)
01678 {
01679     send_cmd(ServerName, "ADDLINE Z %s %s %ld 0 :%s", mask, whom,
01680              (long int) time(NULL), reason);
01681 }
01682 
01683 /* SGLINE */
01684 void inspircd_cmd_sgline(char *mask, char *reason)
01685 {
01686     /* Not Supported by this IRCD */
01687 }
01688 
01689 void inspircd_cmd_unban(char *name, char *nick)
01690 {
01691     /* Not Supported by this IRCD */
01692 }
01693 
01694 /* SVSMODE channel modes */
01695 
01696 void inspircd_cmd_svsmode_chan(char *name, char *mode, char *nick)
01697 {
01698     /* Not Supported by this IRCD */
01699 }
01700 
01701 
01702 /* SVSMODE +d */
01703 /* sent if svid is something weird */
01704 void inspircd_cmd_svid_umode(char *nick, time_t ts)
01705 {
01706     if (debug)
01707         alog("debug: common_svsmode(0)");
01708 }
01709 
01710 /* SVSMODE +d */
01711 /* nc_change was = 1, and there is no na->status */
01712 void inspircd_cmd_nc_change(User * u)
01713 {
01714     if (debug)
01715         alog("debug: common_svsmode(1)");
01716     common_svsmode(u, "-r", NULL);
01717 }
01718 
01719 /* SVSMODE +r */
01720 void inspircd_cmd_svid_umode2(User * u, char *ts)
01721 {
01722     if (debug)
01723         alog("debug: common_svsmode(2)");
01724     common_svsmode(u, "+r", NULL);
01725 }
01726 
01727 void inspircd_cmd_svid_umode3(User * u, char *ts)
01728 {
01729     /* not used */
01730 }
01731 
01732 void inspircd_cmd_svsjoin(char *source, char *nick, char *chan, char *param)
01733 {
01734         send_cmd(source, "SVSJOIN %s %s", nick, chan);
01735 }
01736 
01737 void inspircd_cmd_svspart(char *source, char *nick, char *chan)
01738 {
01739         send_cmd(source, "SVSPART %s %s", nick, chan);
01740 }
01741 
01742 void inspircd_cmd_swhois(char *source, char *who, char *mask)
01743 {
01744         /* Not used currently */
01745 }
01746 
01747 void inspircd_cmd_eob()
01748 {
01749     send_cmd(NULL, "ENDBURST");
01750 }
01751 
01752 
01753 int anope_event_rehash(char *source, int ac, char **av)
01754 {
01755     return MOD_CONT;
01756 }
01757 
01758 int anope_event_credits(char *source, int ac, char **av)
01759 {
01760     return MOD_CONT;
01761 }
01762 
01763 int anope_event_admin(char *source, int ac, char **av)
01764 {
01765     return MOD_CONT;
01766 }
01767 
01768 int inspircd_flood_mode_check(char *value)
01769 {
01770     char *dp, *end;
01771 
01772     if (value && *value != ':'
01773         && (strtoul((*value == '*' ? value + 1 : value), &dp, 10) > 0)
01774         && (*dp == ':') && (*(++dp) != 0) && (strtoul(dp, &end, 10) > 0)
01775         && (*end == 0)) {
01776         return 1;
01777     } else {
01778         return 0;
01779     }
01780 }
01781 
01782 void inspircd_cmd_jupe(char *jserver, char *who, char *reason)
01783 {
01784     char rbuf[256];
01785 
01786     snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who,
01787              reason ? ": " : "", reason ? reason : "");
01788 
01789     if (findserver(servlist, jserver))
01790         inspircd_cmd_squit(jserver, rbuf);
01791     inspircd_cmd_server(jserver, 1, rbuf);
01792     new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL);
01793 }
01794 
01795 /* GLOBOPS - to handle old WALLOPS */
01796 void inspircd_cmd_global_legacy(char *source, char *fmt)
01797 {
01798     send_cmd(source ? source : s_OperServ, "GLOBOPS :%s", fmt);
01799 }
01800 
01801 int inspircd_valid_nick(char *nick)
01802 {
01803     return 1;
01804 }
01805 
01806 int inspircd_valid_chan(char *chan)
01807 {
01808     return 1;
01809 }
01810 
01811 
01812 void inspircd_cmd_ctcp(char *source, char *dest, char *buf)
01813 {
01814     char *s;
01815 
01816     if (!buf) {
01817         return;
01818     } else {
01819         s = normalizeBuffer(buf);
01820     }
01821 
01822     send_cmd(source, "NOTICE %s :\1%s\1", dest, s);
01823     free(s);
01824 }
01825 
01826 
01827 int inspircd_jointhrottle_mode_check(char *value)
01828 {
01829     char *tempValue, *one, *two;
01830     int param1 = 0;
01831     int param2 = 0;
01832 
01833     if (!value)
01834         return 0;
01835 
01836     tempValue = sstrdup(value);
01837     one = strtok(tempValue, ":");
01838     two = strtok(NULL, "");
01839     if (one && two) {
01840         param1 = atoi(one);
01841         param2 = atoi(two);
01842     }
01843     if ((param1 >= 1) && (param1 <= 255) && (param2 >= 1) && (param2 <= 999))
01844         return 1;
01845     return 0;
01846 }
01847 
01848 
01853 void moduleAddAnopeCmds()
01854 {
01855     pmodule_cmd_svsnoop(inspircd_cmd_svsnoop);
01856     pmodule_cmd_remove_akill(inspircd_cmd_remove_akill);
01857     pmodule_cmd_topic(inspircd_cmd_topic);
01858     pmodule_cmd_vhost_off(inspircd_cmd_vhost_off);
01859     pmodule_cmd_akill(inspircd_cmd_akill);
01860     pmodule_cmd_svskill(inspircd_cmd_svskill);
01861     pmodule_cmd_svsmode(inspircd_cmd_svsmode);
01862     pmodule_cmd_372(inspircd_cmd_372);
01863     pmodule_cmd_372_error(inspircd_cmd_372_error);
01864     pmodule_cmd_375(inspircd_cmd_375);
01865     pmodule_cmd_376(inspircd_cmd_376);
01866     pmodule_cmd_nick(inspircd_cmd_nick);
01867     pmodule_cmd_guest_nick(inspircd_cmd_guest_nick);
01868     pmodule_cmd_mode(inspircd_cmd_mode);
01869     pmodule_cmd_bot_nick(inspircd_cmd_bot_nick);
01870     pmodule_cmd_kick(inspircd_cmd_kick);
01871     pmodule_cmd_notice_ops(inspircd_cmd_notice_ops);
01872     pmodule_cmd_notice(inspircd_cmd_notice);
01873     pmodule_cmd_notice2(inspircd_cmd_notice2);
01874     pmodule_cmd_privmsg(inspircd_cmd_privmsg);
01875     pmodule_cmd_privmsg2(inspircd_cmd_privmsg2);
01876     pmodule_cmd_serv_notice(inspircd_cmd_serv_notice);
01877     pmodule_cmd_serv_privmsg(inspircd_cmd_serv_privmsg);
01878     pmodule_cmd_bot_chan_mode(inspircd_cmd_bot_chan_mode);
01879     pmodule_cmd_351(inspircd_cmd_351);
01880     pmodule_cmd_quit(inspircd_cmd_quit);
01881     pmodule_cmd_pong(inspircd_cmd_pong);
01882     pmodule_cmd_join(inspircd_cmd_join);
01883     pmodule_cmd_unsqline(inspircd_cmd_unsqline);
01884     pmodule_cmd_invite(inspircd_cmd_invite);
01885     pmodule_cmd_part(inspircd_cmd_part);
01886     pmodule_cmd_391(inspircd_cmd_391);
01887     pmodule_cmd_250(inspircd_cmd_250);
01888     pmodule_cmd_307(inspircd_cmd_307);
01889     pmodule_cmd_311(inspircd_cmd_311);
01890     pmodule_cmd_312(inspircd_cmd_312);
01891     pmodule_cmd_317(inspircd_cmd_317);
01892     pmodule_cmd_219(inspircd_cmd_219);
01893     pmodule_cmd_401(inspircd_cmd_401);
01894     pmodule_cmd_318(inspircd_cmd_318);
01895     pmodule_cmd_242(inspircd_cmd_242);
01896     pmodule_cmd_243(inspircd_cmd_243);
01897     pmodule_cmd_211(inspircd_cmd_211);
01898     pmodule_cmd_global(inspircd_cmd_global);
01899     pmodule_cmd_global_legacy(inspircd_cmd_global_legacy);
01900     pmodule_cmd_sqline(inspircd_cmd_sqline);
01901     pmodule_cmd_squit(inspircd_cmd_squit);
01902     pmodule_cmd_svso(inspircd_cmd_svso);
01903     pmodule_cmd_chg_nick(inspircd_cmd_chg_nick);
01904     pmodule_cmd_svsnick(inspircd_cmd_svsnick);
01905     pmodule_cmd_vhost_on(inspircd_cmd_vhost_on);
01906     pmodule_cmd_connect(inspircd_cmd_connect);
01907     pmodule_cmd_bob(inspircd_cmd_bob);
01908     pmodule_cmd_svshold(inspircd_cmd_svshold);
01909     pmodule_cmd_release_svshold(inspircd_cmd_release_svshold);
01910     pmodule_cmd_unsgline(inspircd_cmd_unsqline);
01911     pmodule_cmd_unszline(inspircd_cmd_unszline);
01912     pmodule_cmd_szline(inspircd_cmd_szline);
01913     pmodule_cmd_sgline(inspircd_cmd_sgline);
01914     pmodule_cmd_unban(inspircd_cmd_unban);
01915     pmodule_cmd_svsmode_chan(inspircd_cmd_svsmode_chan);
01916     pmodule_cmd_svid_umode(inspircd_cmd_svid_umode);
01917     pmodule_cmd_nc_change(inspircd_cmd_nc_change);
01918     pmodule_cmd_svid_umode2(inspircd_cmd_svid_umode2);
01919     pmodule_cmd_svid_umode3(inspircd_cmd_svid_umode3);
01920     pmodule_cmd_svsjoin(inspircd_cmd_svsjoin);
01921     pmodule_cmd_svspart(inspircd_cmd_svspart);
01922     pmodule_cmd_swhois(inspircd_cmd_swhois);
01923     pmodule_cmd_eob(inspircd_cmd_eob);
01924     pmodule_flood_mode_check(inspircd_flood_mode_check);
01925     pmodule_cmd_jupe(inspircd_cmd_jupe);
01926     pmodule_valid_nick(inspircd_valid_nick);
01927     pmodule_valid_chan(inspircd_valid_chan);
01928     pmodule_cmd_ctcp(inspircd_cmd_ctcp);
01929     pmodule_set_umode(inspircd_set_umode);
01930     pmodule_jointhrottle_mode_check(inspircd_jointhrottle_mode_check);
01931 }
01932 
01936 int AnopeInit(int argc, char **argv)
01937 {
01938 
01939     moduleAddAuthor("Anope");
01940     moduleAddVersion
01941         (VERSION_STRING);
01942     moduleSetType(PROTOCOL);
01943 
01944     pmodule_ircd_version("inspircdIRCd 1.1");
01945     pmodule_ircd_cap(myIrcdcap);
01946     pmodule_ircd_var(myIrcd);
01947     pmodule_ircd_cbmodeinfos(myCbmodeinfos);
01948     pmodule_ircd_cumodes(myCumodes);
01949     pmodule_ircd_flood_mode_char_set("+f");
01950     pmodule_ircd_flood_mode_char_remove("-f");
01951     pmodule_ircd_cbmodes(myCbmodes);
01952     pmodule_ircd_cmmodes(myCmmodes);
01953     pmodule_ircd_csmodes(myCsmodes);
01954     pmodule_ircd_useTSMode(0);
01955 
01957     pmodule_invis_umode(UMODE_i);
01958     pmodule_oper_umode(UMODE_o);
01959     pmodule_invite_cmode(CMODE_i);
01960     pmodule_secret_cmode(CMODE_s);
01961     pmodule_private_cmode(CMODE_p);
01962     pmodule_key_mode(CMODE_k);
01963     pmodule_limit_mode(CMODE_l);
01964     pmodule_permchan_mode(0);
01965 
01966     moduleAddAnopeCmds();
01967     moduleAddIRCDMsgs();
01968 
01969     return MOD_CONT;
01970 }
01971