[gnome-software/wip/rancell/reviews] Revert "Simplify report_review ()"



commit 0ff79f60e837f623d5ddad5ca8272acaccb38755
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri Feb 12 13:14:19 2016 +1300

    Revert "Simplify report_review ()"
    
    This reverts commit 6ca7b49bec8a5ac43fb0f88f0788b5aab5166062.

 src/plugins/gs-plugin-ubuntu-reviews.c |   28 +++++++++++++---------------
 1 files changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/src/plugins/gs-plugin-ubuntu-reviews.c b/src/plugins/gs-plugin-ubuntu-reviews.c
index c8c3bca..be5a9fa 100644
--- a/src/plugins/gs-plugin-ubuntu-reviews.c
+++ b/src/plugins/gs-plugin-ubuntu-reviews.c
@@ -1004,24 +1004,22 @@ report_review (GsPlugin *plugin,
 {
        GsPluginPrivate *priv = plugin->priv;
        g_autofree gchar *uri;
+       g_autoptr(SoupMessage) msg;
        guint status_code;
 
-       /* Send message to reviews server */
-       uri = g_strdup_printf ("/api/1.0/reviews/%s/recommendations/?reason=%s&text=%s", review_id, reason, 
text);
-       uri = soup_uri_encode (uri, NULL);
-       send_signed_request (priv->session,
-                            UBUNTU_REVIEWS_SERVER,
-                            SOUP_METHOD_POST,
-                            uri,
-                            NULL,
-                            NULL,
-                            OA_PLAINTEXT,
-                            priv->consumer_key,
-                            priv->consumer_secret,
-                            priv->token_key,
-                            priv->token_secret,
-                            error);
+       /* Create message for reviews.ubuntu.com */
+       // FIXME: escape reason / text properly
+       uri = g_strdup_printf ("%s/api/1.0/reviews/%s/recommendations/?reason=%s&text=%s", 
UBUNTU_REVIEWS_SERVER, review_id, reason, text);
+       msg = soup_message_new (SOUP_METHOD_POST, uri);
+       sign_message (msg,
+                     OA_PLAINTEXT,
+                     priv->consumer_key,
+                     priv->consumer_secret,
+                     priv->token_key,
+                     priv->token_secret);
 
+       /* Send to the server */
+       status_code = soup_session_send_message (priv->session, msg);
        if (status_code != SOUP_STATUS_OK) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]