johnson-pkt / twitcurl

Automatically exported from code.google.com/p/twitcurl
0 stars 0 forks source link

Replying to tweets #47

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have modified the statusUpdate() function to allow the inclusion of the 
in_reply_to_status_id field:

twitcurl.h:

bool statusUpdate( std::string& newStatus, std::string& replyId /* in */ );

twitcurl.cpp:

bool twitCurl::statusUpdate( std::string& newStatus, std::string& replyId )
{
    bool retVal = false;
    if( newStatus.length() )
    {
        /* Prepare new status message */
        std::string newStatusMsg = twitCurlDefaults::TWITCURL_STATUSSTRING + urlencode( newStatus );
        if(!replyId.empty()) newStatusMsg.append("&in_reply_to_status_id="+replyId);

        /* Perform POST */
        retVal = performPost( twitCurlDefaults::TWITCURL_PROTOCOLS[m_eProtocolType] +
                              twitterDefaults::TWITCURL_STATUSUPDATE_URL +
                              twitCurlDefaults::TWITCURL_EXTENSIONFORMATS[m_eApiFormatType],
                              newStatusMsg );
    }
    return retVal;
}

Example usage:

    std::string response;
    std::string msg("@hippy2094 moo!");
    std::string id("293032997593153536");
    if(twitterObj.statusUpdate(msg,id)) {
      twitterObj.getLastWebResponse(response);
      qDebug(response.c_str());
    }

To send a standard tweet, you just need to leave the replyId parameter empty.

Original issue reported on code.google.com by hippy2094 on 20 Jan 2013 at 7:39

GoogleCodeExporter commented 8 years ago
Oops, this isn't really a defect, can't seem to change that myself?

Original comment by hippy2094 on 20 Jan 2013 at 7:40

GoogleCodeExporter commented 8 years ago
Thanks! Added in_reply_to_status_id support in #r99.

Original comment by swatkat....@gmail.com on 30 Mar 2013 at 6:31