diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-11-02 18:11:22 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-11-02 18:11:22 +0000 |
commit | 1929d75f96872ca498203aee6ab2e6804e6ae622 (patch) | |
tree | 42a67f1cd3eeec95c7ea63aa72871ae7bed33fd9 | |
parent | 35211d4c3e3db8419c831e450ad463a8542ac117 (diff) |
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
-rw-r--r-- | src/inspircd.cpp | 15 |
1 files 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]; |