diff options
| author | 2023-07-03 17:26:40 +0100 | |
|---|---|---|
| committer | 2023-07-03 18:43:58 +0100 | |
| commit | 386f0dafd55897723356c75299cd02ed0b882f5b (patch) | |
| tree | be31de75870a0e1da815cf5f4203fed793eb66ba /src/modules/m_opermotd.cpp | |
| parent | Fix a minor Doxygen comment issue. (diff) | |
Replace FileReader with something more sensible.
Diffstat (limited to 'src/modules/m_opermotd.cpp')
| -rw-r--r-- | src/modules/m_opermotd.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index 7a844d8cd..c61d979ff 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -25,7 +25,6 @@ #include "inspircd.h" -#include "fileutils.h" enum { @@ -104,23 +103,19 @@ private: if (motd.empty() || newmotds.find(motd) != newmotds.end()) return; - FileReader reader; - try - { - reader.Load(motd); - } - catch (const CoreException& ce) + auto file = ServerInstance->Config->ReadFile(motd); + if (!file) { // We can't process the file if it doesn't exist. ServerInstance->Logs.Normal(MODNAME, "Unable to read server operator motd for oper {} \"{}\" at {}: {}", - type, oper->GetName(), oper->GetConfig()->source.str(), ce.GetReason()); + type, oper->GetName(), oper->GetConfig()->source.str(), file.error); return; } // Process the MOTD entry. auto& newmotd = newmotds[motd]; - newmotd.reserve(reader.GetVector().size()); - for (const auto& line : reader.GetVector()) + irc::sepstream linestream(file.contents, '\n'); + for (std::string line; linestream.GetToken(line); ) { // Some clients can not handle receiving RPL_OMOTD with an empty // trailing parameter so if a line is empty we replace it with |
