Changeset - f0b99d6b02b8
[Not reviewed]
Merge
0 37 5
Vitaly Takmazov - 13 years ago 2012-12-10 14:26:15
vitalyster@gmail.com
Merge branch 'retweeted_status'
2 files changed with 7 insertions and 0 deletions:
0 comments (0 inline, 0 general)
backends/twitter/TwitterResponseParser.cpp
Show inline comments
 
@@ -48,24 +48,27 @@ EmbeddedStatus getEmbeddedStatus(const Swift::ParserElement::ref &element, const
 

	
 
	status.setCreationTime( toIsoTime(std::string( element->getChild(TwitterReponseTypes::created_at, xmlns)->getText() ) ) );
 

	
 
	status.setID( std::string( element->getChild(TwitterReponseTypes::id, xmlns)->getText() ) );
 
	status.setTweet( unescape (std::string( element->getChild(TwitterReponseTypes::text, xmlns)->getText() ) ) );
 
	status.setTruncated( std::string( element->getChild(TwitterReponseTypes::truncated, xmlns)->getText() )=="true" );
 
	status.setReplyToStatusID( std::string( element->getChild(TwitterReponseTypes::in_reply_to_status_id, xmlns)->getText() ) );
 
	status.setReplyToUserID( std::string( element->getChild(TwitterReponseTypes::in_reply_to_user_id, xmlns)->getText() ) );
 
	status.setReplyToScreenName( std::string( element->getChild(TwitterReponseTypes::in_reply_to_screen_name, xmlns)->getText() ) );
 
	status.setRetweetCount( atoi( element->getChild(TwitterReponseTypes::retweet_count, xmlns)->getText().c_str() ) );
 
	status.setFavorited( std::string( element->getChild(TwitterReponseTypes::favorited, xmlns)->getText() )=="true" );
 
	status.setRetweeted( std::string( element->getChild(TwitterReponseTypes::retweeted, xmlns)->getText() )=="true" );
 
	if (status.isRetweeted()) {
 
		status.setTweet( std::string( element->getChild(TwitterReponseTypes::retweeted_status, xmlns)->getText() ) );
 
	}
 
	return status;
 
}
 

	
 
User getUser(const Swift::ParserElement::ref &element, const std::string xmlns) 
 
{
 
	User user;
 
	if(element->getName() != TwitterReponseTypes::user 
 
	   && element->getName() != TwitterReponseTypes::sender
 
	   && element->getName() != TwitterReponseTypes::recipient) {
 
		LOG4CXX_ERROR(logger, "Not a user element!")
 
		return user;
 
	}
 
@@ -90,24 +93,27 @@ Status getStatus(const Swift::ParserElement::ref &element, const std::string xml
 

	
 
	status.setCreationTime( toIsoTime ( std::string( element->getChild(TwitterReponseTypes::created_at, xmlns)->getText() ) ) );
 
	status.setID( std::string( element->getChild(TwitterReponseTypes::id, xmlns)->getText() ) );
 
	status.setTweet( unescape ( std::string( element->getChild(TwitterReponseTypes::text, xmlns)->getText() ) ) );
 
	status.setTruncated( std::string( element->getChild(TwitterReponseTypes::truncated, xmlns)->getText() )=="true" );
 
	status.setReplyToStatusID( std::string( element->getChild(TwitterReponseTypes::in_reply_to_status_id, xmlns)->getText() ) );
 
	status.setReplyToUserID( std::string( element->getChild(TwitterReponseTypes::in_reply_to_user_id, xmlns)->getText() ) );
 
	status.setReplyToScreenName( std::string( element->getChild(TwitterReponseTypes::in_reply_to_screen_name, xmlns)->getText() ) );
 
	status.setUserData( getUser(element->getChild(TwitterReponseTypes::user, xmlns), xmlns) );
 
	status.setRetweetCount( atoi( element->getChild(TwitterReponseTypes::retweet_count, xmlns)->getText().c_str() ) );
 
	status.setFavorited( std::string( element->getChild(TwitterReponseTypes::favorited, xmlns)->getText() )=="true" );
 
	status.setRetweeted( std::string( element->getChild(TwitterReponseTypes::retweeted, xmlns)->getText() )=="true" );
 
	if (status.isRetweeted()) {
 
		status.setTweet( std::string( element->getChild(TwitterReponseTypes::retweeted_status, xmlns)->getText() ) );
 
	}
 
	return status;
 
}
 

	
 
DirectMessage getDirectMessage(const Swift::ParserElement::ref &element, const std::string xmlns) 
 
{
 
	DirectMessage DM;
 
	if(element->getName() != TwitterReponseTypes::direct_message) {
 
		LOG4CXX_ERROR(logger, "Not a direct_message element!")
 
		return DM;
 
	}
 

	
 
	DM.setCreationTime( toIsoTime ( std::string( element->getChild(TwitterReponseTypes::created_at, xmlns)->getText() ) ) );
backends/twitter/TwitterResponseParser.h
Show inline comments
 
@@ -11,24 +11,25 @@ namespace TwitterReponseTypes
 
	const std::string id_list = "id_list";
 
	const std::string ids = "ids";
 
	const std::string name = "name";
 
	const std::string screen_name = "screen_name";
 
	const std::string statuses_count = "statuses_count";
 
	const std::string created_at = "created_at";
 
	const std::string text = "text";
 
	const std::string truncated = "truncated";
 
	const std::string in_reply_to_status_id = "in_reply_to_user_id";
 
	const std::string in_reply_to_user_id = "in_reply_to_user_id";
 
	const std::string in_reply_to_screen_name = "in_reply_to_screen_name";
 
	const std::string retweet_count = "retweet_count";
 
	const std::string retweeted_status = "retweeted_status";
 
	const std::string favorited = "favorited";
 
	const std::string retweeted = "retweeted";
 
	const std::string user = "user";
 
	const std::string users = "users";
 
	const std::string status = "status";
 
	const std::string error = "error";
 
	const std::string direct_message = "direct_message";
 
	const std::string directmessages = "direct-messages";
 
	const std::string sender_id = "sender_id";
 
	const std::string recipient_id = "recipient_id";
 
	const std::string sender_screen_name = "sender_screen_name";
 
	const std::string recipient_screen_name = "recipient_screen_name";
0 comments (0 inline, 0 general)