mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 10:39:02 -04:00
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.
This commit is contained in:
parent
8b02fef312
commit
e6ea9f7d4a
@ -422,8 +422,14 @@ public:
|
||||
/** Replaces color escapes in the specified lines with IRC colors.
|
||||
* @param lines A vector of lines to replace color escapes in.
|
||||
*/
|
||||
[[deprecated("Use ProcessColors(std::string) instead")]]
|
||||
static void ProcessColors(std::vector<std::string>& lines);
|
||||
|
||||
/** Replaces color escapes in the specified string with IRC colors.
|
||||
* @param lines The string replace color escapes in.
|
||||
*/
|
||||
static void ProcessColors(std::string& str);
|
||||
|
||||
/** Stores an incoming signal when received from the operating system.
|
||||
* @param signal The signal received from the operating system.
|
||||
*/
|
||||
|
@ -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);
|
||||
|
@ -120,6 +120,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
|
||||
@ -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)
|
||||
{
|
||||
|
@ -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:
|
||||
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user