summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-11-11 19:21:19 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-11-11 19:21:19 +0000
commit621f93b72ffdae4e211949c9fad778327c2a31fa (patch)
tree437fa52b2bb4445f6e1a401af1501b76a0448f70
parent81951dafc1f89ce4b52275a8b0c2a7eca9643fe5 (diff)
More stuff
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8574 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/modules.h2
-rw-r--r--src/configreader.cpp14
-rw-r--r--src/modules.cpp2
3 files changed, 12 insertions, 6 deletions
diff --git a/include/modules.h b/include/modules.h
index a3cac1486..11d194cd8 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -438,7 +438,7 @@ class CoreExport Module : public Extensible
virtual void OnReadConfig(ServerConfig* config, ConfigReader* coreconf);
- virtual int OnDownloadFile(const std::string &filename, std::stringstream &filedata);
+ virtual int OnDownloadFile(const std::string &filename, std::istringstream* &filedata);
/** Returns the version number of a Module.
* The method should return a Version object with its version information assigned via
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 13ef5ddad..ec5f1fe54 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -1296,10 +1296,16 @@ void ServerConfig::StartDownloads()
ServerInstance->Log(DEBUG,"Module-handled schema for %s", x->first.c_str());
/* For now, error it */
- FileErrors++;
- TotalDownloaded++;
- delete x->second;
- x->second = NULL;
+ int MOD_RESULT = 0;
+ FOREACH_RESULT(I_OnDownloadFile, OnDownloadFile(file, reinterpret_cast<std::istringstream*>(x->second)));
+ if (MOD_RESULT == 0)
+ {
+ /* No module claimed this file */
+ TotalDownloaded++;
+ FileErrors++;
+ delete x->second;
+ x->second = NULL;
+ }
}
}
}
diff --git a/src/modules.cpp b/src/modules.cpp
index d04b0e243..373f1c7b8 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -107,7 +107,7 @@ std::string Event::GetEventID()
Module::Module(InspIRCd* Me) : ServerInstance(Me) { }
Module::~Module() { }
void Module::OnReadConfig(ServerConfig*, ConfigReader*) { }
-int Module::OnDownloadFile(const std::string&, std::stringstream&) { return 0; }
+int Module::OnDownloadFile(const std::string&, std::istringstream*&) { return 0; }
void Module::OnUserConnect(User*) { }
void Module::OnUserQuit(User*, const std::string&, const std::string&) { }
void Module::OnUserDisconnect(User*) { }