diff options
author | George Hazan <george.hazan@gmail.com> | 2025-01-28 14:43:19 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2025-01-28 14:43:23 +0300 |
commit | d59025c1713f29b0162b0449643ca1edab9173ff (patch) | |
tree | a5fd8522272c7e775b7f5db42e26eca5baa04975 | |
parent | 4910d64568153e9f869cd62372fc299ee0939698 (diff) |
Steam: support for stickers
-rw-r--r-- | protocols/Steam/src/steam_utils.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/protocols/Steam/src/steam_utils.cpp b/protocols/Steam/src/steam_utils.cpp index 15ccc7dd1a..7f1275add3 100644 --- a/protocols/Steam/src/steam_utils.cpp +++ b/protocols/Steam/src/steam_utils.cpp @@ -55,7 +55,7 @@ void DecodeBbcodes(SESSION_INFO *si, CMStringA &szText) CMStringA szReplace;
auto *p = szText.c_str() + idx;
- if (!strncmp(p, "emoticon", 8))
+ if (!strncmp(p, "emoticon", 8) || !strncmp(p, "sticker", 7))
szReplace = ":";
if (!isClosing) {
@@ -74,18 +74,31 @@ void DecodeBbcodes(SESSION_INFO *si, CMStringA &szText) else if (!strncmp(p, "lobbyinvite ", 12)) {
szReplace = TranslateU("You were invited to play a game");
}
+ else if (!strncmp(p, "sticker ", 8)) {
+ std::regex regex("type=\"(.+?)\"");
+ std::smatch match;
+ std::string content(p + 8);
+ if (std::regex_search(content, match, regex)) {
+ std::string szType = match[1];
+ szReplace += szType.c_str();
+ szReplace.Replace(" ", "_");
+ }
+ iEnd++;
+ }
else iEnd++;
}
else iEnd++, idx--;
idx--;
szText.Delete(idx, iEnd - idx);
+
if (!szReplace.IsEmpty()) {
if (bPlaceFirst)
szText = szReplace + szText;
else
szText.Insert(idx, szReplace);
}
+ iEnd -= iEnd - idx;
idx = iEnd;
}
}
|