diff options
| author | Treeston <treeston.mmoc@gmail.com> | 2018-09-13 00:11:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-09-13 00:11:27 +0200 |
| commit | f27284594b18000a1c098262728fb19fdc63fc6c (patch) | |
| tree | 22f79a005f4167fa52a88fb72d025d3d806d60a8 /src/common | |
| parent | 7bcc83696fe2b9828f86a8fe3b4f63d4b51c8484 (diff) | |
[3.3.5] 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
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/Utilities/Util.cpp | 34 | ||||
| -rw-r--r-- | src/common/Utilities/Util.h | 2 | ||||
| -rw-r--r-- | src/common/Utilities/advstd.h | 3 |
3 files changed, 2 insertions, 37 deletions
diff --git a/src/common/Utilities/Util.cpp b/src/common/Utilities/Util.cpp index 9b9474d3b59..d42997d522e 100644 --- a/src/common/Utilities/Util.cpp +++ b/src/common/Utilities/Util.cpp @@ -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) { diff --git a/src/common/Utilities/Util.h b/src/common/Utilities/Util.h index 07c2803395a..549984f0e65 100644 --- a/src/common/Utilities/Util.h +++ b/src/common/Utilities/Util.h @@ -54,8 +54,6 @@ private: StorageType m_storage; }; -TC_COMMON_API void stripLineInvisibleChars(std::string &src); - TC_COMMON_API int32 MoneyStringToMoney(std::string const& moneyString); TC_COMMON_API struct tm* localtime_r(time_t const* time, struct tm *result); diff --git a/src/common/Utilities/advstd.h b/src/common/Utilities/advstd.h index ce32e14c335..de925225254 100644 --- a/src/common/Utilities/advstd.h +++ b/src/common/Utilities/advstd.h @@ -24,7 +24,8 @@ #include <utility> // this namespace holds implementations of upcoming stdlib features that our c++ version doesn't have yet -namespace advstd { +namespace advstd +{ // C++17 std::apply (constrained to only function pointers, not all callable) template <typename... Ts> using apply_tuple_type = std::tuple<std::remove_cv_t<std::remove_reference_t<Ts>>...>; |
