From 30516cfd877bf99f56ef43a7fe50ff8154f703b8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 2 Nov 2023 16:25:16 +0300 Subject: =?UTF-8?q?fixes=20#3596=20(ICQ:=20"Copy=20URL"=20=D0=B2=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BD=D1=82=D0=B5=D0=BA=D1=81=D1=82=D0=BD=D0=BE=D0=BC=20?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=8E=20=D0=B6=D1=83=D1=80=D0=BD=D0=B0=D0=BB?= =?UTF-8?q?=D0=B0/=D0=B8=D1=81=D1=82=D0=BE=D1=80=D0=B8=D0=B8=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BE=D1=84=D1=84=D0=BB=D0=B0=D0=B9=D0=BD=20=D1=84?= =?UTF-8?q?=D0=B0=D0=B9=D0=BB=D0=B5=20=D0=BE=D1=82=D0=B4=D0=B0=D0=B5=D1=82?= =?UTF-8?q?=20=D0=B1=D0=B5=D1=81=D1=81=D0=BC=D1=8B=D1=81=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=BD=D1=83=D1=8E=20=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D1=83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/ICQ-WIM/src/proto.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'protocols/ICQ-WIM/src/proto.cpp') diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp index 93664a6ed3..aec09ffb55 100644 --- a/protocols/ICQ-WIM/src/proto.cpp +++ b/protocols/ICQ-WIM/src/proto.cpp @@ -231,19 +231,23 @@ void __cdecl CIcqProto::OfflineFileThread(void *pParam) auto *ofd = (OFDTHREAD *)pParam; DB::EventInfo dbei(ofd->hDbEvent); - if (dbei && !strcmp(dbei.szModule, m_szModuleName) && dbei.eventType == EVENTTYPE_FILE) { - JSONNode root = JSONNode::parse((const char *)dbei.pBlob); - if (m_bOnline && root) { - MCONTACT hContact = db_event_getContact(ofd->hDbEvent); - if (auto *pFileInfo = RetrieveFileInfo(hContact, fileText2url(root["u"].as_mstring()))) { + if (m_bOnline && dbei && !strcmp(dbei.szModule, m_szModuleName) && dbei.eventType == EVENTTYPE_FILE) { + DB::FILE_BLOB blob(dbei); + MCONTACT hContact = db_event_getContact(ofd->hDbEvent); + if (auto *pFileInfo = RetrieveFileInfo(hContact, fileText2url(blob.getUrl()))) { + if (!ofd->bCopy) { auto *pReq = new AsyncHttpRequest(CONN_NONE, REQUEST_GET, pFileInfo->szUrl, &CIcqProto::OnFileRecv); pReq->pUserInfo = ofd; pReq->AddHeader("Sec-Fetch-User", "?1"); pReq->AddHeader("Sec-Fetch-Site", "cross-site"); pReq->AddHeader("Sec-Fetch-Mode", "navigate"); Push(pReq); + return; // ofd is used inside CIcqProto::OnFileRecv, don't remove it } - return; + + ofd->wszPath.Empty(); + ofd->wszPath.Append(_A2T(pFileInfo->szUrl)); + ofd->pCallback->Invoke(*ofd); } } -- cgit v1.2.3