From 165556c8ddf4d3a036d6d89e680e208d2b435866 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 11 Feb 2014 23:57:17 +0300 Subject: improve autocomplete sanitization. --- src/utils/stringutils.cpp | 6 ++++++ src/utils/stringutils.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'src/utils') diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 8e657bb93..224c2a8e8 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -721,3 +721,9 @@ bool isDigit(const std::string &str) } return true; } + +void secureChatCommand(std::string &str) +{ + if (str[0] == '/' || str[0] == '@' || str[0] == '#') + str = "_" + str; +} diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h index 02b1aa031..4a73b3e58 100644 --- a/src/utils/stringutils.h +++ b/src/utils/stringutils.h @@ -236,4 +236,6 @@ std::string decodeLinkText(std::string data); bool isDigit(const std::string &str); +void secureChatCommand(std::string &str); + #endif // UTILS_STRINGUTILS_H -- cgit v1.2.3-70-g09d2