spectrum2/backends/twitter/Requests/ProfileImageRequest.h

63 lines
1.4 KiB
C
Raw Normal View History

2012-07-19 19:11:48 +05:30
#ifndef PROFILEIMAGE_H
#define PROFILEIMAGE_H
2012-08-07 09:31:15 +02:00
#include "transport/threadpool.h"
2012-07-19 19:11:48 +05:30
#include "../TwitterResponseParser.h"
#include "transport/logging.h"
#include "transport/config.h"
#include <string>
#include <boost/signals.hpp>
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <iostream>
#include <sstream>
using namespace Transport;
using namespace boost::program_options;
class ProfileImageRequest : public Thread
{
std::string user;
std::string buddy;
std::string url;
std::string img;
unsigned int reqID;
2012-08-12 20:11:06 +05:30
boost::function< void (std::string&, std::string&, std::string&, int, Error&) > callBack;
2012-07-19 19:11:48 +05:30
std::string ip, port, puser, ppasswd;
2012-07-19 19:11:48 +05:30
bool success;
2012-07-19 19:11:48 +05:30
std::string error;
std::string callbackdata;
public:
ProfileImageRequest(Config *config, const std::string &_user, const std::string &_buddy, const std::string &_url, unsigned int _reqID,
2012-08-12 20:11:06 +05:30
boost::function< void (std::string&, std::string&, std::string&, int, Error&) > cb) {
2012-07-19 19:11:48 +05:30
if(CONFIG_HAS_KEY(config,"proxy.server")) {
ip = CONFIG_STRING(config,"proxy.server");
2012-07-19 19:11:48 +05:30
std::ostringstream out;
out << CONFIG_INT(config,"proxy.port");
port = out.str();
2012-07-19 19:11:48 +05:30
puser = CONFIG_STRING(config,"proxy.user");
ppasswd = CONFIG_STRING(config,"proxy.password");
2012-07-19 19:11:48 +05:30
}
user = _user;
buddy = _buddy;
url = _url;
reqID = _reqID;
callBack = cb;
}
~ProfileImageRequest() {
}
void run();
void finalize();
};
#endif