/** * Create the command, and tell Denora about it. * @param argc Argument count * @param argv Argument list * @return MOD_CONT to allow the module, MOD_STOP to stop it **/ int DenoraInit(int argc, char **argv) { HTMLTag *h; int status; if (denora->debug >= 2) { protocol_debug(NULL, argc, argv); } moduleAddAuthor("Denora"); moduleAddVersion ("$Id$"); moduleSetType(CORE); h = createHTMLtag("!CLIENTSTATS!", html_ctcp_table); status = addHTMLTag(h); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for !CLIENTSTATS! [%d][%s]", status, ModuleGetErrStr(status)); } h = createHTMLtag("!TOP10CLIENTVERTITLE!", html_top10client_title); status = addHTMLTag(h); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for !TOP10CLIENTVERTITLE! [%d][%s]", status, ModuleGetErrStr(status)); } return MOD_CONT; }
void Win32LoadCoreDir(char *dirname) { #ifdef USE_MODULES BOOL fFinished; HANDLE hList; TCHAR szDir[MAX_PATH + 1]; TCHAR szSubDir[MAX_PATH + 1]; WIN32_FIND_DATA FileData; char *mname = NULL; Module *m; int status; char buffer[_MAX_PATH]; /* Get the current working directory: */ if (_getcwd(buffer, _MAX_PATH) == NULL) { alog(LOG_DEBUG, "debug: Unable to set Current working directory"); } ircsnprintf(szDir, sizeof(szDir), "%s\\%s\\*", buffer, dirname); hList = FindFirstFile(szDir, &FileData); if (hList != INVALID_HANDLE_VALUE) { fFinished = FALSE; while (!fFinished) { if (!(FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { mname = sstrdup(FileData.cFileName); mname[strlen(FileData.cFileName) - 4] = '\0'; m = findModule(mname); if (!m) { m = createCoreModule(mname); mod_current_module = m; mod_current_user = NULL; alog(LOG_DEBUG, "trying to load [%s]", mod_current_module->name); status = loadCoreModule(mod_current_module, NULL); alog(LOG_DEBUG, langstr(ALOG_MOD_STATUS), status, ModuleGetErrStr(status)); if (status != MOD_ERR_OK) { destroyModule(m); } mod_current_module = NULL; mod_current_user = NULL; } dfree(mname); } if (!FindNextFile(hList, &FileData)) { if (GetLastError() == ERROR_NO_MORE_FILES) { fFinished = TRUE; } } } } else { printf("Invalid File Handle. GetLastError reports %d\n", GetLastError()); } FindClose(hList); #endif }
/** * Create the command, and tell Denora about it. * @param argc Argument count * @param argv Argument list * @return MOD_CONT to allow the module, MOD_STOP to stop it **/ int DenoraInit(int argc, char **argv) { Message *m; int status; if (denora->debug >= 2) { protocol_debug(NULL, argc, argv); } moduleAddAuthor("Denora"); moduleAddVersion ("$Id: event_motd.c 386 2011-01-04 17:16:43Z hal9000 $"); moduleSetType(CORE); m = createMessage("372", denora_event_372); status = moduleAddMessage(m, MOD_HEAD); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 372 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("375", denora_event_375); status = moduleAddMessage(m, MOD_HEAD); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 375 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("376", denora_event_376); status = moduleAddMessage(m, MOD_HEAD); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 376 [%d][%s]", status, ModuleGetErrStr(status)); } return MOD_CONT; }
/** * Add Internal Messages that are not wired to any ircd * * @return void - no returend value * */ void moduleAddMsgs(void) { Message *m; int status; m = createMessage("STATS", m_stats); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for STATS [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("TIME", m_time); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for TIME [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("VERSION", m_version); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for VERSION [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("005", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 005 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("020", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 020 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("105", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 105 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("216", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 216 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("217", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 217 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("219", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 219 [%d][%s]", status, ModuleGetErrStr(status)); } /* /stats k */ m = createMessage("223", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 223 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("244", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 244 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("249", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 249 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("250", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 250 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("263", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 263 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("304", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 304 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("401", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 401 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("402", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 402 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("422", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 422 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("451", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 451 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("461", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 461 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("481", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 481 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("482", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 482 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("503", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 503 [%d][%s]", status, ModuleGetErrStr(status)); } /* Ithildin Adds some replies */ m = createMessage("771", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 771 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("773", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 773 [%d][%s]", status, ModuleGetErrStr(status)); } m = createMessage("774", denora_event_null); status = addCoreMessage(IRCD, m); if (status != MOD_ERR_OK) { alog(LOG_NORMAL, "Error Occurried setting message for 774 [%d][%s]", status, ModuleGetErrStr(status)); } }
int DenoraInit(int argc, char **argv) { EvtHook *hook = NULL; int status; hook = createEventHook(EVENT_CTCP_VERSION, my_version); status = moduleAddEventHook(hook); if (status != MOD_ERR_OK) { /* something went wrong say something about */ alog(LOG_NORMAL, "[%s%s] unable to bind to EVENT_CTCP_VERSION error [%d][%s]", MYNAME, MODULE_EXT, status, ModuleGetErrStr(status)); return MOD_STOP; } moduleAddAuthor(AUTHOR); moduleAddVersion(VERSION); return MOD_CONT; }