From 1929d75f96872ca498203aee6ab2e6804e6ae622 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 2 Nov 2006 18:11:22 +0000 Subject: [PATCH] This is tidier, we dont need a seperate bool and int git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5628 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 916812357..7f261f079 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -537,26 +537,33 @@ bool InspIRCd::UnloadModule(const char* filename) bool InspIRCd::LoadModule(const char* filename) { + /* Do we have a glob pattern in the filename? + * The user wants to load multiple modules which + * match the pattern. + */ if (strchr(filename,'*') || (strchr(filename,'?'))) { - bool all_success = true; int n_match = 0; DIR* library = opendir(Config->ModPath); if (library) { + /* Try and locate and load all modules matching the pattern */ dirent* entry = NULL; while ((entry = readdir(library))) { if (this->MatchText(entry->d_name, filename)) { - n_match++; if (!this->LoadModule(entry->d_name)) - all_success = false; + n_match++; } } closedir(library); } - return (all_success && n_match); + /* Loadmodule will now return false if any one of the modules failed + * to load (but wont abort when it encounters a bad one) and when 1 or + * more modules were actually loaded. + */ + return (n_match > 0); } char modfile[MAXBUF]; -- 2.39.5