Ejemplo n.º 1
0
CURLcode curl_easy_perform(CURL *curl){ 

	if(http_response == NULL){
		http_response = (u8 *) mem2_malloc(MAXTWITCURL, MEM2_OTHER);
	}

	curl->URLsplit();
	curl->buildHttpRequest();

	curl_request = mem2_strdup(curl->req.c_str(), MEM2_OTHER);
	if(!curl_request){
		return 1; // No memory
	}

	int ret = (http_request(curl->url.c_str(), NULL, http_response, MAXTWITCURL, 1, curl->accept_encoding));

	if(curl->callback)
		curl->callback((char *)http_response, ret, 1, curl->userdata);


	mem2_free(curl_request, MEM2_OTHER);
	curl_request = NULL;

	curl->postdata.clear();
	curl->req.clear();
	curl->headers.clear();

return !ret; //0 means ok to twitcurl
}
Ejemplo n.º 2
0
struct t_arl * ARLs::Build(char ep, u64 arg1, u64 arg2, u64 arg3, const char * str){
 struct t_arl temp;
 memset(&temp, 0, sizeof(struct t_arl));

	if(elements.size() && (selected_index + 1 != elements.size())){
		it = elements.begin();
		advance(it, selected_index+1);
		while((++it) != elements.end()){
			if((*it).text) mem2_free((*it).text, MEM2_OTHER);
		}
		it = elements.begin();
		advance(it, selected_index+1);
		elements.erase(it, elements.end());
	}else if(elements.size() == maxelements){
		elements.erase(elements.begin());
		selected_index--;
	}

	temp.endpoint = ep;
	temp.user_id = arg1;
	temp.arg_id = arg2;
	temp.arg_id_2 = arg3;
	if(str)
		temp.text = mem2_strdup(str, MEM2_OTHER);

	if(elements.size() == maxelements){
		it = elements.begin();
		if((*it).text) mem2_free((*it).text, MEM2_OTHER);
		elements.erase(it);
	}

	elements.push_back(temp);

	selected_index = elements.size()-1;

 return GetSelected();
}