[librest] oauth: Remove direct access to RestProxyCallPrivate



commit a721391e627e373abd66a990f20134474b0cb5f8
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Tue Sep 2 16:25:30 2014 +0200

    oauth: Remove direct access to RestProxyCallPrivate
    
    OAuthProxyCall was directly accessing private RestProxyCall data. The
    same functionality can be achieved using only librest public API, so
    let's use that instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735919

 rest/oauth-proxy-call.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/rest/oauth-proxy-call.c b/rest/oauth-proxy-call.c
index 3056753..ac94492 100644
--- a/rest/oauth-proxy-call.c
+++ b/rest/oauth-proxy-call.c
@@ -25,7 +25,6 @@
 #include <rest/rest-proxy-call.h>
 #include "oauth-proxy-call.h"
 #include "oauth-proxy-private.h"
-#include "rest-proxy-call-private.h"
 #include "sha1.h"
 
 G_DEFINE_TYPE (OAuthProxyCall, oauth_proxy_call, REST_TYPE_PROXY_CALL)
@@ -118,7 +117,6 @@ static char *
 sign_hmac (OAuthProxy *proxy, RestProxyCall *call, GHashTable *oauth_params)
 {
   OAuthProxyPrivate *priv;
-  RestProxyCallPrivate *callpriv;
   const char *url_str;
   char *key, *signature, *ep, *eep;
   const char *content_type;
@@ -129,7 +127,6 @@ sign_hmac (OAuthProxy *proxy, RestProxyCall *call, GHashTable *oauth_params)
   gboolean encode_query_params = TRUE;
 
   priv = PROXY_GET_PRIVATE (proxy);
-  callpriv = call->priv;
   url_str = rest_proxy_call_get_url (call);
 
   text = g_string_new (NULL);
@@ -157,7 +154,7 @@ sign_hmac (OAuthProxy *proxy, RestProxyCall *call, GHashTable *oauth_params)
 
   /* If one of the call's parameters is a multipart/form-data parameter, the
      signature base string must be generated with only the oauth parameters */
-  rest_params_iter_init(&params_iter, callpriv->params);
+  rest_params_iter_init(&params_iter, rest_proxy_call_get_params (call));
   while(rest_params_iter_next(&params_iter, (gpointer)&key, (gpointer)&param)) {
     content_type = rest_param_get_content_type(param);
     if (strcmp(content_type, "multipart/form-data") == 0){
@@ -172,7 +169,7 @@ sign_hmac (OAuthProxy *proxy, RestProxyCall *call, GHashTable *oauth_params)
   all_params = g_hash_table_new (g_str_hash, g_str_equal);
   merge_hashes (all_params, oauth_params);
   if (encode_query_params && !priv->oauth_echo) {
-      merge_params (all_params, callpriv->params);
+      merge_params (all_params, rest_proxy_call_get_params (call));
   }
 
 
@@ -330,12 +327,15 @@ oauth_proxy_call_parse_token_response (OAuthProxyCall *call)
 {
   OAuthProxyPrivate *priv;
   GHashTable *form;
+  OAuthProxy *proxy;
 
   /* TODO: sanity checks, error handling, probably return gboolean */
 
   g_return_if_fail (OAUTH_IS_PROXY_CALL (call));
 
-  priv = PROXY_GET_PRIVATE (REST_PROXY_CALL (call)->priv->proxy);
+  g_object_get (call, "proxy", &proxy, NULL);
+  priv = PROXY_GET_PRIVATE (proxy);
+  g_object_unref (proxy);
   g_assert (priv);
 
   form = soup_form_decode (rest_proxy_call_get_payload (REST_PROXY_CALL (call)));


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