From f4472dd6dcdfbb5d4a2a50ddc615644c3b2c8145 Mon Sep 17 00:00:00 2001 From: danieldg Date: Thu, 3 Sep 2009 02:30:12 +0000 Subject: Change cmd_*.so to use the Module object API Create Module* objects for each command, and load them like modules. This unifies the external API for modules. Library directory is now deprecated: all modules are located in a single module directory. Header files for each command are no longer needed; remove. This also fixes two potential segfaults in m_spanningtree. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11668 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/modules.cpp') diff --git a/src/modules.cpp b/src/modules.cpp index f0ff37726..cec146f76 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -580,6 +580,32 @@ void ModuleManager::LoadAll() char configToken[MAXBUF]; ModCount = -1; + printf("\nLoading core commands"); + fflush(stdout); + + DIR* library = opendir(Instance->Config->ModPath.c_str()); + if (library) + { + dirent* entry = NULL; + while (0 != (entry = readdir(library))) + { + if (InspIRCd::Match(entry->d_name, "cmd_*.so", ascii_case_insensitive_map)) + { + printf("."); + fflush(stdout); + + if (!Load(entry->d_name)) + { + Instance->Logs->Log("MODULE", DEFAULT, this->LastError()); + printf_c("\n[\033[1;31m*\033[0m] %s\n\n", this->LastError().c_str()); + Instance->Exit(EXIT_STATUS_MODULE); + } + } + } + closedir(library); + printf("\n"); + } + for(int count = 0; count < Instance->Config->ConfValueEnum("module"); count++) { Instance->Config->ConfValue("module", "name", count, configToken, MAXBUF); -- cgit v1.2.3