diff options
author | Ross Burton <ross@linux.intel.com> | 2009-05-26 17:29:54 +0100 |
---|---|---|
committer | Ross Burton <ross@linux.intel.com> | 2009-05-29 15:14:59 +0100 |
commit | aebf3c819efed32fb171b4730485403bef832a18 (patch) | |
tree | c8f9b8b02a1bea134787fba7dc44784e2d373052 | |
parent | 57e23d615bdc1257183ca7fd05331f92fd8836e0 (diff) | |
download | librest-aebf3c819efed32fb171b4730485403bef832a18.tar.gz |
Add facebook_proxy_build_permission_url
-rw-r--r-- | rest/facebook-proxy.c | 26 | ||||
-rw-r--r-- | rest/facebook-proxy.h | 2 |
2 files changed, 28 insertions, 0 deletions
diff --git a/rest/facebook-proxy.c b/rest/facebook-proxy.c index 8742934..2ca5490 100644 --- a/rest/facebook-proxy.c +++ b/rest/facebook-proxy.c @@ -326,3 +326,29 @@ facebook_proxy_build_login_url (FacebookProxy *proxy, const char *token) soup_uri_free (uri); return s; } + +char * +facebook_proxy_build_permission_url (FacebookProxy *proxy, const char *perms) +{ + SoupURI *uri; + GHashTable *params; + char *s; + + g_return_val_if_fail (FACEBOOK_IS_PROXY (proxy), NULL); + g_return_val_if_fail (perms, NULL); + + uri = soup_uri_new ("http://facebook.com/authorize.php"); + params = g_hash_table_new (g_str_hash, g_str_equal); + + g_hash_table_insert (params, "api_key", proxy->priv->api_key); + g_hash_table_insert (params, "v", "1.0"); + g_hash_table_insert (params, "ext_perm", (gpointer)perms); + + soup_uri_set_query_from_form (uri, params); + + s = soup_uri_to_string (uri, FALSE); + + g_hash_table_unref (params); + soup_uri_free (uri); + return s; +} diff --git a/rest/facebook-proxy.h b/rest/facebook-proxy.h index 9ce2184..6e6273b 100644 --- a/rest/facebook-proxy.h +++ b/rest/facebook-proxy.h @@ -83,6 +83,8 @@ char * facebook_proxy_sign (FacebookProxy *proxy, GHashTable *params); char * facebook_proxy_build_login_url (FacebookProxy *proxy, const char *frob); +char * facebook_proxy_build_permission_url (FacebookProxy *proxy, const char *perms); + G_END_DECLS #endif /* _FACEBOOK_PROXY */ |