library/src/blockclass/BP-BlockClass.cc
// attempt to run disconnect me search
attempt to run disconnect me search
attempt to run disconnect me search
BP_ERROR_T Block::runDisconnectMeSearch(char *query, BP_DISCONNECT_ME_SEARCH_TARGET search_engine_target)
{
	if(!query)
		return ERR_FAILURE;
	if(!BP_StringIsReasonablePrintableString(query, bpstrlen(query), BP_FALSE, BP_FALSE))
		return ERR_FAILURE;
	if(!this->httpSession)
		return ERR_FAILURE;
	if(!this->disconnectme_session)
	{
		this->disconnectme_session = BP_DisconnectMeSearchOpen(this->httpSession);
		if(!this->disconnectme_session)
			return ERR_FAILURE;
	}
	char * search_term_utf8 = BP_UTF8StringEncode(query, bpstrlen(query));
	BP_DisconnectMeSearch(this->disconnectme_session, search_term_utf8, search_engine_target, 60);
	bpfree(search_term_utf8);
	return ERR_SUCCESS;
}
BP_ERROR_T Block :: runDisconnectMeSearch ( char * query , BP_DISCONNECT_ME_SEARCH_TARGET search_engine_target ) { if ( ! query ) return ERR_FAILURE ; if ( ! BP_StringIsReasonablePrintableString ( query , bpstrlen ( query ) , BP_FALSE , BP_FALSE ) ) return ERR_FAILURE ; if ( ! this -> httpSession ) return ERR_FAILURE ; if ( ! this -> disconnectme_session ) { this -> disconnectme_session = BP_DisconnectMeSearchOpen ( this -> httpSession ) ; if ( ! this -> disconnectme_session ) return ERR_FAILURE ; } char * search_term_utf8 = BP_UTF8StringEncode ( query , bpstrlen ( query ) ) ; BP_DisconnectMeSearch ( this -> disconnectme_session , search_term_utf8 , search_engine_target , 60 ) ; bpfree ( search_term_utf8 ) ; return ERR_SUCCESS ; }
attempt to run disconnect me search
attempt to run disconnect me search
// ensure we have a query and it's reasonable // ensure we have a http session to work with // ensure we have a session // attempt to create session JIT // set search term utf8 string from query buffer // run the search // destroy search term // return indicating success