summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/misc.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-01-10 12:11:16 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-01-10 12:11:16 +0300
commit730c132f369842cd219388905cf981c2e90f98b3 (patch)
treee347546e613854070cfd3da32eb0e2e8d30b3b91 /protocols/VKontakte/src/misc.cpp
parente688d75e8db7616d7e6d6fb3ed3c892e4fbe8a97 (diff)
code cleaning
Diffstat (limited to 'protocols/VKontakte/src/misc.cpp')
-rw-r--r--protocols/VKontakte/src/misc.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index 3f15bcac16..e76f8787d9 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -1465,21 +1465,17 @@ CMStringW CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport
CreateDirectoryTreeW(wszPath);
bool bSuccess = false;
- CMStringW wszFileName(FORMAT, L"%s\\[sticker-%d].png", wszPath.c_str(), iStickerId);
+ MFilePath wszFileName;
+ wszFileName.Format(L"%s\\[sticker-%d].png", wszPath.c_str(), iStickerId);
if (GetFileAttributesW(wszFileName) == INVALID_FILE_ATTRIBUTES) {
- T2Utf szUrl(wszUrl);
MHttpRequest req(REQUEST_GET);
req.flags = NLHRF_NODUMP | NLHRF_SSL | NLHRF_HTTP11 | NLHRF_REDIRECT;
- req.m_szUrl = szUrl.get();
+ req.m_szUrl = T2Utf(wszUrl).get();
- MHttpResponse *pReply = Netlib_HttpTransaction(m_hNetlibUser, &req);
- if (pReply != nullptr && pReply->resultCode == 200 && !pReply->body.IsEmpty()) {
+ NLHR_PTR pReply(Netlib_DownloadFile(m_hNetlibUser, &req, wszFileName));
+ if (pReply && pReply->resultCode == 200)
bSuccess = true;
- FILE* out = _wfopen(wszFileName, L"wb");
- fwrite(pReply->body, 1, pReply->body.GetLength(), out);
- fclose(out);
- }
}
else bSuccess = true;