summaryrefslogtreecommitdiff
path: root/src/modules/m_opermotd.cpp
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2013-05-17 05:46:51 +0100
committerattilamolnar <attilamolnar@hush.com>2013-05-27 00:15:30 +0200
commit244a65e8556328642350575c4a94ee8fc1b676b4 (patch)
tree97bf4ff8cf2621a28041a719bd8d766f44014c5b /src/modules/m_opermotd.cpp
parentee641f3f229143940fbe359ac98863edfdf249ce (diff)
Clean up the FileReader class and all of the modules that use it.
- Modules which use this class will now have to catch a CoreException when opening files if they wish to ignore the failed loading of a file. - m_randquote has been cleaned up massively and the RANDQUOTE command has been removed as it was pretty much useless.
Diffstat (limited to 'src/modules/m_opermotd.cpp')
-rw-r--r--src/modules/m_opermotd.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp
index b228dc8b7..aa5767b4c 100644
--- a/src/modules/m_opermotd.cpp
+++ b/src/modules/m_opermotd.cpp
@@ -107,9 +107,15 @@ class ModuleOpermotd : public Module
ConfigTag* conf = ServerInstance->Config->ConfValue("opermotd");
onoper = conf->getBool("onoper", true);
- FileReader f(conf->getString("file", "opermotd"));
- for (int i=0, filesize = f.FileSize(); i < filesize; i++)
- cmd.opermotd.push_back(f.GetLine(i));
+ try
+ {
+ FileReader reader(conf->getString("file", "opermotd"));
+ cmd.opermotd = reader.GetVector();
+ }
+ catch (CoreException&)
+ {
+ // Nothing happens here as we do the error handling in ShowOperMOTD.
+ }
if (conf->getBool("processcolors"))
InspIRCd::ProcessColors(cmd.opermotd);