diff options
author | George Hazan <george.hazan@gmail.com> | 2024-01-10 12:11:16 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-01-10 12:11:16 +0300 |
commit | 730c132f369842cd219388905cf981c2e90f98b3 (patch) | |
tree | e347546e613854070cfd3da32eb0e2e8d30b3b91 /protocols/Twitter/src/connection.cpp | |
parent | e688d75e8db7616d7e6d6fb3ed3c892e4fbe8a97 (diff) |
code cleaning
Diffstat (limited to 'protocols/Twitter/src/connection.cpp')
-rw-r--r-- | protocols/Twitter/src/connection.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index 3cf4673d27..438572eb7e 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -164,7 +164,9 @@ void CTwitterProto::UpdateAvatarWorker(void *p) return;
CMStringA ext = data->url.Mid(data->url.ReverseFind('.')); // finds the filetype of the avatar
- CMStringW filename(FORMAT, L"%s\\%S%S", GetAvatarFolder().c_str(), username.c_str(), ext.c_str()); // local filename and path
+
+ MFilePath filename; // local filename and path
+ filename.Format(L"%s\\%S%S", GetAvatarFolder().c_str(), username.c_str(), ext.c_str());
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = data->hContact;
@@ -185,7 +187,12 @@ void CTwitterProto::UpdateAvatarWorker(void *p) return;
}
- if (save_url(hAvatarNetlib_, data->url, filename)) {
+ MHttpRequest req(REQUEST_GET);
+ req.flags = NLHRF_HTTP11 | NLHRF_REDIRECT;
+ req.m_szUrl = data->url;
+
+ NLHR_PTR resp(Netlib_DownloadFile(hAvatarNetlib_, &req, filename));
+ if (resp && resp->resultCode == 200) {
setString(data->hContact, TWITTER_KEY_AV_URL, data->url.c_str());
ProtoBroadcastAck(data->hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai);
}
|