File choqok-1.4-twitter-favorities-fix.patch of Package choqok

commit a93ae8bbd965d5e10c3088c8e94b1bc595037e48
Author: Daniel Kreuter <daniel.kreuter85@gmail.com>
Date:   Thu Jan 16 22:15:47 2014 +0100

    Fixing twitter favorites.
    
    Fixed creating / destroying of twitter favorite tweets.
    
    CCBUG: 330037

diff --git a/helperlibs/twitterapihelper/twitterapimicroblog.cpp b/helperlibs/twitterapihelper/twitterapimicroblog.cpp
index 0c1e9ac..8878eea 100644
--- a/helperlibs/twitterapihelper/twitterapimicroblog.cpp
+++ b/helperlibs/twitterapihelper/twitterapimicroblog.cpp
@@ -571,10 +571,13 @@ void TwitterApiMicroBlog::createFavorite ( Choqok::Account* theAccount, const QS
     KUrl url = account->apiUrl();
     //url.addPath ( QString("/favorites/create.json?id=%1").arg(postId));
     url.addPath ( "/favorites/create.json" );
-    QByteArray data;
-    data = "id=";
-    data += postId.toLocal8Bit();
-    KIO::StoredTransferJob *job = KIO::storedHttpPost ( data, url, KIO::HideProgressInfo ) ;
+    KUrl tmp(url);
+    url.addQueryItem("id", postId);
+    
+    QOAuth::ParamMap params;
+    params.insert("id", postId.toLatin1());
+
+    KIO::StoredTransferJob *job = KIO::storedHttpPost ( QByteArray(), url, KIO::HideProgressInfo ) ;
     if ( !job ) {
         kDebug() << "Cannot create an http POST request!";
 //         QString errMsg = i18n ( "The Favorite creation failed. Cannot create an http POST request. "
@@ -582,7 +585,7 @@ void TwitterApiMicroBlog::createFavorite ( Choqok::Account* theAccount, const QS
 //         emit error ( theAccount, OtherError, errMsg );
         return;
     }
-    job->addMetaData("customHTTPHeader", "Authorization: " + authorizationHeader(account, url, QOAuth::POST));
+    job->addMetaData("customHTTPHeader", "Authorization: " + authorizationHeader(account, tmp, QOAuth::POST, params));
     mFavoriteMap[job] = postId;
     mJobsAccount[job] = theAccount;
     connect ( job, SIGNAL ( result ( KJob* ) ), this, SLOT ( slotCreateFavorite ( KJob* ) ) );
@@ -619,10 +622,14 @@ void TwitterApiMicroBlog::removeFavorite ( Choqok::Account* theAccount, const QS
     TwitterApiAccount* account = qobject_cast<TwitterApiAccount*>(theAccount);
     KUrl url = account->apiUrl();
     url.addPath ( "/favorites/destroy.json" );
-    QByteArray data;
-    data = "id=";
-    data += postId.toLocal8Bit();
-    KIO::StoredTransferJob *job = KIO::storedHttpPost ( data, url, KIO::HideProgressInfo ) ;
+    
+    KUrl tmp(url);
+    url.addQueryItem("id", postId);
+    
+    QOAuth::ParamMap params;
+    params.insert("id", postId.toLatin1());
+
+    KIO::StoredTransferJob *job = KIO::storedHttpPost ( QByteArray(), url, KIO::HideProgressInfo  ) ;
     if ( !job ) {
         kDebug() << "Cannot create an http POST request!";
 //         QString errMsg = i18n ( "Removing the favorite failed. Cannot create an http POST request. "
@@ -630,7 +637,7 @@ void TwitterApiMicroBlog::removeFavorite ( Choqok::Account* theAccount, const QS
 //         emit error ( theAccount, OtherError, errMsg );
         return;
     }
-    job->addMetaData("customHTTPHeader", "Authorization: " + authorizationHeader(account, url, QOAuth::POST));
+    job->addMetaData("customHTTPHeader", "Authorization: " + authorizationHeader(account, tmp, QOAuth::POST, params));
     mFavoriteMap[job] = postId;
     mJobsAccount[job] = theAccount;
     connect ( job, SIGNAL ( result ( KJob* ) ), this, SLOT ( slotRemoveFavorite ( KJob* ) ) );
openSUSE Build Service is sponsored by