File: TimelineRequest.cpp

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 (32 lines) | stat: -rw-r--r-- 1,084 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
#include "TimelineRequest.h"
DEFINE_LOGGER(timelineRequestLogger, "TimelineRequest")
void TimelineRequest::run()
{
	LOG4CXX_INFO(timelineRequestLogger, "Sending timeline request for user " << userRequested);

	if(userRequested != "") success = twitObj->timelineUserGet(false, false, 20, userRequested, false);
	else success = twitObj->timelineHomeGet(since_id);

	if(!success) return;

	replyMsg = "";
	twitObj->getLastWebResponse( replyMsg );
	//LOG4CXX_INFO(timelineRequestLogger, user << " - " << replyMsg.length() << " " << replyMsg << "\n" );
	tweets = getTimeline(replyMsg);
}

void TimelineRequest::finalize()
{
	Error error;
	if(!success) {
		std::string curlerror;
		twitObj->getLastCurlError(curlerror);
		error.setMessage(curlerror);
		LOG4CXX_ERROR(timelineRequestLogger,  user << " - Curl error: " << curlerror);
		callBack(user, userRequested, tweets, error);
	} else {
		error = getErrorMessage(replyMsg);
		if(error.getMessage().length()) LOG4CXX_ERROR(timelineRequestLogger,  user << " - " << error.getMessage());
		callBack(user, userRequested, tweets, error);
	}
}