summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/communication.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2013-11-27 18:53:57 +0000
committerRobert Pösel <robyer@seznam.cz>2013-11-27 18:53:57 +0000
commitab1971b510fb004fc23aa3a69565ce69d8d0743e (patch)
tree10ee083ade2860980eac8c162dfe6a7927ece072 /protocols/FacebookRM/src/communication.cpp
parent4859c7f947362a2fd8d4b9dc0458168fcb7143e7 (diff)
Facebook:
- fixed marking messages of some multichats as read (fixes #504) - fixed downloading avatars of some contacts (and repeated downloading of them again and again...) - load messages marked as abusive/spam - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@6996 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/communication.cpp')
-rw-r--r--protocols/FacebookRM/src/communication.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index 7bbac28fab..a0770b1783 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -1373,25 +1373,30 @@ bool facebook_client::save_url(const std::string &url,const std::tstring &filena
resp = reinterpret_cast<NETLIBHTTPREQUEST*>(CallService(MS_NETLIB_HTTPTRANSACTION,
reinterpret_cast<WPARAM>(this->parent->m_hNetlibUser), reinterpret_cast<LPARAM>(&req)));
- if (resp)
- {
+ bool ret = false;
+
+ if (resp) {
nlc = resp->nlc;
parent->debugLogA("@@@@@ Saving avatar URL %s to path %s", url.c_str(), _T2A(filename.c_str()));
// Create folder if necessary
std::tstring dir = filename.substr(0,filename.rfind('\\'));
- if(_taccess(dir.c_str(),0))
+ if (_taccess(dir.c_str(), 0))
CreateDirectoryTreeT(dir.c_str());
// Write to file
FILE *f = _tfopen(filename.c_str(), _T("wb"));
- fwrite(resp->pData,1,resp->dataLength,f);
- fclose(f);
+ if (f != NULL) {
+ fwrite(resp->pData,1,resp->dataLength,f);
+ fclose(f);
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)resp);
- return true;
+ ret = _taccess(filename.c_str(), 0) == 0;
+ }
+
+ CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
} else {
nlc = NULL;
- return false;
}
+
+ return ret;
}