From 5b70baa32617190d97f36e389c11140d389e093c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 6 Jun 2024 16:18:43 +0300 Subject: fixes #4449 (ICQ: broken cloud file download) --- protocols/ICQ-WIM/src/utils.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'protocols/ICQ-WIM/src/utils.cpp') diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp index 2c36c3fb86..460e20ff2f 100644 --- a/protocols/ICQ-WIM/src/utils.cpp +++ b/protocols/ICQ-WIM/src/utils.cpp @@ -266,26 +266,29 @@ void CIcqProto::setId(MCONTACT hContact, const char *szSetting, __int64 iValue) ///////////////////////////////////////////////////////////////////////////////////////// -bool fileText2url(const CMStringW &wszText, CMStringW *res) +int fileText2url(const CMStringW &wszText, CMStringW *res) { + int iStart = 0; if (!mir_wstrncmp(wszText, L"https://files.icq.net/get/", 26)) { if (res) - *res = wszText.Mid(26); + *res = wszText.Mid(iStart = 26); } else if (!mir_wstrncmp(wszText, L"http://files.icq.net/get/", 25)) { if (res) - *res = wszText.Mid(25); - return true; + *res = wszText.Mid(iStart = 25); } - else return false; + else return 0; if (res) { int idx = res->FindOneOf(L" \r\n\t"); - if (idx != -1) - *res = res->Mid(0, idx); + if (idx == -1) + return -1; + + *res = res->Mid(0, idx); + return iStart + idx; } - return true; + return 1; } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3