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



commit 6ca7b49bec8a5ac43fb0f88f0788b5aab5166062
Author: William Hua <william hua canonical com>
Date:   Thu Feb 11 16:35:59 2016 -0500

    Simplify report_review ()

 src/plugins/gs-plugin-ubuntu-reviews.c |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)
---
diff --git a/src/plugins/gs-plugin-ubuntu-reviews.c b/src/plugins/gs-plugin-ubuntu-reviews.c
index be5a9fa..c8c3bca 100644
--- a/src/plugins/gs-plugin-ubuntu-reviews.c
+++ b/src/plugins/gs-plugin-ubuntu-reviews.c
@@ -1004,22 +1004,24 @@ report_review (GsPlugin *plugin,
 {
        GsPluginPrivate *priv = plugin->priv;
        g_autofree gchar *uri;
-       g_autoptr(SoupMessage) msg;
        guint status_code;
 
-       /* 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 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);
 
-       /* 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]