Changeset - 712f03464f8d
[Not reviewed]
Merge
0 19 0
HanzZ - 13 years ago 2013-02-22 09:59:24
hanzz.k@gmail.com
Merge branch 'master' of github.com:hanzz/libtransport
3 files changed with 16 insertions and 4 deletions:
0 comments (0 inline, 0 general)
backends/swiften_raw/CMakeLists.txt
Show inline comments
 
@@ -7,8 +7,8 @@ ADD_EXECUTABLE(spectrum2_swiften_raw_backend ${SRC})
 
IF (NOT WIN32)
 
target_link_libraries(spectrum2_swiften_raw_backend transport pthread ${Boost_LIBRARIES} ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES})
 
else()
 
target_link_libraries(spectrum2_swiften_raw_backend transport ${Boost_LIBRARIES} ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES})
 
endif()
 
 
INSTALL(TARGETS spectrum2_swiften_raw_backend RUNTIME DESTINATION bin)
 
#INSTALL(TARGETS spectrum2_swiften_raw_backend RUNTIME DESTINATION bin)
 
backends/twitter/TwitterResponseParser.cpp
Show inline comments
 
@@ -134,17 +134,19 @@ std::vector<Status> getTimeline(std::string &xml)
 
{
 
	std::vector<Status> statuses;
 
	Swift::ParserElement::ref rootElement = Swift::StringTreeParser::parse(xml);
 
	
 
	if(rootElement == NULL) {
 
		LOG4CXX_ERROR(logger, "Error while parsing XML")
 
        LOG4CXX_ERROR(logger, xml)
 
		return statuses;
 
	}
 

	
 
	if(rootElement->getName() != "statuses") {
 
		LOG4CXX_ERROR(logger, "XML doesn't correspond to timeline")
 
		LOG4CXX_ERROR(logger, "XML doesn't correspond to timeline:")
 
        LOG4CXX_ERROR(logger, xml)
 
		return statuses;
 
	}
 

	
 
	const std::string xmlns = rootElement->getNamespace();
 
	const std::vector<Swift::ParserElement::ref> children = rootElement->getChildren(TwitterReponseTypes::status, xmlns);
 

	
 
@@ -159,17 +161,19 @@ std::vector<DirectMessage> getDirectMessages(std::string &xml)
 
{
 
	std::vector<DirectMessage> DMs;
 
	Swift::ParserElement::ref rootElement = Swift::StringTreeParser::parse(xml);
 
	
 
	if(rootElement == NULL) {
 
		LOG4CXX_ERROR(logger, "Error while parsing XML")
 
        LOG4CXX_ERROR(logger, xml)
 
		return DMs;
 
	}
 
	
 
	if(rootElement->getName() != TwitterReponseTypes::directmessages) {
 
		LOG4CXX_ERROR(logger, "XML doesn't correspond to direct-messages")
 
		LOG4CXX_ERROR(logger, "XML doesn't correspond to direct-messages:")
 
        LOG4CXX_ERROR(logger, xml)
 
		return DMs;
 
	}
 

	
 
	const std::string xmlns = rootElement->getNamespace();
 
	const std::vector<Swift::ParserElement::ref> children = rootElement->getChildren(TwitterReponseTypes::direct_message, xmlns);
 

	
 
@@ -184,17 +188,19 @@ std::vector<User> getUsers(std::string &xml)
 
{
 
	std::vector<User> users;
 
	Swift::ParserElement::ref rootElement = Swift::StringTreeParser::parse(xml);
 
	
 
	if(rootElement == NULL) {
 
		LOG4CXX_ERROR(logger, "Error while parsing XML")
 
        LOG4CXX_ERROR(logger, xml)
 
		return users;
 
	}
 

	
 
	if(rootElement->getName() != TwitterReponseTypes::users) {
 
		LOG4CXX_ERROR(logger, "XML doesn't correspond to user list")
 
		LOG4CXX_ERROR(logger, "XML doesn't correspond to user list:")
 
        LOG4CXX_ERROR(logger, xml)
 
		return users;
 
	}
 

	
 
	const std::string xmlns = rootElement->getNamespace();
 
	const std::vector<Swift::ParserElement::ref> children = rootElement->getChildren(TwitterReponseTypes::user, xmlns);
 

	
 
@@ -209,17 +215,19 @@ User getUser(std::string &xml)
 
{
 
	User user;
 
	Swift::ParserElement::ref rootElement = Swift::StringTreeParser::parse(xml);
 
	
 
	if(rootElement == NULL) {
 
		LOG4CXX_ERROR(logger, "Error while parsing XML")
 
        LOG4CXX_ERROR(logger, xml)
 
		return user;
 
	}
 

	
 
	if(rootElement->getName() != TwitterReponseTypes::user) {
 
		LOG4CXX_ERROR(logger, "XML doesn't correspond to user object")
 
        LOG4CXX_ERROR(logger, xml)
 
		return user;
 
	}
 

	
 
	const std::string xmlns = rootElement->getNamespace();
 
	return user = getUser(rootElement, xmlns);
 
}
 
@@ -228,17 +236,19 @@ std::vector<std::string> getIDs(std::string &xml)
 
{
 
	std::vector<std::string> IDs;
 
	Swift::ParserElement::ref rootElement = Swift::StringTreeParser::parse(xml);
 

	
 
	if(rootElement == NULL) {
 
		LOG4CXX_ERROR(logger, "Error while parsing XML")
 
        LOG4CXX_ERROR(logger, xml)
 
		return IDs;
 
	}
 

	
 
	if(rootElement->getName() != TwitterReponseTypes::id_list) {
 
		LOG4CXX_ERROR(logger, "XML doesn't correspond to id_list");
 
        LOG4CXX_ERROR(logger, xml)
 
		return IDs;
 
	}
 

	
 
	const std::string xmlns = rootElement->getNamespace();
 
	const std::vector<Swift::ParserElement::ref> ids = rootElement->getChild(TwitterReponseTypes::ids, xmlns)->getChildren(TwitterReponseTypes::id, xmlns);
 
	
 
@@ -255,12 +265,13 @@ Error getErrorMessage(std::string &xml)
 
	Error resp;
 

	
 
	Swift::ParserElement::ref rootElement = Swift::StringTreeParser::parse(xml);
 

	
 
	if(rootElement == NULL) {
 
		LOG4CXX_ERROR(logger, "Error while parsing XML");
 
        LOG4CXX_ERROR(logger, xml)
 
		return resp;
 
	}
 

	
 
	const std::string xmlns = rootElement->getNamespace();
 
	const Swift::ParserElement::ref errorElement = rootElement->getChild(TwitterReponseTypes::error, xmlns);
 
	Swift::AttributeMap attributes = errorElement->getAttributes();
backends/twitter/libtwitcurl/twitcurl.cpp
Show inline comments
 
@@ -38,12 +38,13 @@ m_eProtocolType( twitCurlTypes::eTwitCurlProtocolHttp )
 
    if( NULL == m_curlHandle )
 
    {
 
        std::string dummyStr;
 
        getLastCurlError( dummyStr );
 
    }
 
    curl_easy_setopt(m_curlHandle, CURLOPT_VERBOSE, 1);
 
    curl_easy_setopt(m_curlHandle, CURLOPT_FOLLOWLOCATION, 1);
 
	curl_easy_setopt(m_curlHandle, CURLOPT_DEBUGFUNCTION, myDebugCallback);
 
}
 
 
/*++
 
* @method: twitCurl::~twitCurl
 
*
0 comments (0 inline, 0 general)