From: brain Date: Thu, 2 Nov 2006 18:11:22 +0000 (+0000) Subject: This is tidier, we dont need a seperate bool and int X-Git-Tag: v2.0.23~6748 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=1929d75f96872ca498203aee6ab2e6804e6ae622;p=user%2Fhenk%2Fcode%2Finspircd.git 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 --- 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];