/** * AnopeInit is called when the module is loaded * @param argc Argument count * @param argv Argument list * @return MOD_CONT to allow the module, MOD_STOP to stop it **/ int AnopeInit(int argc, char **argv) { Command *c; EvtHook *hook = NULL; int status; moduleAddAuthor(AUTHOR); moduleAddVersion(VERSION); alog("ns_qdbban: Loading configuration directives..."); if (mLoadConfig()) { return MOD_STOP; } c = createCommand("SASET", myAddQDBBan, is_services_oper, -1, -1, -1, -1, -1); status = moduleAddCommand(NICKSERV, c, MOD_HEAD); c = createCommand("QLIST", mQList, is_services_oper, -1, -1, -1, -1, -1); moduleAddOperHelp(c, nsHelpQList); moduleSetNickHelp(nsHelp); status = moduleAddCommand(NICKSERV, c, MOD_HEAD); /* Add the SASET command again for the purpose of adding stuff to /ns help saset calls doModCont as using NULL causes Anope to crash. This is due to a (possible) bug in 1.8.4. */ c = createCommand("SASET", doModCont, NULL, -1, -1, -1, -1, -1); moduleAddOperHelp(c, mMainSetHelp); status = moduleAddCommand(NICKSERV, c, MOD_TAIL); c = createCommand("SASET QDBBAN", NULL, NULL, -1, -1, -1, -1, -1); moduleAddOperHelp(c, mQDBBanHelp); moduleAddCommand(NICKSERV, c, MOD_HEAD); c = createCommand("INFO", myNickInfo, NULL, -1, -1, -1, -1, -1); status = moduleAddCommand(NICKSERV, c, MOD_TAIL); hook = createEventHook(EVENT_DB_SAVING, mSaveData); status = moduleAddEventHook(hook); hook = createEventHook(EVENT_DB_BACKUP, mBackupData); status = moduleAddEventHook(hook); hook = createEventHook(EVENT_RELOAD, mEventReload); status = moduleAddEventHook(hook); mLoadData(); m_AddLanguages(); return MOD_CONT; }
int AnopeInit(int argc, char **argv) /* This will be executed when the module is loaded */ { Command *c; /* Pointer to a Command */ int status = 0; /* the status of our new command */ c = createCommand("moo", hs_moo_show, NULL, -1, -1, -1, -1, -1); /* Create a new command "moo" pointing to hs_moo */ moduleAddHelp(c,myHostServMooHelp); /* add help for all users to this command */ moduleAddRegHelp(c,myHostServMooRegHelp); /* add extra regular-user only help to this command */ moduleAddOperHelp(c,myHostServMooOperHelp); /* add extra oper only help to this command */ moduleAddAdminHelp(c,myHostServMooAdminHelp); /* add extra admin only help to this command */ moduleAddRootHelp(c,myHostServMooRootHelp); /* add extra root only help to this command */ moduleSetHostHelp(myHostServHelp); /* add us to the .hs help list */ status = moduleAddCommand(HOSTSERV, c, MOD_HEAD); /* Add the command to the HOSTSERV cmd table */ /* Check if we have any argv's */ if(argc>0) { /* we do, the first will be the nick of the person modload'ing us */ /* or NULL if we were auto-loaded */ if(argv[0]) { alog("hs_moo was modloaded by: [%s]",argv[0]); } else { alog("hs_moo was automatically loaded by anope"); } } alog("hs_moo.so: Add Command 'moo' Status: %d",status); /* Log the command being added */ moduleAddCallback("test",time(NULL)+dotime("15s"),test,0,NULL); /* set a call-back function to exec in 3 mins time */ moduleDelCallback("test"); moduleAddAuthor(AUTHOR); /* tell Anope about the author */ moduleAddVersion(VERSION); /* Tell Anope about the verison */ if(status!=MOD_ERR_OK) { return MOD_STOP; } return MOD_CONT; }