Files
@ aa0f0c64cfde
Branch filter:
Location: libtransport.git/backends/twitter/Requests/FetchFriends.cpp - annotation
aa0f0c64cfde
1.3 KiB
text/x-c++hdr
Merge branch 'master' of git://github.com/hanzz/libtransport into twitter-backend
f87f8cc356a1 9e70a739b7c2 9e70a739b7c2 f87f8cc356a1 f87f8cc356a1 f87f8cc356a1 f87f8cc356a1 f87f8cc356a1 f87f8cc356a1 5b13c80ee9ea 5b13c80ee9ea f87f8cc356a1 5b13c80ee9ea 5b13c80ee9ea 5b13c80ee9ea 5b13c80ee9ea 5b13c80ee9ea f87f8cc356a1 5b13c80ee9ea 5b13c80ee9ea 9e70a739b7c2 9e70a739b7c2 9e70a739b7c2 9e70a739b7c2 9e70a739b7c2 9e70a739b7c2 9e70a739b7c2 9e70a739b7c2 9e70a739b7c2 9e70a739b7c2 9e70a739b7c2 9e70a739b7c2 9e70a739b7c2 f87f8cc356a1 f87f8cc356a1 f87f8cc356a1 f87f8cc356a1 5b13c80ee9ea a2b385e88f06 5b13c80ee9ea 9e70a739b7c2 5b13c80ee9ea 5b13c80ee9ea 5b13c80ee9ea 9e70a739b7c2 5b13c80ee9ea f87f8cc356a1 | #include "FetchFriends.h"
#include "../HTTPRequest.h"
DEFINE_LOGGER(logger, "FetchFriends")
void FetchFriends::run()
{
replyMsg = "";
success = twitObj->friendsIdsGet(twitObj->getTwitterUsername());
if(!success) return;
twitObj->getLastWebResponse( replyMsg );
std::vector<std::string> IDs = getIDs( replyMsg );
success = twitObj->userLookup(IDs, true);
if(!success) return;
twitObj->getLastWebResponse( replyMsg );
friends = getUsers( replyMsg );
HTTPRequest req;
req.init();
req.setProxy(twitObj->getProxyServerIp(), twitObj->getProxyServerPort(), twitObj->getProxyUserName(), twitObj->getProxyPassword());
for(int i=0 ; i<friends.size() ; i++) {
std::string img;
friendAvatars.push_back("");
if(req.GET(friends[i].getProfileImgURL(), img)) friendAvatars[i] = img;
else {
LOG4CXX_INFO(logger, "Warning: Couldn't fetch Profile Image for " << user << "'s friend " << friends[i].getScreenName())
}
}
}
void FetchFriends::finalize()
{
if(!success) {
twitObj->getLastCurlError( replyMsg );
LOG4CXX_ERROR(logger, user << " - " << replyMsg)
callBack(user, friends, friendAvatars, replyMsg);
} else {
std::string error = getErrorMessage(replyMsg);
if(error.length()) LOG4CXX_ERROR(logger, user << " - " << error)
callBack(user, friends, friendAvatars, error);
}
}
|