Beispiel #1
0
void SlackRTM::start() {
	std::string url = "https://slack.com/api/rtm.start?";
	url += "token=" + Util::urlencode(m_token);

	HTTPRequest *req = new HTTPRequest(THREAD_POOL(m_component), HTTPRequest::Get, url, boost::bind(&SlackRTM::handleRTMStart, this, _1, _2, _3, _4));
	req->execute();
}
Beispiel #2
0
	void GETThreadPool() {
		HTTPRequest *req = new HTTPRequest(tp, HTTPRequest::Get, "http://spectrum.im/params.json", boost::bind(&HTTPRequestTest::handleResult, this, _1, _2, _3, _4));
		req->execute();

		int i = 0;
		while (result == false && i < 5) {
			sleep(1);
			loop->processEvents();
			i++;
		}
		CPPUNIT_ASSERT(result);
	}
Beispiel #3
0
void UpdateCheckInterface::remoteCheck()
{
	try
	{
		string params = string("?major=") + VERSION_MAJOR + string("&minor=") + VERSION_MINOR + string("&build=") + VERSION_BUILD;
		HTTPRequest req = HTTPRequest( UPDATE_HOST_DEFAULT, UPDATE_PATH_DEFAULT + params );

		vector<string> lines = req.execute();

		if( lines.size() < 7 )
			throw UpdateCheckException("Response too short");

		if( lines[0] != UPDATE_MAGIC )
			throw UpdateCheckException("Response header magic invalid");

		//If we reach this point, the update check was successful!

		Log.Message((string("[UPDATE_CHECK] Requesting version information from ") + UPDATE_HOST_DEFAULT).c_str());

		if( lines[1] == UP_TO_DATE )
		{
			Log.Message(string("[UPDATE_CHECK] You are running the latest version of NGM.").c_str());

		} else if( lines[1] == OUT_OF_DATE ) {
			Log.Message(string("[UPDATE_CHECK] >>>>>>> Your version of NGM is out of date! <<<<<<<").c_str());
			Log.Message(string("[UPDATE_CHECK] You are running  : " + string(VERSION_MAJOR) + "-" + string(VERSION_MINOR) + "-" + string(VERSION_BUILD)).c_str());
			Log.Message(string("[UPDATE_CHECK] Available version: >>> " + string(lines[2]) + "-" + string(lines[3]) + "-" + string(lines[4]) + " <<<").c_str());
			Log.Message(string("[UPDATE_CHECK] Download URL: " + lines[5]).c_str());
			Log.Message(string(lines[6]).c_str());

		} else {
			throw UpdateCheckException("Status value invalid");
		}

	} catch( UpdateCheckException ex ) {
		Log.Message(("[UPDATE_CHECK] Failure: " + ex.what()).c_str());
	}
}
Beispiel #4
0
	void GET() {
		rapidjson::Document resp;
		HTTPRequest *req = new HTTPRequest(tp, HTTPRequest::Get, "http://spectrum.im/params.json", boost::bind(&HTTPRequestTest::handleResult, this, _1, _2, _3, _4));
		req->execute(resp);
		delete req;
	}