Changeset - 7142ccb570ed
[Not reviewed]
0 3 0
Vitaly Takmazov - 13 years ago 2012-12-10 21:28:10
vitalyster@gmail.com
Use retweetID for displaying and ID everywhere else
3 files changed with 7 insertions and 4 deletions:
0 comments (0 inline, 0 general)
backends/twitter/TwitterPlugin.cpp
Show inline comments
 
@@ -656,21 +656,21 @@ void TwitterPlugin::displayTweets(std::string &user, std::string &userRequested,
 
		std::string timeline = "";
 
		std::map<std::string, int> lastTweet;
 
		std::map<std::string, int>::iterator it;
 

	
 
		for(int i = tweets.size() - 1 ; i >= 0 ; i--) {
 
			if(userdb[user].twitterMode != CHATROOM) {
 
				std::string m = " - " + tweets[i].getUserData().getScreenName() + ": " + tweets[i].getTweet() + " (MsgId: " + tweets[i].getID() + ")\n";
 
				std::string m = " - " + tweets[i].getUserData().getScreenName() + ": " + tweets[i].getTweet() + " (MsgId: " + (tweets[i].getRetweetID().empty() ? tweets[i].getID() : tweets[i].getRetweetID()) + ")\n";
 
				handleMessage(user, adminLegacyName, m, "", "", tweets[i].getCreationTime());
 

	
 
				std::string scrname = tweets[i].getUserData().getScreenName();
 
				if(lastTweet.count(scrname) == 0 || cmp(tweets[lastTweet[scrname]].getID(), tweets[i].getID()) <= 0) lastTweet[scrname] = i;
 

	
 
			} else {
 
				handleMessage(user, userdb[user].twitterMode == CHATROOM ? adminChatRoom : adminLegacyName,
 
									tweets[i].getTweet() + " (MsgId: " + tweets[i].getID() + ")", tweets[i].getUserData().getScreenName(), "", tweets[i].getCreationTime());
 
									tweets[i].getTweet() + " (MsgId: " + (tweets[i].getRetweetID().empty() ? tweets[i].getID() : tweets[i].getRetweetID()) + ")", tweets[i].getUserData().getScreenName(), "", tweets[i].getCreationTime());
 
			}
 
		}
 
		
 
		if(userdb[user].twitterMode == MULTIPLECONTACT) {
 
			//Set as status user's last tweet
 
			for(it=lastTweet.begin() ; it!=lastTweet.end() ; it++) {
backends/twitter/TwitterResponseParser.cpp
Show inline comments
 
@@ -100,13 +100,13 @@ Status getStatus(const Swift::ParserElement::ref &element, const std::string xml
 
	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" );
 
	Swift::ParserElement::ref rt = element->getChild(TwitterReponseTypes::retweeted_status, xmlns);
 
	if (rt != Swift::NullParserElement::element) {
 
		status.setTweet(unescape( std::string( rt->getChild(TwitterReponseTypes::text, xmlns)->getText() + " (RT by @" + status.getUserData().getScreenName() + ")") ) );
 
		status.setID( std::string ( rt->getChild(TwitterReponseTypes::id, xmlns)->getText() ) );
 
		status.setRetweetID( std::string ( rt->getChild(TwitterReponseTypes::id, xmlns)->getText() ) );
 
		status.setCreationTime( toIsoTime ( std::string (rt->getChild(TwitterReponseTypes::created_at, xmlns)->getText() ) ) );
 
		status.setUserData( getUser ( rt->getChild(TwitterReponseTypes::user, xmlns), xmlns ) );
 
	}
 
	return status;
 
}
 

	
backends/twitter/TwitterResponseParser.h
Show inline comments
 
@@ -113,41 +113,44 @@ class User
 

	
 
//Class representing a status (tweet)
 
class Status
 
{
 
	std::string created_at;
 
	std::string ID;
 
	std::string retweetID;	
 
	std::string text;
 
	bool truncated;
 
	std::string in_reply_to_status_id;
 
	std::string in_reply_to_user_id;
 
	std::string in_reply_to_screen_name;
 
	User user;
 
	unsigned int retweet_count;
 
	bool favorited;
 
	bool retweeted;
 

	
 
	public:
 
	Status():created_at(""),ID(""),text(""),truncated(false),in_reply_to_status_id(""),
 
		Status():created_at(""),ID(""),retweetID(""),text(""),truncated(false),in_reply_to_status_id(""),
 
	         in_reply_to_user_id(""),in_reply_to_screen_name(""),user(User()),retweet_count(0),
 
	         favorited(false),retweeted(0){}
 
	
 
	std::string getCreationTime() {return created_at;}
 
	std::string getID() {return ID;}
 
	std::string getRetweetID() {return retweetID;}	
 
	std::string getTweet() {return text;}
 
	bool isTruncated() {return truncated;}
 
	std::string getReplyToStatusID() {return in_reply_to_status_id;}
 
	std::string getReplyToUserID() {return in_reply_to_user_id;}
 
	std::string getReplyToScreenName() {return in_reply_to_screen_name;}
 
	User getUserData() {return user;}
 
	unsigned int getRetweetCount() {return retweet_count;}
 
	bool isFavorited() {return favorited;}
 
	bool isRetweeted() {return retweeted;}
 
	
 
	void setCreationTime(std::string _created) {created_at = _created;}
 
	void setID(std::string _id) {ID = _id;}
 
	void setRetweetID(std::string _id) {retweetID = _id;}	
 
	void setTweet(std::string _text) {text = _text;}
 
	void setTruncated(bool val) {truncated = val;}
 
	void setReplyToStatusID(std::string _id) {in_reply_to_status_id = _id;}
 
	void setReplyToUserID(std::string _id) {in_reply_to_user_id = _id;}
 
	void setReplyToScreenName(std::string _name) {in_reply_to_screen_name = _name;}
 
	void setUserData(User u) {user = u;}
0 comments (0 inline, 0 general)