diff options
author | George Hazan <george.hazan@gmail.com> | 2024-08-22 14:37:03 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-08-22 14:37:03 +0300 |
commit | 906a9d5f75f282a1ddd683f29346041c8f73e511 (patch) | |
tree | 0d9b3b65d2713f75701a45dcc745988fb1945700 /protocols/SkypeWeb/src/skype_utils.cpp | |
parent | 434f6e8fe730fe039daaa14dfb5cb5a7c674f223 (diff) |
fixes #4592 (SkypeWeb: support status message)
Diffstat (limited to 'protocols/SkypeWeb/src/skype_utils.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_utils.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 78487e0850..2de2bc25d8 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -344,13 +344,30 @@ const HtmlEntity htmlEntities[] = { "zwnj", "\xE2\x80\x8C" }
};
+static void Utf32toUtf16(uint32_t c, CMStringW &dest)
+{
+ if (c < 0x10000)
+ dest.AppendChar(c);
+ else {
+ unsigned int t = c - 0x10000;
+ dest.AppendChar((((t << 12) >> 22) + 0xD800));
+ dest.AppendChar((((t << 22) >> 22) + 0xDC00));
+ }
+}
+
CMStringW RemoveHtml(const CMStringW &data)
{
+ bool inSS = false;
CMStringW new_string;
for (int i = 0; i < data.GetLength(); i++) {
wchar_t c = data[i];
if (c == '<') {
+ if (!wcsncmp(data.c_str() + i + 1, L"ss ", 3))
+ inSS = true;
+ else if (!wcsncmp(data.c_str() + i + 1, L"/ss>", 4))
+ inSS = false;
+
i = data.Find('>', i);
if (i == -1)
break;
@@ -423,6 +440,18 @@ CMStringW RemoveHtml(const CMStringW &data) }
}
+ if (c == '(' && inSS) {
+ uint32_t code = 0;
+ if (1 == swscanf(data.c_str() + i + 1, L"%x_", &code))
+ Utf32toUtf16(code, new_string);
+
+ int iEnd = data.Find(')', i);
+ if (iEnd != -1) {
+ i = iEnd;
+ continue;
+ }
+ }
+
new_string.AppendChar(c);
}
|