summaryrefslogtreecommitdiff
path: root/protocols/ICQ-WIM/src/proto.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/ICQ-WIM/src/proto.cpp')
-rw-r--r--protocols/ICQ-WIM/src/proto.cpp16
1 files changed, 10 insertions, 6 deletions
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);
}
}