File: ProfileImageRequest.h

package info (click to toggle)
spectrum2 2.2.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,548 kB
  • sloc: cpp: 32,594; python: 1,751; javascript: 273; makefile: 34; sql: 31; xml: 10
file content (61 lines) | stat: -rw-r--r-- 1,388 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef PROFILEIMAGE_H
#define PROFILEIMAGE_H

#include "../TwitterResponseParser.h"
#include "transport/ThreadPool.h"
#include "transport/Logging.h"
#include "transport/Config.h"
#include <string>
#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;
	boost::function< void (std::string&, std::string&, std::string&, int, Error&) > callBack;

	std::string ip, port, puser, ppasswd;

	bool success;

	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,
			     boost::function< void (std::string&, std::string&, std::string&, int, Error&) >  cb) {

		if(CONFIG_HAS_KEY(config,"proxy.server")) {
			ip = CONFIG_STRING(config,"proxy.server");

			std::ostringstream out; 
			out << CONFIG_INT(config,"proxy.port");
			port = out.str();

			puser = CONFIG_STRING(config,"proxy.user");
			ppasswd = CONFIG_STRING(config,"proxy.password");
		}

		user = _user;
		buddy = _buddy;
		url = _url;
		reqID = _reqID;
		callBack = cb;
	}

	~ProfileImageRequest() {
	}

	void run();
	void finalize();
};
#endif