diff options
| author | 2022-12-09 11:31:11 +0000 | |
|---|---|---|
| committer | 2022-12-09 11:31:11 +0000 | |
| commit | 3e941f1cfbae54c83dd7558a3fea89cf80940605 (patch) | |
| tree | 03b2c1f22e63d3732a3b724c14e687929fd761f4 /src/modules | |
| parent | More const correctness work. (diff) | |
| parent | Fix reading the MOTD when <connect:motd> is a literal path. (diff) | |
Merge branch 'insp3' into master.
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/m_opermotd.cpp | 13 | ||||
| -rw-r--r-- | src/modules/m_showfile.cpp | 13 |
2 files changed, 22 insertions, 4 deletions
diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index 9d94d3e63..6066800fa 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -75,7 +75,7 @@ public: user->WriteRemoteNumeric(RPL_OMOTDSTART, "Server operators message of the day"); for (const auto& line : opermotd) - user->WriteRemoteNumeric(RPL_OMOTD, InspIRCd::Format(" %s", line.c_str())); + user->WriteRemoteNumeric(RPL_OMOTD, line); user->WriteRemoteNumeric(RPL_ENDOFOMOTD, "End of OPERMOTD"); } }; @@ -109,7 +109,16 @@ public: try { FileReader reader(conf->getString("file", "opermotd", 1)); - cmd.opermotd = reader.GetVector(); + + // Process the MOTD entry. + cmd.opermotd.reserve(reader.GetVector().size()); + for (const auto& line : reader.GetVector()) + { + // Some clients can not handle receiving RPL_OMOTD with an empty + // trailing parameter so if a line is empty we replace it with + // a single space. + cmd.opermotd.push_back(line.empty() ? " " : line); + } InspIRCd::ProcessColors(cmd.opermotd); } catch (const CoreException&) diff --git a/src/modules/m_showfile.cpp b/src/modules/m_showfile.cpp index d50a327d5..3eaae462f 100644 --- a/src/modules/m_showfile.cpp +++ b/src/modules/m_showfile.cpp @@ -62,7 +62,7 @@ public: user->WriteRemoteNumeric(intronumeric, introtext); for (const auto& line : contents) - user->WriteRemoteNumeric(textnumeric, InspIRCd::Format(" %s", line.c_str())); + user->WriteRemoteNumeric(textnumeric, line); if (!endtext.empty() && endnumeric) user->WriteRemoteNumeric(endnumeric, endtext.c_str()); @@ -94,7 +94,16 @@ public: else if (smethod == "notice") method = SF_NOTICE; - contents = filecontents; + // Process the entry. + contents.clear(); + contents.reserve(filecontents.size()); + for (const auto& line : filecontents) + { + // Some clients can not handle receiving NOTICE/PRIVMSG/RPL_RULES + // with an empty trailing parameter so if a line is empty we + // replace it with a single space. + contents.push_back(line.empty() ? " " : line); + } InspIRCd::ProcessColors(contents); } }; |
