mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Chat: Unify chat hyperlink parsing (PR #22417)
- Validate most link properties all the time
- If enabled, also validate link text (needs locale)
- Instead of blocking the entire message, sanitize it
- Apply filtering to DND/AFK messages. Closes #22399
(cherry picked from commit f27284594b)
This commit is contained in:
@@ -68,40 +68,6 @@ Tokenizer::Tokenizer(const std::string &src, const char sep, uint32 vectorReserv
|
||||
}
|
||||
}
|
||||
|
||||
void stripLineInvisibleChars(std::string &str)
|
||||
{
|
||||
static std::string const invChars = " \t\7\n";
|
||||
|
||||
size_t wpos = 0;
|
||||
|
||||
bool space = false;
|
||||
for (size_t pos = 0; pos < str.size(); ++pos)
|
||||
{
|
||||
if (invChars.find(str[pos])!=std::string::npos)
|
||||
{
|
||||
if (!space)
|
||||
{
|
||||
str[wpos++] = ' ';
|
||||
space = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wpos!=pos)
|
||||
str[wpos++] = str[pos];
|
||||
else
|
||||
++wpos;
|
||||
space = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (wpos < str.size())
|
||||
str.erase(wpos, str.size());
|
||||
if (str.find("|TInterface")!=std::string::npos)
|
||||
str.clear();
|
||||
|
||||
}
|
||||
|
||||
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__))
|
||||
struct tm* localtime_r(time_t const* time, struct tm *result)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user