QTweetLib icon indicating copy to clipboard operation
QTweetLib copied to clipboard

QTweetFriendshipDestroy::unfollow

Open DmitryRizshkovg opened this issue 14 years ago • 1 comments
trafficstars

Works incorrect

should have a body

if (!isAuthenticationEnabled()) { qCritical("Needs authentication to be enabled"); return; }

QUrl url("http://api.twitter.com/1/friendships/destroy.json");

QUrl urlQuery(url);

urlQuery.addQueryItem("screen_name", QUrl::toPercentEncoding(screenName));

if (includeEntities)
{
    urlQuery.addQueryItem("include_entities", "true");
}

QNetworkRequest req(url);

QByteArray oauthHeader = oauthTwitter()->generateAuthorizationHeader(urlQuery, OAuth::POST);
req.setRawHeader(AUTH_HEADER, oauthHeader);

QByteArray postBody = urlQuery.toEncoded(QUrl::RemoveScheme | QUrl::RemoveAuthority | QUrl::RemovePath);
postBody.remove(0, 1);

QNetworkReply *reply = oauthTwitter()->networkAccessManager()->post(req, postBody);
connect(reply, SIGNAL(finished()), this, SLOT(reply()));

DmitryRizshkovg avatar Mar 05 '11 19:03 DmitryRizshkovg

This should be more proper:

QByteArray oauthHeader = oauthTwitter()->generateAuthorizationHeader(url, OAuth::DELETE);

Anyway your code will work also!

minimoog avatar Mar 06 '11 15:03 minimoog