spectrum2/backends/twitter/Requests/DirectMessageRequest.h

44 lines
1,020 B
C
Raw Normal View History

2012-06-02 20:10:42 +05:30
#ifndef DIRECT_MESSAGE
#define DIRECT_MESSAGE
2012-08-07 09:31:15 +02:00
#include "transport/threadpool.h"
2012-06-11 19:39:20 +05:30
#include "../TwitterResponseParser.h"
2012-06-02 20:10:42 +05:30
#include "../libtwitcurl/twitcurl.h"
#include "transport/logging.h"
#include <string>
2012-06-10 22:23:22 +05:30
#include <boost/function.hpp>
2012-06-02 20:10:42 +05:30
#include <iostream>
using namespace Transport;
class DirectMessageRequest : public Thread
{
2012-06-03 15:01:50 +05:30
twitCurl *twitObj;
2012-06-02 20:10:42 +05:30
std::string data;
std::string user;
std::string username;
std::string replyMsg;
2012-08-12 20:11:06 +05:30
boost::function< void (std::string&, std::string &, std::vector<DirectMessage>&, Error&) > callBack;
2012-06-11 19:39:20 +05:30
std::vector<DirectMessage> messages;
2012-06-10 22:23:22 +05:30
bool success;
2012-06-02 20:10:42 +05:30
public:
2012-06-10 22:23:22 +05:30
DirectMessageRequest(twitCurl *obj, const std::string &_user, const std::string & _username, const std::string &_data,
2012-08-12 20:11:06 +05:30
boost::function< void (std::string&, std::string &, std::vector<DirectMessage>&, Error&) > cb) {
2012-06-03 15:01:50 +05:30
twitObj = obj->clone();
2012-06-02 20:10:42 +05:30
data = _data;
user = _user;
username = _username;
2012-06-10 22:23:22 +05:30
callBack = cb;
2012-06-02 20:10:42 +05:30
}
2012-06-03 15:01:50 +05:30
~DirectMessageRequest() {
delete twitObj;
}
2012-06-02 20:10:42 +05:30
void run();
void finalize();
};
#endif