From 9b2c5d67f7f00eed319116d99895510e5d5c922e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 3 Jun 2024 14:32:00 +0300 Subject: =?UTF-8?q?fixes=20#4447=20(ICQ:=20=D0=BD=D0=B5=D0=BA=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D1=8B=D0=B5=20=D0=BA=D0=B0=D1=80=D1=82=D0=B8=D0=BD?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=BD=D0=B5=20=D0=B3=D1=80=D1=83=D0=B7=D1=8F?= =?UTF-8?q?=D1=82=D1=81=D1=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/ICQ-WIM/src/server.cpp | 14 ++++---------- protocols/ICQ-WIM/src/utils.cpp | 13 +++++++++---- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index 54a1d7d52e..c2ef85ff90 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -175,14 +175,8 @@ IcqFileInfo *CIcqProto::RetrieveFileInfo(MCONTACT hContact, const CMStringW &wsz bool CIcqProto::CheckFile(MCONTACT hContact, CMStringW &wszText, IcqFileInfo *&pFileInfo) { - bool bRet; CMStringW wszUrl; - int idx = wszText.Find(' '); - if (idx == -1) - bRet = fileText2url(wszText, &wszUrl); - else - bRet = fileText2url(wszText.Mid(0, idx), &wszUrl); - if (!bRet) + if (!fileText2url(wszText, &wszUrl)) return false; pFileInfo = nullptr; @@ -192,9 +186,9 @@ bool CIcqProto::CheckFile(MCONTACT hContact, CMStringW &wszText, IcqFileInfo *&p if (!pFileInfo) return false; - if (idx != -1) { - pFileInfo->szOrigUrl = wszText.Mid(0, idx); - wszText.Delete(0, idx + 1); + if (wszUrl != wszText) { + pFileInfo->szOrigUrl = wszUrl; + wszText.Delete(0, wszUrl.GetLength() + 1); } else { pFileInfo->szOrigUrl = wszText; diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp index e11b1bb17c..2c36c3fb86 100644 --- a/protocols/ICQ-WIM/src/utils.cpp +++ b/protocols/ICQ-WIM/src/utils.cpp @@ -271,16 +271,21 @@ bool fileText2url(const CMStringW &wszText, CMStringW *res) if (!mir_wstrncmp(wszText, L"https://files.icq.net/get/", 26)) { if (res) *res = wszText.Mid(26); - return true; } - - if (!mir_wstrncmp(wszText, L"http://files.icq.net/get/", 25)) { + else if (!mir_wstrncmp(wszText, L"http://files.icq.net/get/", 25)) { if (res) *res = wszText.Mid(25); return true; } + else return false; + + if (res) { + int idx = res->FindOneOf(L" \r\n\t"); + if (idx != -1) + *res = res->Mid(0, idx); + } - return false; + return true; } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3