diff options
| author | 2024-08-27 14:29:56 +0100 | |
|---|---|---|
| committer | 2024-08-27 14:29:56 +0100 | |
| commit | e6ea9f7d4a4bf015524749da6ffeecf1d15c9268 (patch) | |
| tree | 1a46e36ddd8c5bedc35a1fddd37c3c169714cbdf /src | |
| parent | Fix a minor doxygen warning. (diff) | |
Change InspIRCd::ProcessColors to take a string instead of a vector.
This is more useful for how MOTDs are processed now as we iterate
through them anyway and this allows us to avoid a needless second
iteration.
Diffstat (limited to 'src')
| -rw-r--r-- | src/coremods/core_info/core_info.cpp | 2 | ||||
| -rw-r--r-- | src/helperfuncs.cpp | 7 | ||||
| -rw-r--r-- | src/modules/m_opermotd.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_showfile.cpp | 2 |
4 files changed, 9 insertions, 4 deletions
diff --git a/src/coremods/core_info/core_info.cpp b/src/coremods/core_info/core_info.cpp index 82c42dc78..6ffe9ade6 100644 --- a/src/coremods/core_info/core_info.cpp +++ b/src/coremods/core_info/core_info.cpp @@ -153,9 +153,9 @@ public: // Some clients can not handle receiving RPL_MOTD with an empty // trailing parameter so if a line is empty we replace it with // a single space. + InspIRCd::ProcessColors(line); newmotd.push_back(line.empty() ? " " : line); } - InspIRCd::ProcessColors(newmotd); } cmdmotd.motds.swap(newmotds); diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index bd8f4a231..5ebb6e44d 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -121,6 +121,12 @@ void InspIRCd::StripColor(std::string& sentence) void InspIRCd::ProcessColors(std::vector<std::string>& input) { + for (auto& line : input) + ProcessColors(line); +} + +void InspIRCd::ProcessColors(std::string& ret) +{ /* * Replace all color codes from the special[] array to actual * color code chars using C++ style escape sequences. You @@ -148,7 +154,6 @@ void InspIRCd::ProcessColors(std::vector<std::string>& input) special_chars("", "") }; - for (auto& ret : input) { for(int i = 0; !special[i].character.empty(); ++i) { diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index 284043f4e..91453106a 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -118,9 +118,9 @@ private: // 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. + InspIRCd::ProcessColors(line); newmotd.push_back(line.empty() ? " " : line); } - InspIRCd::ProcessColors(newmotd); } public: diff --git a/src/modules/m_showfile.cpp b/src/modules/m_showfile.cpp index 82cb7abe0..38d164547 100644 --- a/src/modules/m_showfile.cpp +++ b/src/modules/m_showfile.cpp @@ -103,9 +103,9 @@ public: // 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. + InspIRCd::ProcessColors(line); contents.push_back(line.empty() ? " " : line); } - InspIRCd::ProcessColors(contents); contents.shrink_to_fit(); } }; |
