Changeset - 5dd1aa90b4c0
[Not reviewed]
0 3 0
Jan Kaluza - 9 years ago 2016-02-21 19:43:39
jkaluza@redhat.com
Slack: Handle 'account_inactive' error
3 files changed with 20 insertions and 6 deletions:
0 comments (0 inline, 0 general)
include/transport/HTTPRequest.h
Show inline comments
 
@@ -21,12 +21,7 @@ class HTTPRequest : public Thread {
 
		HTTPRequest(ThreadPool *tp, Type type, const std::string &url, Callback callback);
 
		HTTPRequest(Type type, const std::string &url);
 

	
 
		virtual ~HTTPRequest() {
 
			if(curlhandle) {
 
				curl_easy_cleanup(curlhandle);
 
				curlhandle = NULL;
 
			}
 
		}
 
		virtual ~HTTPRequest();
 

	
 
		void setProxy(std::string, std::string, std::string, std::string);
 
		bool execute();
libtransport/HTTPRequest.cpp
Show inline comments
 
@@ -21,6 +21,14 @@ HTTPRequest::HTTPRequest(Type type, const std::string &url) {
 
	init();
 
}
 

	
 
HTTPRequest::~HTTPRequest() {
 
	if (curlhandle) {
 
		LOG4CXX_INFO(logger, "Cleaning up CURL handle");
 
		curl_easy_cleanup(curlhandle);
 
		curlhandle = NULL;
 
	}
 
}
 

	
 
bool HTTPRequest::init() {
 
	curlhandle = curl_easy_init();
 
	if (curlhandle) {
 
@@ -85,6 +93,7 @@ bool HTTPRequest::GET(std::string url, 	std::string &data) {
 
		LOG4CXX_ERROR(logger, "CURL not initialized!")
 
		strcpy(curl_errorbuffer, "CURL not initialized!");
 
	}
 
	LOG4CXX_ERROR(logger, "Error fetching " << url);
 
	return false;
 
}
 

	
spectrum/src/frontends/slack/SlackRTM.cpp
Show inline comments
 
@@ -188,6 +188,16 @@ void SlackRTM::handleRTMStart(HTTPRequest *req, bool ok, rapidjson::Document &re
 
		return;
 
	}
 

	
 
	STORE_STRING_OPTIONAL(resp, error);
 
	if (!error.empty()) {
 
		if (error == "account_inactive") {
 
			LOG4CXX_INFO(logger, "Account inactive, will not try connecting again");
 
			m_pingTimer->stop();
 
			m_client->disconnectServer();
 
			return;
 
		}
 
	}
 

	
 
	rapidjson::Value &url = resp["url"];
 
	if (!url.IsString()) {
 
		LOG4CXX_ERROR(logger, "No 'url' object in the reply.");
0 comments (0 inline, 0 general)