From 7142ccb570edff3dcba8a0a38f3a2e5004c09006 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 11 Dec 2012 00:28:10 +0400 Subject: [PATCH] Use retweetID for displaying and ID everywhere else --- backends/twitter/TwitterPlugin.cpp | 4 ++-- backends/twitter/TwitterResponseParser.cpp | 2 +- backends/twitter/TwitterResponseParser.h | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/backends/twitter/TwitterPlugin.cpp b/backends/twitter/TwitterPlugin.cpp index 5c42969c..c871ab54 100644 --- a/backends/twitter/TwitterPlugin.cpp +++ b/backends/twitter/TwitterPlugin.cpp @@ -659,7 +659,7 @@ void TwitterPlugin::displayTweets(std::string &user, std::string &userRequested, 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(); @@ -667,7 +667,7 @@ void TwitterPlugin::displayTweets(std::string &user, std::string &userRequested, } 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()); } } diff --git a/backends/twitter/TwitterResponseParser.cpp b/backends/twitter/TwitterResponseParser.cpp index c14c392a..0774b951 100644 --- a/backends/twitter/TwitterResponseParser.cpp +++ b/backends/twitter/TwitterResponseParser.cpp @@ -103,7 +103,7 @@ Status getStatus(const Swift::ParserElement::ref &element, const std::string xml 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 ) ); } diff --git a/backends/twitter/TwitterResponseParser.h b/backends/twitter/TwitterResponseParser.h index 614dd869..69be8d5d 100644 --- a/backends/twitter/TwitterResponseParser.h +++ b/backends/twitter/TwitterResponseParser.h @@ -116,6 +116,7 @@ class Status { std::string created_at; std::string ID; + std::string retweetID; std::string text; bool truncated; std::string in_reply_to_status_id; @@ -127,12 +128,13 @@ class Status 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;} @@ -145,6 +147,7 @@ class Status 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;}