diff options
36 files changed, 157 insertions, 3248 deletions
diff --git a/docs/reference/gdata-docs.xml b/docs/reference/gdata-docs.xml index a071a976..7d25b3f2 100644 --- a/docs/reference/gdata-docs.xml +++ b/docs/reference/gdata-docs.xml @@ -56,7 +56,6 @@ <xi:include href="xml/gdata-authorization-domain.xml"/> <xi:include href="xml/gdata-client-login-authorizer.xml"/> <xi:include href="xml/gdata-goa-authorizer.xml"><xi:fallback /></xi:include> - <xi:include href="xml/gdata-oauth1-authorizer.xml"/> <xi:include href="xml/gdata-oauth2-authorizer.xml"/> </chapter> diff --git a/docs/reference/gdata-sections.txt.in b/docs/reference/gdata-sections.txt.in index 6045ba19..41d9df51 100644 --- a/docs/reference/gdata-sections.txt.in +++ b/docs/reference/gdata-sections.txt.in @@ -2379,40 +2379,6 @@ gdata_client_login_authorizer_error_quark GDataClientLoginAuthorizerPrivate </SECTION> -<SECTION> -<FILE>gdata-oauth1-authorizer</FILE> -<TITLE>GDataOAuth1Authorizer</TITLE> -GDataOAuth1Authorizer -GDataOAuth1AuthorizerClass -gdata_oauth1_authorizer_new -gdata_oauth1_authorizer_new_for_authorization_domains -gdata_oauth1_authorizer_request_authentication_uri -gdata_oauth1_authorizer_request_authentication_uri_async -gdata_oauth1_authorizer_request_authentication_uri_finish -gdata_oauth1_authorizer_request_authorization -gdata_oauth1_authorizer_request_authorization_async -gdata_oauth1_authorizer_request_authorization_finish -gdata_oauth1_authorizer_get_application_name -gdata_oauth1_authorizer_get_locale -gdata_oauth1_authorizer_set_locale -gdata_oauth1_authorizer_get_proxy_uri -gdata_oauth1_authorizer_set_proxy_uri -gdata_oauth1_authorizer_get_proxy_resolver -gdata_oauth1_authorizer_set_proxy_resolver -gdata_oauth1_authorizer_get_timeout -gdata_oauth1_authorizer_set_timeout -<SUBSECTION Standard> -GDATA_TYPE_OAUTH1_AUTHORIZER -GDATA_OAUTH1_AUTHORIZER -GDATA_OAUTH1_AUTHORIZER_CLASS -GDATA_IS_OAUTH1_AUTHORIZER -GDATA_IS_OAUTH1_AUTHORIZER_CLASS -GDATA_OAUTH1_AUTHORIZER_GET_CLASS -gdata_oauth1_authorizer_get_type -<SUBSECTION Private> -GDataOAuth1AuthorizerPrivate -</SECTION> - @COMMENT@<SECTION> @COMMENT@<FILE>gdata-goa-authorizer</FILE> @COMMENT@<TITLE>GDataGoaAuthorizer</TITLE> diff --git a/gdata/gdata-authorizer.c b/gdata/gdata-authorizer.c index ca8002a9..fbfff764 100644 --- a/gdata/gdata-authorizer.c +++ b/gdata/gdata-authorizer.c @@ -40,8 +40,6 @@ * <itemizedlist> * <listitem>#GDataClientLoginAuthorizer for * <ulink type="http" url="http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html">ClientLogin</ulink> (deprecated)</listitem> - * <listitem>#GDataOAuth1Authorizer for - * <ulink type="http" url="http://code.google.com/apis/accounts/docs/OAuthForInstalledApps.html">OAuth 1.0</ulink> (deprecated)</listitem> * <listitem>#GDataOAuth2Authorizer for * <ulink type="http" url="https://developers.google.com/accounts/docs/OAuth2InstalledApp">OAuth 2.0</ulink> (preferred)</listitem> * </itemizedlist> diff --git a/gdata/gdata-core.symbols b/gdata/gdata-core.symbols index bd3d91dd..ff7c9ad6 100644 --- a/gdata/gdata-core.symbols +++ b/gdata/gdata-core.symbols @@ -912,24 +912,6 @@ gdata_documents_service_get_spreadsheet_authorization_domain gdata_picasaweb_service_get_primary_authorization_domain gdata_youtube_service_get_primary_authorization_domain gdata_service_get_authorization_domains -gdata_oauth1_authorizer_get_type -gdata_oauth1_authorizer_new -gdata_oauth1_authorizer_new_for_authorization_domains -gdata_oauth1_authorizer_request_authentication_uri -gdata_oauth1_authorizer_request_authentication_uri_async -gdata_oauth1_authorizer_request_authentication_uri_finish -gdata_oauth1_authorizer_request_authorization -gdata_oauth1_authorizer_request_authorization_async -gdata_oauth1_authorizer_request_authorization_finish -gdata_oauth1_authorizer_get_application_name -gdata_oauth1_authorizer_get_locale -gdata_oauth1_authorizer_set_locale -gdata_oauth1_authorizer_get_proxy_uri -gdata_oauth1_authorizer_set_proxy_uri -gdata_oauth1_authorizer_get_proxy_resolver -gdata_oauth1_authorizer_set_proxy_resolver -gdata_oauth1_authorizer_get_timeout -gdata_oauth1_authorizer_set_timeout gdata_calendar_query_get_max_attendees gdata_calendar_query_set_max_attendees gdata_calendar_query_show_deleted diff --git a/gdata/gdata-oauth1-authorizer.c b/gdata/gdata-oauth1-authorizer.c deleted file mode 100644 index 6d5fd5ec..00000000 --- a/gdata/gdata-oauth1-authorizer.c +++ /dev/null @@ -1,1497 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * GData Client - * Copyright (C) Philip Withnall 2011 <philip@tecnocode.co.uk> - * - * GData Client is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GData Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GData Client. If not, see <http://www.gnu.org/licenses/>. - */ - -/** - * SECTION:gdata-oauth1-authorizer - * @short_description: GData OAuth 1.0 authorization interface - * @stability: Stable - * @include: gdata/gdata-oauth1-authorizer.h - * - * OAuth 1.0 has been deprecated since 2012, and OAuth 2.0 (#GDataOAuth2Authorizer) should be used instead. - * - * #GDataOAuth1Authorizer provides an implementation of the #GDataAuthorizer interface for authentication and authorization using the - * <ulink type="http" url="http://code.google.com/apis/accounts/docs/OAuthForInstalledApps.html">OAuth 1.0</ulink> process, - * which was preferred by Google until OAuth 2.0 was released — it is now - * preferred to use #GDataOAuth2Authorizer. - * - * OAuth 1.0 replaces the deprecated ClientLogin process. One of the main reasons for this is to allow two-factor authentication to be supported, by - * moving the authentication interface to a web page under Google's control. - * - * The OAuth 1.0 process as implemented by Google follows the <ulink type="http" url="http://tools.ietf.org/html/rfc5849">OAuth 1.0 protocol as - * specified by IETF in RFC 5849</ulink>, with a few additions to support scopes (implemented in libgdata by #GDataAuthorizationDomains), - * locales and custom domains. Briefly, the process is initiated by requesting an authenticated request token from the Google accounts service - * (using gdata_oauth1_authorizer_request_authentication_uri()), going to the authentication URI for the request token, authenticating and authorizing - * access to the desired scopes, then providing the verifier returned by Google to the Google accounts service again (using - * gdata_oauth1_authorizer_request_authorization()) to authorize the token. This results in an access token which is attached to all future requests - * to the online service. - * - * While Google supports unregistered and registered modes for OAuth 1.0 authorization, it only supports unregistered mode for installed applications. - * Consequently, libgdata also only supports unregistered mode. For this purpose, the application name to be presented to the user on the - * authentication page at the URI returned by gdata_oauth1_authorizer_request_authentication_uri() can be specified when constructing the - * #GDataOAuth1Authorizer. - * - * As described, each authentication/authorization operation is in two parts: gdata_oauth1_authorizer_request_authentication_uri() and - * gdata_oauth1_authorizer_request_authorization(). #GDataOAuth1Authorizer stores no state about ongoing authentication operations (i.e. ones which - * have successfully called gdata_oauth1_authorizer_request_authentication_uri(), but are yet to successfully call - * gdata_oauth1_authorizer_request_authorization()). Consequently, operations can be abandoned before calling - * gdata_oauth1_authorizer_request_authorization() without problems. The only state necessary between the calls is the request token and request token - * secret, as returned by gdata_oauth1_authorizer_request_authentication_uri() and taken as parameters to - * gdata_oauth1_authorizer_request_authorization(). - * - * #GDataOAuth1Authorizer natively supports authorization against multiple services in a single authorization request (unlike - * #GDataClientLoginAuthorizer). - * - * Each access token is long lived, so reauthorization is rarely necessary with #GDataOAuth1Authorizer. Consequently, refreshing authorization using - * gdata_authorizer_refresh_authorization() is not supported by #GDataOAuth1Authorizer, and will immediately return %FALSE with no error set. - * - * <example> - * <title>Authenticating Asynchronously Using OAuth 1.0</title> - * <programlisting> - * GDataSomeService *service; - * GDataOAuth1Authorizer *authorizer; - * - * /<!-- -->* Create an authorizer and authenticate and authorize the service we're using, asynchronously. *<!-- -->/ - * authorizer = gdata_oauth1_authorizer_new (_("My libgdata application"), GDATA_TYPE_SOME_SERVICE); - * gdata_oauth1_authorizer_request_authentication_uri_async (authorizer, cancellable, - * (GAsyncReadyCallback) request_authentication_uri_cb, user_data); - * - * /<!-- -->* Create a service object and link it with the authorizer *<!-- -->/ - * service = gdata_some_service_new (GDATA_AUTHORIZER (authorizer)); - * - * static void - * request_authentication_uri_cb (GDataOAuth1Authorizer *authorizer, GAsyncResult *async_result, gpointer user_data) - * { - * gchar *authentication_uri, *token, *token_secret, *verifier; - * GError *error = NULL; - * - * authentication_uri = gdata_oauth1_authorizer_request_authentication_uri_finish (authorizer, async_result, &token, &token_secret, - * &error); - * - * if (error != NULL) { - * /<!-- -->* Notify the user of all errors except cancellation errors *<!-- -->/ - * if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { - * g_error ("Requesting a token failed: %s", error->message); - * } - * - * g_error_free (error); - * goto finish; - * } - * - * /<!-- -->* (Present the page at the authentication URI to the user, either in an embedded or stand-alone web browser, and - * * ask them to grant access to the application and return the verifier Google gives them.) *<!-- -->/ - * verifier = ask_user_for_verifier (authentication_uri); - * - * gdata_oauth1_authorizer_request_authorization_async (authorizer, token, token_secret, verifier, cancellable, - * (GAsyncReadyCallback) request_authorization_cb, user_data); - * - * finish: - * g_free (verifier); - * g_free (authentication_uri); - * g_free (token); - * - * /<!-- -->* Zero out the secret before freeing. *<!-- -->/ - * if (token_secret != NULL) { - * memset (token_secret, 0, strlen (token_secret)); - * } - * - * g_free (token_secret); - * } - * - * static void - * request_authorization_cb (GDataOAuth1Authorizer *authorizer, GAsyncResult *async_result, gpointer user_data) - * { - * GError *error = NULL; - * - * if (gdata_oauth1_authorizer_request_authorization_finish (authorizer, async_result, &error) == FALSE) { - * /<!-- -->* Notify the user of all errors except cancellation errors *<!-- -->/ - * if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { - * g_error ("Authorization failed: %s", error->message); - * } - * - * g_error_free (error); - * return; - * } - * - * /<!-- -->* (The client is now authenticated and authorized against the service. - * * It can now proceed to execute queries on the service object which require the user to be authenticated.) *<!-- -->/ - * } - * - * g_object_unref (service); - * g_object_unref (authorizer); - * </programlisting> - * </example> - * - * Since: 0.9.0 - */ - -#include <config.h> -#include <string.h> -#include <glib.h> -#include <glib/gi18n-lib.h> - -#ifdef ENABLE_OAUTH1 -#include <oauth.h> -#endif - -#include "gdata-oauth1-authorizer.h" -#include "gdata-private.h" - -#define HMAC_SHA1_LEN 20 /* bytes, raw */ - -static void authorizer_init (GDataAuthorizerInterface *iface); -static void dispose (GObject *object); -static void finalize (GObject *object); -static void get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); -static void set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); - -static void process_request (GDataAuthorizer *self, GDataAuthorizationDomain *domain, SoupMessage *message); -static gboolean is_authorized_for_domain (GDataAuthorizer *self, GDataAuthorizationDomain *domain); - -static void sign_message (GDataOAuth1Authorizer *self, SoupMessage *message, const gchar *token, const gchar *token_secret, GHashTable *parameters); - -static void notify_proxy_uri_cb (GObject *object, GParamSpec *pspec, GDataOAuth1Authorizer *self); -static void notify_timeout_cb (GObject *gobject, GParamSpec *pspec, GObject *self); - -static SoupURI *_get_proxy_uri (GDataOAuth1Authorizer *self); -static void _set_proxy_uri (GDataOAuth1Authorizer *self, SoupURI *proxy_uri); - -struct _GDataOAuth1AuthorizerPrivate { - SoupSession *session; - SoupURI *proxy_uri; /* cached version only set if gdata_oauth1_authorizer_get_proxy_uri() is called */ - GProxyResolver *proxy_resolver; - - gchar *application_name; - gchar *locale; - - GMutex mutex; /* mutex for token, token_secret and authorization_domains */ - - /* Note: This is the access token, not the request token returned by gdata_oauth1_authorizer_request_authentication_uri(). - * It's NULL iff the authorizer isn't authenticated. token_secret must be NULL iff token is NULL. */ - gchar *token; - GDataSecureString token_secret; /* must be allocated by _gdata_service_secure_strdup() */ - - /* Mapping from GDataAuthorizationDomain to itself; a set of domains for which ->access_token is valid. */ - GHashTable *authorization_domains; -}; - -enum { - PROP_APPLICATION_NAME = 1, - PROP_LOCALE, - PROP_PROXY_URI, - PROP_TIMEOUT, - PROP_PROXY_RESOLVER, -}; - -G_DEFINE_TYPE_WITH_CODE (GDataOAuth1Authorizer, gdata_oauth1_authorizer, G_TYPE_OBJECT, - G_ADD_PRIVATE (GDataOAuth1Authorizer) - G_IMPLEMENT_INTERFACE (GDATA_TYPE_AUTHORIZER, authorizer_init)) - -static void -gdata_oauth1_authorizer_class_init (GDataOAuth1AuthorizerClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - gobject_class->get_property = get_property; - gobject_class->set_property = set_property; - gobject_class->dispose = dispose; - gobject_class->finalize = finalize; - - /** - * GDataOAuth1Authorizer:application-name: - * - * The human-readable, translated application name for the client, to be presented to the user on the authentication page at the URI - * returned by gdata_oauth1_authorizer_request_authentication_uri(). - * - * If %NULL is provided in the constructor to #GDataOAuth1Authorizer, the value returned by g_get_application_name() will be used as a - * fallback. Note that this may also be %NULL: in this case, the authentication page will use the application name “anonymous”. - * - * Since: 0.9.0 - */ - g_object_class_install_property (gobject_class, PROP_APPLICATION_NAME, - g_param_spec_string ("application-name", - "Application name", "The human-readable, translated application name for the client.", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - /** - * GDataOAuth1Authorizer:locale: - * - * The locale to use for network requests, in Unix locale format. (e.g. "en_GB", "cs", "de_DE".) Use %NULL for the default "C" locale - * (typically "en_US"). - * - * This locale will be used by the server-side software to localise the authentication and authorization pages at the URI returned by - * gdata_oauth1_authorizer_request_authentication_uri(). - * - * The server-side behaviour is undefined if it doesn't support a given locale. - * - * Since: 0.9.0 - */ - g_object_class_install_property (gobject_class, PROP_LOCALE, - g_param_spec_string ("locale", - "Locale", "The locale to use for network requests, in Unix locale format.", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - /** - * GDataOAuth1Authorizer:proxy-uri: - * - * The proxy URI used internally for all network requests. - * - * Since: 0.9.0 - * Deprecated: 0.15.0: Use #GDataClientLoginAuthorizer:proxy-resolver instead, which gives more flexibility over the proxy used. - */ - g_object_class_install_property (gobject_class, PROP_PROXY_URI, - g_param_spec_boxed ("proxy-uri", - "Proxy URI", "The proxy URI used internally for all network requests.", - SOUP_TYPE_URI, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - /** - * GDataOAuth1Authorizer:timeout: - * - * A timeout, in seconds, for network operations. If the timeout is exceeded, the operation will be cancelled and - * %GDATA_SERVICE_ERROR_NETWORK_ERROR will be returned. - * - * If the timeout is <code class="literal">0</code>, operations will never time out. - * - * Since: 0.9.0 - */ - g_object_class_install_property (gobject_class, PROP_TIMEOUT, - g_param_spec_uint ("timeout", - "Timeout", "A timeout, in seconds, for network operations.", - 0, G_MAXUINT, 0, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - /** - * GDataOAuth1Authorizer:proxy-resolver: - * - * The #GProxyResolver used to determine a proxy URI. Setting this will clear the #GDataOAuth1Authorizer:proxy-uri property. - * - * Since: 0.15.0 - */ - g_object_class_install_property (gobject_class, PROP_PROXY_RESOLVER, - g_param_spec_object ("proxy-resolver", - "Proxy Resolver", "A GProxyResolver used to determine a proxy URI.", - G_TYPE_PROXY_RESOLVER, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -} - -static void -authorizer_init (GDataAuthorizerInterface *iface) -{ - iface->process_request = process_request; - iface->is_authorized_for_domain = is_authorized_for_domain; -} - -static void -gdata_oauth1_authorizer_init (GDataOAuth1Authorizer *self) -{ - self->priv = gdata_oauth1_authorizer_get_instance_private (self); - - /* Set up the authorizer's mutex */ - g_mutex_init (&(self->priv->mutex)); - self->priv->authorization_domains = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL); - - /* Set up the session */ - self->priv->session = _gdata_service_build_session (); - - /* Proxy the SoupSession's proxy-uri and timeout properties */ - g_signal_connect (self->priv->session, "notify::proxy-uri", (GCallback) notify_proxy_uri_cb, self); - g_signal_connect (self->priv->session, "notify::timeout", (GCallback) notify_timeout_cb, self); - - /* Keep our GProxyResolver synchronized with SoupSession's. */ - g_object_bind_property (self->priv->session, "proxy-resolver", self, "proxy-resolver", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); -} - -static void -dispose (GObject *object) -{ - GDataOAuth1AuthorizerPrivate *priv = GDATA_OAUTH1_AUTHORIZER (object)->priv; - - if (priv->session != NULL) - g_object_unref (priv->session); - priv->session = NULL; - - g_clear_object (&priv->proxy_resolver); - - /* Chain up to the parent class */ - G_OBJECT_CLASS (gdata_oauth1_authorizer_parent_class)->dispose (object); -} - -static void -finalize (GObject *object) -{ - GDataOAuth1AuthorizerPrivate *priv = GDATA_OAUTH1_AUTHORIZER (object)->priv; - - g_free (priv->application_name); - g_free (priv->locale); - - g_hash_table_destroy (priv->authorization_domains); - g_mutex_clear (&(priv->mutex)); - - if (priv->proxy_uri != NULL) { - soup_uri_free (priv->proxy_uri); - } - - g_free (priv->token); - _gdata_service_secure_strfree (priv->token_secret); - - /* Chain up to the parent class */ - G_OBJECT_CLASS (gdata_oauth1_authorizer_parent_class)->finalize (object); -} - -static void -get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) -{ - GDataOAuth1AuthorizerPrivate *priv = GDATA_OAUTH1_AUTHORIZER (object)->priv; - - switch (property_id) { - case PROP_APPLICATION_NAME: - g_value_set_string (value, priv->application_name); - break; - case PROP_LOCALE: - g_value_set_string (value, priv->locale); - break; - case PROP_PROXY_URI: - g_value_set_boxed (value, _get_proxy_uri (GDATA_OAUTH1_AUTHORIZER (object))); - break; - case PROP_TIMEOUT: - g_value_set_uint (value, gdata_oauth1_authorizer_get_timeout (GDATA_OAUTH1_AUTHORIZER (object))); - break; - case PROP_PROXY_RESOLVER: - g_value_set_object (value, gdata_oauth1_authorizer_get_proxy_resolver (GDATA_OAUTH1_AUTHORIZER (object))); - break; - default: - /* We don't have any other property... */ - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) -{ - GDataOAuth1AuthorizerPrivate *priv = GDATA_OAUTH1_AUTHORIZER (object)->priv; - - switch (property_id) { - /* Construct only */ - case PROP_APPLICATION_NAME: - priv->application_name = g_value_dup_string (value); - - /* Default to the value of g_get_application_name() */ - if (priv->application_name == NULL || *(priv->application_name) == '\0') { - g_free (priv->application_name); - priv->application_name = g_strdup (g_get_application_name ()); - } - - break; - case PROP_LOCALE: - gdata_oauth1_authorizer_set_locale (GDATA_OAUTH1_AUTHORIZER (object), g_value_get_string (value)); - break; - case PROP_PROXY_URI: - _set_proxy_uri (GDATA_OAUTH1_AUTHORIZER (object), g_value_get_boxed (value)); - break; - case PROP_TIMEOUT: - gdata_oauth1_authorizer_set_timeout (GDATA_OAUTH1_AUTHORIZER (object), g_value_get_uint (value)); - break; - case PROP_PROXY_RESOLVER: - gdata_oauth1_authorizer_set_proxy_resolver (GDATA_OAUTH1_AUTHORIZER (object), g_value_get_object (value)); - break; - default: - /* We don't have any other property... */ - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -process_request (GDataAuthorizer *self, GDataAuthorizationDomain *domain, SoupMessage *message) -{ - GDataOAuth1AuthorizerPrivate *priv = GDATA_OAUTH1_AUTHORIZER (self)->priv; - - /* Set the authorisation header */ - g_mutex_lock (&(priv->mutex)); - - /* Sanity check */ - g_assert ((priv->token == NULL) == (priv->token_secret == NULL)); - - if (priv->token != NULL && g_hash_table_lookup (priv->authorization_domains, domain) != NULL) { - sign_message (GDATA_OAUTH1_AUTHORIZER (self), message, priv->token, priv->token_secret, NULL); - } - - g_mutex_unlock (&(priv->mutex)); -} - -static gboolean -is_authorized_for_domain (GDataAuthorizer *self, GDataAuthorizationDomain *domain) -{ - GDataOAuth1AuthorizerPrivate *priv = GDATA_OAUTH1_AUTHORIZER (self)->priv; - gpointer result; - const gchar *token; - - g_mutex_lock (&(priv->mutex)); - token = priv->token; - result = g_hash_table_lookup (priv->authorization_domains, domain); - g_mutex_unlock (&(priv->mutex)); - - /* Sanity check */ - g_assert (result == NULL || result == domain); - - return (token != NULL && result != NULL) ? TRUE : FALSE; -} - -/* Sign the message and add the Authorization header to it containing the signature. - * NOTE: This must not lock priv->mutex, as it's called from within a critical section in process_request() and priv->mutex isn't recursive. */ -static void -sign_message (GDataOAuth1Authorizer *self, SoupMessage *message, const gchar *token, const gchar *token_secret, GHashTable *parameters) -{ -#ifdef ENABLE_OAUTH1 - GHashTableIter iter; - const gchar *key, *value, *consumer_key, *consumer_secret, *signature_method; - gsize params_length = 0; - GList *sorted_params = NULL, *i; - GString *query_string, *signature_base_string, *secret_string, *authorization_header; - SoupURI *normalised_uri; - gchar *uri, *signature, *timestamp; - char *nonce; - gboolean is_first = TRUE; - gint64 time_val; - guchar signature_buf[HMAC_SHA1_LEN]; - gsize signature_buf_len; - GHmac *signature_hmac; - - g_return_if_fail (GDATA_IS_OAUTH1_AUTHORIZER (self)); - g_return_if_fail (SOUP_IS_MESSAGE (message)); - g_return_if_fail (token == NULL || *token != '\0'); - g_return_if_fail (token_secret == NULL || *token_secret != '\0'); - g_return_if_fail ((token == NULL) == (token_secret == NULL)); - - /* Build and return a HMAC-SHA1 signature for the given SoupMessage. We always use HMAC-SHA1, since installed applications have to be - * unregistered (see: http://code.google.com/apis/accounts/docs/OAuth_ref.html#SigningOAuth). - * Reference: http://tools.ietf.org/html/rfc5849#section-3.4 */ - signature_method = "HMAC-SHA1"; - - /* As described here, we use an anonymous consumer key and secret, since we're designed for installed applications: - * http://code.google.com/apis/accounts/docs/OAuth_ref.html#SigningOAuth */ - consumer_key = "anonymous"; - consumer_secret = "anonymous"; - - /* Add various standard parameters to the list (note: this modifies the hash table belonging to the caller) */ - nonce = oauth_gen_nonce (); - time_val = g_get_real_time () / G_USEC_PER_SEC; - timestamp = g_strdup_printf ("%li", time_val); - - if (parameters == NULL) { - parameters = g_hash_table_new (g_str_hash, g_str_equal); - } else { - g_hash_table_ref (parameters); - } - - g_hash_table_insert (parameters, (gpointer) "oauth_signature_method", (gpointer) signature_method); - g_hash_table_insert (parameters, (gpointer) "oauth_consumer_key", (gpointer) consumer_key); - g_hash_table_insert (parameters, (gpointer) "oauth_nonce", nonce); - g_hash_table_insert (parameters, (gpointer) "oauth_timestamp", timestamp); - g_hash_table_insert (parameters, (gpointer) "oauth_version", (gpointer) "1.0"); - - /* Only add the token if it's been provided */ - if (token != NULL) { - g_hash_table_insert (parameters, (gpointer) "oauth_token", (gpointer) token); - } - - /* Sort the parameters and build a query string, as defined here: http://tools.ietf.org/html/rfc5849#section-3.4.1.3 */ - g_hash_table_iter_init (&iter, parameters); - - while (g_hash_table_iter_next (&iter, (gpointer*) &key, (gpointer*) &value) == TRUE) { - GString *pair = g_string_new (NULL); - - g_string_append_uri_escaped (pair, key, NULL, FALSE); - g_string_append_c (pair, '='); - g_string_append_uri_escaped (pair, value, NULL, FALSE); - - /* Append the pair to the list for sorting, and keep track of the total length of the strings in the list so far */ - params_length += pair->len + 1 /* sep */; - sorted_params = g_list_prepend (sorted_params, g_string_free (pair, FALSE)); - } - - g_hash_table_unref (parameters); - - sorted_params = g_list_sort (sorted_params, (GCompareFunc) g_strcmp0); - - /* Concatenate the parameters to give the query string */ - query_string = g_string_sized_new (params_length); - - for (i = sorted_params; i != NULL; i = i->next) { - if (is_first == FALSE) { - g_string_append_c (query_string, '&'); - } - - g_string_append (query_string, i->data); - - g_free (i->data); - is_first = FALSE; - } - - g_list_free (sorted_params); - - /* Normalise the URI as described here: http://tools.ietf.org/html/rfc5849#section-3.4.1.2 */ - normalised_uri = soup_uri_copy (soup_message_get_uri (message)); - soup_uri_set_query (normalised_uri, NULL); - soup_uri_set_fragment (normalised_uri, NULL); - - /* Append it to the signature base string */ - uri = soup_uri_to_string (normalised_uri, FALSE); - - /* Start building the signature base string as described here: http://tools.ietf.org/html/rfc5849#section-3.4.1.1 */ - signature_base_string = g_string_sized_new (4 /* method */ + 1 /* sep */ + strlen (uri) + 1 /* sep */ + params_length /* query string */); - g_string_append_uri_escaped (signature_base_string, message->method, NULL, FALSE); - g_string_append_c (signature_base_string, '&'); - g_string_append_uri_escaped (signature_base_string, uri, NULL, FALSE); - g_string_append_c (signature_base_string, '&'); - g_string_append_uri_escaped (signature_base_string, query_string->str, NULL, FALSE); - - g_free (uri); - soup_uri_free (normalised_uri); - g_string_free (query_string, TRUE); - - /* Build the secret key to use in the HMAC */ - secret_string = g_string_new (NULL); - g_string_append_uri_escaped (secret_string, consumer_secret, NULL, FALSE); - g_string_append_c (secret_string, '&'); - - /* Only add token_secret if it was provided */ - if (token_secret != NULL) { - g_string_append_uri_escaped (secret_string, token_secret, NULL, FALSE); - } - - /* Create the signature as described here: http://tools.ietf.org/html/rfc5849#section-3.4.2 */ - signature_hmac = g_hmac_new (G_CHECKSUM_SHA1, (const guchar*) secret_string->str, secret_string->len); - g_hmac_update (signature_hmac, (const guchar*) signature_base_string->str, signature_base_string->len); - - signature_buf_len = G_N_ELEMENTS (signature_buf); - g_hmac_get_digest (signature_hmac, signature_buf, &signature_buf_len); - - g_hmac_unref (signature_hmac); - - signature = g_base64_encode (signature_buf, signature_buf_len); - - /*g_debug ("Signing message using Signature Base String: “%s” and key “%s” using method “%s” to give signature: “%s”.", - signature_base_string->str, secret_string->str, signature_method, signature);*/ - - /* Zero out the secret_string before freeing it, to reduce the chance of secrets hitting disk. */ - memset (secret_string->str, 0, secret_string->allocated_len); - - g_string_free (secret_string, TRUE); - g_string_free (signature_base_string, TRUE); - - /* Build the Authorization header and append it to the message */ - authorization_header = g_string_new ("OAuth oauth_consumer_key=\""); - g_string_append_uri_escaped (authorization_header, consumer_key, NULL, FALSE); - - /* Only add the token if it's been provided */ - if (token != NULL) { - g_string_append (authorization_header, "\",oauth_token=\""); - g_string_append_uri_escaped (authorization_header, token, NULL, FALSE); - } - - g_string_append (authorization_header, "\",oauth_signature_method=\""); - g_string_append_uri_escaped (authorization_header, signature_method, NULL, FALSE); - g_string_append (authorization_header, "\",oauth_signature=\""); - g_string_append_uri_escaped (authorization_header, signature, NULL, FALSE); - g_string_append (authorization_header, "\",oauth_timestamp=\""); - g_string_append_uri_escaped (authorization_header, timestamp, NULL, FALSE); - g_string_append (authorization_header, "\",oauth_nonce=\""); - g_string_append_uri_escaped (authorization_header, nonce, NULL, FALSE); - g_string_append (authorization_header, "\",oauth_version=\"1.0\""); - - soup_message_headers_replace (message->request_headers, "Authorization", authorization_header->str); - - g_string_free (authorization_header, TRUE); - free (signature); - g_free (timestamp); - free (nonce); -#endif /* ENABLE_OAUTH1 */ -} - -/** - * gdata_oauth1_authorizer_new: - * @application_name: (allow-none): a human-readable, translated application name to use on authentication pages, or %NULL - * @service_type: the #GType of a #GDataService subclass which the #GDataOAuth1Authorizer will be used with - * - * Creates a new #GDataOAuth1Authorizer. - * - * The #GDataAuthorizationDomains for the given @service_type (i.e. as returned by gdata_service_get_authorization_domains()) are the ones the - * user will be requested to authorize access to on the page at the URI returned by gdata_oauth1_authorizer_request_authentication_uri(). - * - * The given @application_name will set the value of #GDataOAuth1Authorizer:application-name and will be displayed to the user on authentication pages - * returned by Google. If %NULL is provided, the value of g_get_application_name() will be used as a fallback. - * - * Return value: (transfer full): a new #GDataOAuth1Authorizer; unref with g_object_unref() - * - * Since: 0.9.0 - */ -GDataOAuth1Authorizer * -gdata_oauth1_authorizer_new (const gchar *application_name, GType service_type) -{ - g_return_val_if_fail (g_type_is_a (service_type, GDATA_TYPE_SERVICE), NULL); - - return gdata_oauth1_authorizer_new_for_authorization_domains (application_name, gdata_service_get_authorization_domains (service_type)); -} - -/** - * gdata_oauth1_authorizer_new_for_authorization_domains: - * @application_name: (allow-none): a human-readable, translated application name to use on authentication pages, or %NULL - * @authorization_domains: (element-type GDataAuthorizationDomain) (transfer none): a non-empty list of #GDataAuthorizationDomains to be - * authorized against by the #GDataOAuth1Authorizer - * - * Creates a new #GDataOAuth1Authorizer. This function is intended to be used only when the default authorization domain list for a single - * #GDataService, as used by gdata_oauth1_authorizer_new(), isn't suitable. For example, this could be because the #GDataOAuth1Authorizer will be used - * with multiple #GDataService subclasses, or because the client requires a specific set of authorization domains. - * - * The specified #GDataAuthorizationDomains are the ones the user will be requested to authorize access to on the page at the URI returned by - * gdata_oauth1_authorizer_request_authentication_uri(). - * - * The given @application_name will set the value of #GDataOAuth1Authorizer:application-name and will be displayed to the user on authentication pages - * returned by Google. If %NULL is provided, the value of g_get_application_name() will be used as a fallback. - * - * Return value: (transfer full): a new #GDataOAuth1Authorizer; unref with g_object_unref() - * - * Since: 0.9.0 - */ -GDataOAuth1Authorizer * -gdata_oauth1_authorizer_new_for_authorization_domains (const gchar *application_name, GList *authorization_domains) -{ - GList *i; - GDataOAuth1Authorizer *authorizer; - - g_return_val_if_fail (authorization_domains != NULL, NULL); - - authorizer = GDATA_OAUTH1_AUTHORIZER (g_object_new (GDATA_TYPE_OAUTH1_AUTHORIZER, - "application-name", application_name, - NULL)); - - /* Register all the domains with the authorizer */ - for (i = authorization_domains; i != NULL; i = i->next) { - g_return_val_if_fail (GDATA_IS_AUTHORIZATION_DOMAIN (i->data), NULL); - - /* We don't have to lock the authoriser's mutex here as no other code has seen the authoriser yet */ - g_hash_table_insert (authorizer->priv->authorization_domains, g_object_ref (GDATA_AUTHORIZATION_DOMAIN (i->data)), i->data); - } - - return authorizer; -} - -/** - * gdata_oauth1_authorizer_request_authentication_uri: - * @self: a #GDataOAuth1Authorizer - * @token: (out callee-allocates): return location for the temporary credentials token returned by the authentication service; free with g_free() - * @token_secret: (out callee-allocates): return location for the temporary credentials token secret returned by the authentication service; free with - * g_free() - * @cancellable: (allow-none): optional #GCancellable object, or %NULL - * @error: a #GError, or %NULL - * - * Requests a fresh unauthenticated token from the Google accounts service and builds and returns the URI of an authentication page for that token. - * This should then be presented to the user (e.g. in an embedded or stand alone web browser). The authentication page will ask the user to log in - * using their Google account, then ask them to grant access to the #GDataAuthorizationDomains passed to the constructor of the - * #GDataOAuth1Authorizer. If the user grants access, they will be given a verifier, which can then be passed to - * gdata_oauth1_authorizer_request_authorization() (along with the @token and @token_secret values returned by this method) to authorize the token. - * - * This method can fail if the server returns an error, but this is unlikely. If it does happen, a %GDATA_SERVICE_ERROR_PROTOCOL_ERROR will be - * raised, @token and @token_secret will be set to %NULL and %NULL will be returned. - * - * This method implements <ulink type="http" url="http://tools.ietf.org/html/rfc5849#section-2.1">Section 2.1</ulink> and - * <ulink type="http" url="http://tools.ietf.org/html/rfc5849#section-2.2">Section 2.2</ulink> of the - * <ulink type="http" url="http://tools.ietf.org/html/rfc5849">OAuth 1.0 protocol</ulink>. - * - * When freeing @token_secret, it's advisable to set it to all zeros first, to reduce the chance of the sensitive token being recoverable from the - * free memory pool and (accidentally) leaked by a different part of the process. This can be achieved with the following code: - * |[ - * if (token_secret != NULL) { - * memset (token_secret, 0, strlen (token_secret)); - * g_free (token_secret); - * } - * ]| - * - * Return value: (transfer full): the URI of an authentication page for the user to use; free with g_free() - * - * Since: 0.9.0 - */ -gchar * -gdata_oauth1_authorizer_request_authentication_uri (GDataOAuth1Authorizer *self, gchar **token, gchar **token_secret, - GCancellable *cancellable, GError **error) -{ -#ifdef ENABLE_OAUTH1 - GDataOAuth1AuthorizerPrivate *priv; - SoupMessage *message; - guint status; - gchar *request_body; - GString *scope_string, *authentication_uri; - GHashTable *parameters; - GHashTableIter iter; - gboolean is_first = TRUE; - GDataAuthorizationDomain *domain; - GHashTable *response_details; - const gchar *callback_uri, *_token, *_token_secret, *callback_confirmed; - SoupURI *_uri; -#endif - - g_return_val_if_fail (GDATA_IS_OAUTH1_AUTHORIZER (self), NULL); - g_return_val_if_fail (token != NULL, NULL); - g_return_val_if_fail (token_secret != NULL, NULL); - g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); - g_return_val_if_fail (error == NULL || *error == NULL, NULL); - -#ifdef ENABLE_OAUTH1 - priv = self->priv; - - /* This implements OAuthGetRequestToken and returns the URI for OAuthAuthorizeToken, which the client must then use themselves (e.g. in an - * embedded web browser) to authorise the temporary credentials token. They then pass the request token and verification code they get back - * from that to gdata_oauth1_authorizer_request_authorization(). */ - - /* We default to out-of-band callbacks */ - callback_uri = "oob"; - - /* Set the output parameters to NULL in case of failure */ - *token = NULL; - *token_secret = NULL; - - /* Build up the space-separated list of scopes we're requesting authorisation for */ - g_mutex_lock (&(priv->mutex)); - - scope_string = g_string_new (NULL); - g_hash_table_iter_init (&iter, priv->authorization_domains); - - while (g_hash_table_iter_next (&iter, (gpointer*) &domain, NULL) == TRUE) { - if (is_first == FALSE) { - /* Delimiter */ - g_string_append_c (scope_string, ' '); - } - - g_string_append (scope_string, gdata_authorization_domain_get_scope (domain)); - - is_first = FALSE; - } - - g_mutex_unlock (&(priv->mutex)); - - /* Build the request body and the set of parameters to be signed */ - parameters = g_hash_table_new (g_str_hash, g_str_equal); - g_hash_table_insert (parameters, (gpointer) "scope", scope_string->str); - g_hash_table_insert (parameters, (gpointer) "xoauth_displayname", priv->application_name); - g_hash_table_insert (parameters, (gpointer) "oauth_callback", (gpointer) callback_uri); - request_body = soup_form_encode_hash (parameters); - - /* Build the message */ - _uri = soup_uri_new ("https://www.google.com/accounts/OAuthGetRequestToken"); - soup_uri_set_port (_uri, _gdata_service_get_https_port ()); - message = soup_message_new_from_uri (SOUP_METHOD_POST, _uri); - soup_uri_free (_uri); - - soup_message_set_request (message, "application/x-www-form-urlencoded", SOUP_MEMORY_TAKE, request_body, strlen (request_body)); - - sign_message (self, message, NULL, NULL, parameters); - - g_hash_table_destroy (parameters); - g_string_free (scope_string, TRUE); - - /* Send the message */ - _gdata_service_actually_send_message (priv->session, message, cancellable, error); - status = message->status_code; - - if (status == SOUP_STATUS_CANCELLED) { - /* Cancelled (the error has already been set) */ - g_object_unref (message); - return NULL; - } else if (status != SOUP_STATUS_OK) { - /* Server returned an error. Not much we can do, since the error codes aren't documented and it shouldn't normally ever happen - * anyway. */ - g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_PROTOCOL_ERROR, - _("The server rejected the temporary credentials request.")); - g_object_unref (message); - - return NULL; - } - - g_assert (message->response_body->data != NULL); - - /* Parse the response. We expect something like: - * oauth_token=ab3cd9j4ks73hf7g&oauth_token_secret=ZXhhbXBsZS5jb20&oauth_callback_confirmed=true - * See: http://code.google.com/apis/accounts/docs/OAuth_ref.html#RequestToken and - * http://tools.ietf.org/html/rfc5849#section-2.1 for details. */ - response_details = soup_form_decode (message->response_body->data); - - g_object_unref (message); - - _token = g_hash_table_lookup (response_details, "oauth_token"); - _token_secret = g_hash_table_lookup (response_details, "oauth_token_secret"); - callback_confirmed = g_hash_table_lookup (response_details, "oauth_callback_confirmed"); - - /* Validate the returned values */ - if (_token == NULL || _token_secret == NULL || callback_confirmed == NULL || - *_token == '\0' || *_token_secret == '\0' || - strcmp (callback_confirmed, "true") != 0) { - g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_PROTOCOL_ERROR, - _("The server returned a malformed response.")); - g_hash_table_destroy (response_details); - - return NULL; - } - - /* Build the authentication URI which the user will then open in a web browser and use to authenticate and authorise our application. - * We expect to build something like this: - * https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token=ab3cd9j4ks73hf7g&hd=mycollege.edu&hl=en&btmpl=mobile - * See: http://code.google.com/apis/accounts/docs/OAuth_ref.html#GetAuth for more details. */ - authentication_uri = g_string_new ("https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token="); - g_string_append_uri_escaped (authentication_uri, g_hash_table_lookup (response_details, "oauth_token"), NULL, TRUE); - - if (priv->locale != NULL) { - g_string_append (authentication_uri, "&hl="); - g_string_append_uri_escaped (authentication_uri, priv->locale, NULL, TRUE); - } - - /* Return the token and token secret */ - *token = g_strdup (_token); - *token_secret = g_strdup (_token_secret); /* NOTE: Ideally this would be allocated in non-pageable memory, but changing that would break API */ - - g_hash_table_destroy (response_details); - - return g_string_free (authentication_uri, FALSE); -#else /* if !ENABLE_OAUTH1 */ - *token = NULL; - *token_secret = NULL; - - if (!g_cancellable_set_error_if_cancelled (cancellable, error)) - g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_UNAVAILABLE, - _("OAuth 1.0 support is disabled.")); - - return NULL; -#endif -} - -typedef struct { - /* All return values */ - gchar *token; - gchar *token_secret; /* NOTE: Ideally this would be allocated in non-pageable memory, but changing that would break API */ - gchar *authentication_uri; -} RequestAuthenticationUriAsyncData; - -static void -request_authentication_uri_async_data_free (RequestAuthenticationUriAsyncData *data) -{ - g_free (data->token); - g_free (data->token_secret); - g_free (data->authentication_uri); - - g_slice_free (RequestAuthenticationUriAsyncData, data); -} - -G_DEFINE_AUTOPTR_CLEANUP_FUNC (RequestAuthenticationUriAsyncData, request_authentication_uri_async_data_free) - -static void -request_authentication_uri_thread (GTask *task, gpointer source_object, gpointer task_data, GCancellable *cancellable) -{ - GDataOAuth1Authorizer *authorizer = GDATA_OAUTH1_AUTHORIZER (source_object); - g_autoptr(RequestAuthenticationUriAsyncData) data = NULL; - g_autoptr(GError) error = NULL; - - data = g_slice_new0 (RequestAuthenticationUriAsyncData); - data->authentication_uri = gdata_oauth1_authorizer_request_authentication_uri (authorizer, &(data->token), &(data->token_secret), - cancellable, &error); - - if (error != NULL) - g_task_return_error (task, g_steal_pointer (&error)); - else - g_task_return_pointer (task, g_steal_pointer (&data), (GDestroyNotify) request_authentication_uri_async_data_free); -} - -/** - * gdata_oauth1_authorizer_request_authentication_uri_async: - * @self: a #GDataOAuth1Authorizer - * @cancellable: (allow-none): optional #GCancellable object, or %NULL - * @callback: a #GAsyncReadyCallback to call when building the URI is finished - * @user_data: (closure): data to pass to the @callback function - * - * Requests a fresh unauthenticated token from the Google accounts service and builds and returns the URI of an authentication page for that token. - * @self is reffed when this method is called, so can safely be unreffed after this method returns. - * - * For more details, see gdata_oauth1_authorizer_request_authentication_uri(), which is the synchronous version of this method. - * - * When the operation is finished, @callback will be called. You can then call gdata_oauth1_authorizer_request_authentication_uri_finish() to get the - * results of the operation. - * - * Since: 0.9.0 - */ -void -gdata_oauth1_authorizer_request_authentication_uri_async (GDataOAuth1Authorizer *self, GCancellable *cancellable, - GAsyncReadyCallback callback, gpointer user_data) -{ - g_autoptr(GTask) task = NULL; - - g_return_if_fail (GDATA_IS_OAUTH1_AUTHORIZER (self)); - g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); - g_return_if_fail (callback != NULL); - - task = g_task_new (self, cancellable, callback, user_data); - g_task_set_source_tag (task, gdata_oauth1_authorizer_request_authentication_uri_async); - g_task_run_in_thread (task, request_authentication_uri_thread); -} - -/** - * gdata_oauth1_authorizer_request_authentication_uri_finish: - * @self: a #GDataOAuth1Authorizer - * @async_result: a #GAsyncResult - * @token: (out callee-allocates): return location for the temporary credentials token returned by the authentication service; free with g_free() - * @token_secret: (out callee-allocates): return location for the temporary credentials token secret returned by the authentication service; free with - * g_free() - * @error: a #GError, or %NULL - * - * Finishes an asynchronous authentication URI building operation started with gdata_oauth1_authorizer_request_authentication_uri_async(). - * - * This method can fail if the server has returned an error, but this is unlikely. If it does happen, a %GDATA_SERVICE_ERROR_PROTOCOL_ERROR will be - * raised, @token and @token_secret will be set to %NULL and %NULL will be returned. - * - * When freeing @token_secret, it's advisable to set it to all zeros first, to reduce the chance of the sensitive token being recoverable from the - * free memory pool and (accidentally) leaked by a different part of the process. This can be achieved with the following code: - * |[ - * if (token_secret != NULL) { - * memset (token_secret, 0, strlen (token_secret)); - * g_free (token_secret); - * } - * ]| - * - * Return value: (transfer full): the URI of an authentication page for the user to use; free with g_free() - * - * Since: 0.9.0 - */ -gchar * -gdata_oauth1_authorizer_request_authentication_uri_finish (GDataOAuth1Authorizer *self, GAsyncResult *async_result, gchar **token, - gchar **token_secret, GError **error) -{ - g_autoptr(RequestAuthenticationUriAsyncData) data = NULL; - - g_return_val_if_fail (GDATA_IS_OAUTH1_AUTHORIZER (self), NULL); - g_return_val_if_fail (G_IS_ASYNC_RESULT (async_result), NULL); - g_return_val_if_fail (token != NULL, NULL); - g_return_val_if_fail (token_secret != NULL, NULL); - g_return_val_if_fail (error == NULL || *error == NULL, NULL); - g_return_val_if_fail (g_task_is_valid (async_result, self), NULL); - g_return_val_if_fail (g_async_result_is_tagged (async_result, gdata_oauth1_authorizer_request_authentication_uri_async), NULL); - - data = g_task_propagate_pointer (G_TASK (async_result), error); - - if (data == NULL) { - /* Return the error and set all of the output parameters to NULL */ - *token = NULL; - *token_secret = NULL; - - return NULL; - } - - /* Success! Transfer the output to the appropriate parameters and nullify it so it doesn't get freed when the async result gets finalised */ - *token = g_steal_pointer (&data->token); - *token_secret = g_steal_pointer (&data->token_secret); - - return g_steal_pointer (&data->authentication_uri); -} - -/** - * gdata_oauth1_authorizer_request_authorization: - * @self: a #GDataOAuth1Authorizer - * @token: the request token returned by gdata_oauth1_authorizer_request_authentication_uri() - * @token_secret: the request token secret returned by gdata_oauth1_authorizer_request_authentication_uri() - * @verifier: the verifier entered by the user from the authentication page - * @cancellable: (allow-none): optional #GCancellable object, or %NULL - * @error: a #GError, or %NULL - * - * Requests authorization of the given request @token from the Google accounts service using the given @verifier as entered by the user from the - * authentication page at the URI returned by gdata_oauth1_authorizer_request_authentication_uri(). @token and @token_secret must be the same values - * as were returned by gdata_oauth1_authorizer_request_authentication_uri() if it was successful. - * - * If the verifier is valid (i.e. the user granted access to the application and the Google accounts service has no reason to distrust the client), - * %TRUE will be returned and any operations performed from that point onwards on #GDataServices using this #GDataAuthorizer will be - * authorized. - * - * If the user denies access to the application or the Google accounts service distrusts it, a bogus verifier could be returned. In this case, %FALSE - * will be returned and a %GDATA_SERVICE_ERROR_FORBIDDEN error will be raised. - * - * Note that if the user denies access to the application, it may be the case that they have no verifier to enter. In this case, the client can simply - * not call this method. The #GDataOAuth1Authorizer stores no state for authentication operations which have succeeded in calling - * gdata_oauth1_authorizer_request_authentication_uri() but not yet successfully called gdata_oauth1_authorizer_request_authorization(). - * - * This method implements <ulink type="http" url="http://tools.ietf.org/html/rfc5849#section-2.3">Section 2.3</ulink> of the - * <ulink type="http" url="http://tools.ietf.org/html/rfc5849">OAuth 1.0 protocol</ulink>. - * - * Return value: %TRUE if authorization was successful, %FALSE otherwise - * - * Since: 0.9.0 - */ -gboolean -gdata_oauth1_authorizer_request_authorization (GDataOAuth1Authorizer *self, const gchar *token, const gchar *token_secret, const gchar *verifier, - GCancellable *cancellable, GError **error) -{ -#ifdef ENABLE_OAUTH1 - GDataOAuth1AuthorizerPrivate *priv; - SoupMessage *message; - guint status; - gchar *request_body; - GHashTable *parameters; - GHashTable *response_details; - const gchar *_token, *_token_secret; - SoupURI *_uri; -#endif - - g_return_val_if_fail (GDATA_IS_OAUTH1_AUTHORIZER (self), FALSE); - g_return_val_if_fail (token != NULL && *token != '\0', FALSE); - g_return_val_if_fail (token_secret != NULL && *token_secret != '\0', FALSE); - g_return_val_if_fail (verifier != NULL && *verifier != '\0', FALSE); - g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE); - g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - -#ifdef ENABLE_OAUTH1 - /* This implements OAuthGetAccessToken using the request token returned by OAuthGetRequestToken and the verification code returned by - * OAuthAuthorizeToken. See: - * • http://code.google.com/apis/accounts/docs/OAuth_ref.html#AccessToken - * • http://tools.ietf.org/html/rfc5849#section-2.3 - */ - - priv = self->priv; - - /* Build the request body and the set of parameters to be signed */ - parameters = g_hash_table_new (g_str_hash, g_str_equal); - g_hash_table_insert (parameters, (gpointer) "oauth_verifier", (gpointer) verifier); - request_body = soup_form_encode_hash (parameters); - - /* Build the message */ - _uri = soup_uri_new ("https://www.google.com/accounts/OAuthGetAccessToken"); - soup_uri_set_port (_uri, _gdata_service_get_https_port ()); - message = soup_message_new_from_uri (SOUP_METHOD_POST, _uri); - soup_uri_free (_uri); - soup_message_set_request (message, "application/x-www-form-urlencoded", SOUP_MEMORY_TAKE, request_body, strlen (request_body)); - - sign_message (self, message, token, token_secret, parameters); - - g_hash_table_destroy (parameters); - - /* Send the message */ - _gdata_service_actually_send_message (priv->session, message, cancellable, error); - status = message->status_code; - - if (status == SOUP_STATUS_CANCELLED) { - /* Cancelled (the error has already been set) */ - g_object_unref (message); - return FALSE; - } else if (status != SOUP_STATUS_OK) { - /* Server returned an error. This either means that there was a server error or, more likely, the server doesn't trust the client - * or the user denied authorization to the token on the authorization web page. */ - g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_FORBIDDEN, _("Access was denied by the user or server.")); - g_object_unref (message); - - return FALSE; - } - - g_assert (message->response_body->data != NULL); - - /* Parse the response. We expect something like: - * oauth_token=ab3cd9j4ks73hf7g&oauth_token_secret=ZXhhbXBsZS5jb20&oauth_callback_confirmed=true - * See: http://code.google.com/apis/accounts/docs/OAuth_ref.html#AccessToken and - * http://tools.ietf.org/html/rfc5849#section-2.3 for details. */ - response_details = soup_form_decode (message->response_body->data); - - /* Zero out the response body to lower the chance of it (with all the auth. tokens it contains) hitting disk or getting leaked in - * free memory. */ - memset ((void*) message->response_body->data, 0, message->response_body->length); - - g_object_unref (message); - - _token = g_hash_table_lookup (response_details, "oauth_token"); - _token_secret = g_hash_table_lookup (response_details, "oauth_token_secret"); - - /* Validate the returned values */ - if (_token == NULL || _token_secret == NULL || - *_token == '\0' || *_token_secret == '\0') { - g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_PROTOCOL_ERROR, _("The server returned a malformed response.")); - g_hash_table_destroy (response_details); - - return FALSE; - } - - /* Store the token and token secret in the authoriser */ - g_mutex_lock (&(priv->mutex)); - - g_free (priv->token); - priv->token = g_strdup (_token); - - _gdata_service_secure_strfree (priv->token_secret); - priv->token_secret = _gdata_service_secure_strdup (_token_secret); - - g_mutex_unlock (&(priv->mutex)); - - /* Zero out the secret token before freeing the hash table, to reduce the chance of it hitting disk later. */ - memset ((void*) _token_secret, 0, strlen (_token_secret)); - - g_hash_table_destroy (response_details); - - return TRUE; -#else /* if !ENABLE_OAUTH1 */ - if (!g_cancellable_set_error_if_cancelled (cancellable, error)) - g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_UNAVAILABLE, - _("OAuth 1.0 support is disabled.")); - - return FALSE; -#endif -} - -typedef struct { - /* Input */ - gchar *token; - GDataSecureString token_secret; /* must be allocated by _gdata_service_secure_strdup() */ - gchar *verifier; -} RequestAuthorizationAsyncData; - -static void -request_authorization_async_data_free (RequestAuthorizationAsyncData *data) -{ - g_free (data->token); - _gdata_service_secure_strfree (data->token_secret); - g_free (data->verifier); - - g_slice_free (RequestAuthorizationAsyncData, data); -} - -static void -request_authorization_thread (GTask *task, gpointer source_object, gpointer task_data, GCancellable *cancellable) -{ - GDataOAuth1Authorizer *authorizer = GDATA_OAUTH1_AUTHORIZER (source_object); - RequestAuthorizationAsyncData *data = task_data; - g_autoptr(GError) error = NULL; - - if (!gdata_oauth1_authorizer_request_authorization (authorizer, data->token, data->token_secret, data->verifier, cancellable, &error)) - g_task_return_error (task, g_steal_pointer (&error)); - else - g_task_return_boolean (task, TRUE); -} - -/** - * gdata_oauth1_authorizer_request_authorization_async: - * @self: a #GDataOAuth1Authorizer - * @token: the request token returned by gdata_oauth1_authorizer_request_authentication_uri() - * @token_secret: the request token secret returned by gdata_oauth1_authorizer_request_authentication_uri() - * @verifier: the verifier entered by the user from the authentication page - * @cancellable: (allow-none): an optional #GCancellable, or %NULL - * @callback: a #GAsyncReadyCallback to call when authorization is finished - * @user_data: (closure): data to pass to the @callback function - * - * Requests authorization of the given request @token from the Google accounts service using the given @verifier as entered by the user. - * @self, @token, @token_secret and @verifier are reffed/copied when this method is called, so can safely be freed after this method returns. - * - * For more details, see gdata_oauth1_authorizer_request_authorization(), which is the synchronous version of this method. - * - * When the operation is finished, @callback will be called. You can then call gdata_oauth1_authorizer_request_authorization_finish() to get the - * results of the operation. - * - * Since: 0.9.0 - */ -void -gdata_oauth1_authorizer_request_authorization_async (GDataOAuth1Authorizer *self, const gchar *token, const gchar *token_secret, - const gchar *verifier, - GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) -{ - g_autoptr(GTask) task = NULL; - RequestAuthorizationAsyncData *data; - - g_return_if_fail (GDATA_IS_OAUTH1_AUTHORIZER (self)); - g_return_if_fail (token != NULL && *token != '\0'); - g_return_if_fail (token_secret != NULL && *token_secret != '\0'); - g_return_if_fail (verifier != NULL && *verifier != '\0'); - g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); - - data = g_slice_new (RequestAuthorizationAsyncData); - data->token = g_strdup (token); - data->token_secret = _gdata_service_secure_strdup (token_secret); - data->verifier = g_strdup (verifier); - - task = g_task_new (self, cancellable, callback, user_data); - g_task_set_source_tag (task, gdata_oauth1_authorizer_request_authorization_async); - g_task_set_task_data (task, g_steal_pointer (&data), (GDestroyNotify) request_authorization_async_data_free); - g_task_run_in_thread (task, request_authorization_thread); -} - -/** - * gdata_oauth1_authorizer_request_authorization_finish: - * @self: a #GDataOAuth1Authorizer - * @async_result: a #GAsyncResult - * @error: a #GError, or %NULL - * - * Finishes an asynchronous authorization operation started with gdata_oauth1_authorizer_request_authorization_async(). - * - * Return value: %TRUE if authorization was successful, %FALSE otherwise - * - * Since: 0.9.0 - */ -gboolean -gdata_oauth1_authorizer_request_authorization_finish (GDataOAuth1Authorizer *self, GAsyncResult *async_result, GError **error) -{ - g_return_val_if_fail (GDATA_IS_OAUTH1_AUTHORIZER (self), FALSE); - g_return_val_if_fail (G_IS_ASYNC_RESULT (async_result), FALSE); - g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - g_return_val_if_fail (g_task_is_valid (async_result, self), FALSE); - g_return_val_if_fail (g_async_result_is_tagged (async_result, gdata_oauth1_authorizer_request_authorization_async), FALSE); - - return g_task_propagate_boolean (G_TASK (async_result), error); -} - -/** - * gdata_oauth1_authorizer_get_application_name: - * @self: a #GDataOAuth1Authorizer - * - * Returns the application name being used on the authentication page at the URI returned by gdata_oauth1_authorizer_request_authentication_uri(); - * i.e. the value of #GDataOAuth1Authorizer:application-name. - * - * Return value: (allow-none): the application name, or %NULL if one isn't set - * - * Since: 0.9.0 - */ -const gchar * -gdata_oauth1_authorizer_get_application_name (GDataOAuth1Authorizer *self) -{ - g_return_val_if_fail (GDATA_IS_OAUTH1_AUTHORIZER (self), NULL); - return self->priv->application_name; -} - -/** - * gdata_oauth1_authorizer_get_locale: - * @self: a #GDataOAuth1Authorizer - * - * Returns the locale currently being used for network requests, or %NULL if the locale is the default. - * - * Return value: (allow-none): the current locale - * - * Since: 0.9.0 - */ -const gchar * -gdata_oauth1_authorizer_get_locale (GDataOAuth1Authorizer *self) -{ - g_return_val_if_fail (GDATA_IS_OAUTH1_AUTHORIZER (self), NULL); - return self->priv->locale; -} - -/** - * gdata_oauth1_authorizer_set_locale: - * @self: a #GDataOAuth1Authorizer - * @locale: (allow-none): the new locale in Unix locale format, or %NULL for the default locale - * - * Set the locale used for network requests to @locale, given in standard Unix locale format. See #GDataOAuth1Authorizer:locale for more details. - * - * Note that while it's possible to change the locale after sending network requests (i.e. calling - * gdata_oauth1_authorizer_request_authentication_uri() for the first time), it is unsupported, as the server-side software may behave unexpectedly. - * The only supported use of this method is after creation of the authorizer, but before any network requests are made. - * - * Since: 0.9.0 - */ -void -gdata_oauth1_authorizer_set_locale (GDataOAuth1Authorizer *self, const gchar *locale) -{ - g_return_if_fail (GDATA_IS_OAUTH1_AUTHORIZER (self)); - - if (g_strcmp0 (locale, self->priv->locale) == 0) { - /* Already has this value */ - return; - } - - g_free (self->priv->locale); - self->priv->locale = g_strdup (locale); - g_object_notify (G_OBJECT (self), "locale"); -} - -static void -notify_proxy_uri_cb (GObject *gobject, GParamSpec *pspec, GDataOAuth1Authorizer *self) -{ - /* Flush our cached version */ - if (self->priv->proxy_uri != NULL) { - soup_uri_free (self->priv->proxy_uri); - self->priv->proxy_uri = NULL; - } - - g_object_notify (G_OBJECT (self), "proxy-uri"); -} - -/* Static function which isn't deprecated so we can continue using it internally. */ -static SoupURI * -_get_proxy_uri (GDataOAuth1Authorizer *self) -{ - SoupURI *proxy_uri; - - g_return_val_if_fail (GDATA_IS_OAUTH1_AUTHORIZER (self), NULL); - - /* If we have a cached version, return that */ - if (self->priv->proxy_uri != NULL) { - return self->priv->proxy_uri; - } - - g_object_get (self->priv->session, SOUP_SESSION_PROXY_URI, &proxy_uri, NULL); - - /* Update the cache; it takes ownership of the URI */ - self->priv->proxy_uri = proxy_uri; - - return proxy_uri; -} - -/** - * gdata_oauth1_authorizer_get_proxy_uri: - * @self: a #GDataOAuth1Authorizer - * - * Gets the proxy URI on the #GDataOAuth1Authorizer's #SoupSession. - * - * Return value: (transfer full) (allow-none): the proxy URI, or %NULL; free with soup_uri_free() - * - * Since: 0.9.0 - * Deprecated: 0.15.0: Use gdata_oauth1_authorizer_get_proxy_resolver() instead, which gives more flexibility over the proxy used. - */ -SoupURI * -gdata_oauth1_authorizer_get_proxy_uri (GDataOAuth1Authorizer *self) -{ - return _get_proxy_uri (self); -} - -/* Static function which isn't deprecated so we can continue using it internally. */ -static void -_set_proxy_uri (GDataOAuth1Authorizer *self, SoupURI *proxy_uri) -{ - g_return_if_fail (GDATA_IS_OAUTH1_AUTHORIZER (self)); - - g_object_set (self->priv->session, SOUP_SESSION_PROXY_URI, proxy_uri, NULL); - - /* Notification is handled in notify_proxy_uri_cb() which is called as a result of setting the property on the session */ -} - -/** - * gdata_oauth1_authorizer_set_proxy_uri: - * @self: a #GDataOAuth1Authorizer - * @proxy_uri: (allow-none): the proxy URI, or %NULL - * - * Sets the proxy URI on the #SoupSession used internally by the #GDataOAuth1Authorizer. This forces all requests through the given proxy. - * - * If @proxy_uri is %NULL, no proxy will be used. - * - * Since: 0.9.0 - * Deprecated: 0.15.0: Use gdata_oauth1_authorizer_set_proxy_resolver() instead, which gives more flexibility over the proxy used. - */ -void -gdata_oauth1_authorizer_set_proxy_uri (GDataOAuth1Authorizer *self, SoupURI *proxy_uri) -{ - _set_proxy_uri (self, proxy_uri); -} - -/** - * gdata_oauth1_authorizer_get_proxy_resolver: - * @self: a #GDataOAuth1Authorizer - * - * Gets the #GProxyResolver on the #GDataOAuth1Authorizer's #SoupSession. - * - * Return value: (transfer none) (allow-none): a #GProxyResolver, or %NULL - * - * Since: 0.15.0 - */ -GProxyResolver * -gdata_oauth1_authorizer_get_proxy_resolver (GDataOAuth1Authorizer *self) -{ - g_return_val_if_fail (GDATA_IS_OAUTH1_AUTHORIZER (self), NULL); - - return self->priv->proxy_resolver; -} - -/** - * gdata_oauth1_authorizer_set_proxy_resolver: - * @self: a #GDataOAuth1Authorizer - * @proxy_resolver: (allow-none): a #GProxyResolver, or %NULL - * - * Sets the #GProxyResolver on the #SoupSession used internally by the given #GDataOAuth1Authorizer. - * - * Setting this will clear the #GDataOAuth1Authorizer:proxy-uri property. - * - * Since: 0.15.0 - */ -void -gdata_oauth1_authorizer_set_proxy_resolver (GDataOAuth1Authorizer *self, GProxyResolver *proxy_resolver) -{ - g_return_if_fail (GDATA_IS_OAUTH1_AUTHORIZER (self)); - g_return_if_fail (proxy_resolver == NULL || G_IS_PROXY_RESOLVER (proxy_resolver)); - - if (proxy_resolver != NULL) { - g_object_ref (proxy_resolver); - } - - g_clear_object (&self->priv->proxy_resolver); - self->priv->proxy_resolver = proxy_resolver; - - g_object_notify (G_OBJECT (self), "proxy-resolver"); -} - -static void -notify_timeout_cb (GObject *gobject, GParamSpec *pspec, GObject *self) -{ - g_object_notify (self, "timeout"); -} - -/** - * gdata_oauth1_authorizer_get_timeout: - * @self: a #GDataOAuth1Authorizer - * - * Gets the #GDataOAuth1Authorizer:timeout property; the network timeout, in seconds. - * - * Return value: the timeout, or <code class="literal">0</code> - * - * Since: 0.9.0 - */ -guint -gdata_oauth1_authorizer_get_timeout (GDataOAuth1Authorizer *self) -{ - guint timeout; - - g_return_val_if_fail (GDATA_IS_OAUTH1_AUTHORIZER (self), 0); - - g_object_get (self->priv->session, SOUP_SESSION_TIMEOUT, &timeout, NULL); - - return timeout; -} - -/** - * gdata_oauth1_authorizer_set_timeout: - * @self: a #GDataOAuth1Authorizer - * @timeout: the timeout, or <code class="literal">0</code> - * - * Sets the #GDataOAuth1Authorizer:timeout property; the network timeout, in seconds. - * - * If @timeout is <code class="literal">0</code>, network operations will never time out. - * - * Since: 0.9.0 - */ -void -gdata_oauth1_authorizer_set_timeout (GDataOAuth1Authorizer *self, guint timeout) -{ - g_return_if_fail (GDATA_IS_OAUTH1_AUTHORIZER (self)); - - if (gdata_oauth1_authorizer_get_timeout (self) == timeout) { - /* Already has this value */ - return; - } - - g_object_set (self->priv->session, SOUP_SESSION_TIMEOUT, timeout, NULL); - - /* Notification is handled in notify_timeout_cb() which is called as a result of setting the property on the session */ -} diff --git a/gdata/gdata-oauth1-authorizer.h b/gdata/gdata-oauth1-authorizer.h deleted file mode 100644 index 6e16a4bc..00000000 --- a/gdata/gdata-oauth1-authorizer.h +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * GData Client - * Copyright (C) Philip Withnall 2011 <philip@tecnocode.co.uk> - * - * GData Client is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GData Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GData Client. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef GDATA_OAUTH1_AUTHORIZER_H -#define GDATA_OAUTH1_AUTHORIZER_H - -#include <glib.h> -#include <glib-object.h> - -#include "gdata-authorizer.h" - -G_BEGIN_DECLS - -#define GDATA_TYPE_OAUTH1_AUTHORIZER (gdata_oauth1_authorizer_get_type ()) -#define GDATA_OAUTH1_AUTHORIZER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDATA_TYPE_OAUTH1_AUTHORIZER, GDataOAuth1Authorizer)) -#define GDATA_OAUTH1_AUTHORIZER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDATA_TYPE_OAUTH1_AUTHORIZER, GDataOAuth1AuthorizerClass)) -#define GDATA_IS_OAUTH1_AUTHORIZER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDATA_TYPE_OAUTH1_AUTHORIZER)) -#define GDATA_IS_OAUTH1_AUTHORIZER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDATA_TYPE_OAUTH1_AUTHORIZER)) -#define GDATA_OAUTH1_AUTHORIZER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDATA_TYPE_OAUTH1_AUTHORIZER, GDataOAuth1AuthorizerClass)) - -typedef struct _GDataOAuth1AuthorizerPrivate GDataOAuth1AuthorizerPrivate; - -/** - * GDataOAuth1Authorizer: - * - * All the fields in the #GDataOAuth1Authorizer structure are private and should never be accessed directly. - * - * Since: 0.9.0 - */ -typedef struct { - /*< private >*/ - GObject parent; - GDataOAuth1AuthorizerPrivate *priv; -} GDataOAuth1Authorizer; - -/** - * GDataOAuth1AuthorizerClass: - * - * All the fields in the #GDataOAuth1AuthorizerClass structure are private and should never be accessed directly. - * - * Since: 0.9.0 - */ -typedef struct { - /*< private >*/ - GObjectClass parent; - - /*< private >*/ - /* Padding for future expansion */ - void (*_g_reserved0) (void); - void (*_g_reserved1) (void); -} GDataOAuth1AuthorizerClass; - -GType gdata_oauth1_authorizer_get_type (void) G_GNUC_CONST; -G_DEFINE_AUTOPTR_CLEANUP_FUNC (GDataOAuth1Authorizer, g_object_unref) - -GDataOAuth1Authorizer *gdata_oauth1_authorizer_new (const gchar *application_name, GType service_type) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC; -GDataOAuth1Authorizer *gdata_oauth1_authorizer_new_for_authorization_domains (const gchar *application_name, - GList *authorization_domains) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC; - -gchar *gdata_oauth1_authorizer_request_authentication_uri (GDataOAuth1Authorizer *self, gchar **token, gchar **token_secret, - GCancellable *cancellable, GError **error); -void gdata_oauth1_authorizer_request_authentication_uri_async (GDataOAuth1Authorizer *self, GCancellable *cancellable, - GAsyncReadyCallback callback, gpointer user_data); -gchar *gdata_oauth1_authorizer_request_authentication_uri_finish (GDataOAuth1Authorizer *self, GAsyncResult *async_result, gchar **token, - gchar **token_secret, GError **error); - -gboolean gdata_oauth1_authorizer_request_authorization (GDataOAuth1Authorizer *self, const gchar *token, const gchar *token_secret, - const gchar *verifier, GCancellable *cancellable, GError **error); -void gdata_oauth1_authorizer_request_authorization_async (GDataOAuth1Authorizer *self, const gchar *token, const gchar *token_secret, - const gchar *verifier, GCancellable *cancellable, GAsyncReadyCallback callback, - gpointer user_data); -gboolean gdata_oauth1_authorizer_request_authorization_finish (GDataOAuth1Authorizer *self, GAsyncResult *async_result, GError **error); - -const gchar *gdata_oauth1_authorizer_get_application_name (GDataOAuth1Authorizer *self) G_GNUC_PURE; - -const gchar *gdata_oauth1_authorizer_get_locale (GDataOAuth1Authorizer *self) G_GNUC_PURE; -void gdata_oauth1_authorizer_set_locale (GDataOAuth1Authorizer *self, const gchar *locale); - -#ifndef LIBGDATA_DISABLE_DEPRECATED -SoupURI *gdata_oauth1_authorizer_get_proxy_uri (GDataOAuth1Authorizer *self) G_GNUC_PURE G_GNUC_DEPRECATED_FOR (gdata_oauth1_authorizer_get_proxy_resolver); -void gdata_oauth1_authorizer_set_proxy_uri (GDataOAuth1Authorizer *self, SoupURI *proxy_uri) G_GNUC_DEPRECATED_FOR (gdata_oauth1_authorizer_set_proxy_resolver); -#endif /* !LIBGDATA_DISABLE_DEPRECATED */ - -GProxyResolver *gdata_oauth1_authorizer_get_proxy_resolver (GDataOAuth1Authorizer *self) G_GNUC_PURE; -void gdata_oauth1_authorizer_set_proxy_resolver (GDataOAuth1Authorizer *self, GProxyResolver *proxy_resolver); - -guint gdata_oauth1_authorizer_get_timeout (GDataOAuth1Authorizer *self) G_GNUC_PURE; -void gdata_oauth1_authorizer_set_timeout (GDataOAuth1Authorizer *self, guint timeout); - -G_END_DECLS - -#endif /* !GDATA_OAUTH1_AUTHORIZER_H */ diff --git a/gdata/gdata.h b/gdata/gdata.h index 0858accd..b285e806 100644 --- a/gdata/gdata.h +++ b/gdata/gdata.h @@ -38,7 +38,6 @@ #include <gdata/gdata-authorizer.h> #include <gdata/gdata-authorization-domain.h> #include <gdata/gdata-client-login-authorizer.h> -#include <gdata/gdata-oauth1-authorizer.h> #include <gdata/gdata-oauth2-authorizer.h> #ifdef GOA_API_IS_SUBJECT_TO_CHANGE /* You need to define GOA_API_IS_SUBJECT_TO_CHANGE in order to use the GOA authoriser. */ diff --git a/gdata/meson.build b/gdata/meson.build index a42bae71..ff14f81f 100644 --- a/gdata/meson.build +++ b/gdata/meson.build @@ -34,7 +34,6 @@ headers = files( 'gdata-download-stream.h', 'gdata-entry.h', 'gdata-feed.h', - 'gdata-oauth1-authorizer.h', 'gdata-oauth2-authorizer.h', 'gdata-parsable.h', 'gdata-query.h', @@ -59,7 +58,6 @@ sources += files( 'gdata-download-stream.c', 'gdata-entry.c', 'gdata-feed.c', - 'gdata-oauth1-authorizer.c', 'gdata-oauth2-authorizer.c', 'gdata-parsable.c', 'gdata-parser.c', diff --git a/gdata/services/contacts/gdata-contacts-contact.c b/gdata/services/contacts/gdata-contacts-contact.c index 7879a34e..43a773c1 100644 --- a/gdata/services/contacts/gdata-contacts-contact.c +++ b/gdata/services/contacts/gdata-contacts-contact.c @@ -144,7 +144,7 @@ * </example> * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ #include <config.h> @@ -268,7 +268,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * Atom Publishing Protocol specification</ulink>. * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_EDITED, g_param_spec_int64 ("edited", @@ -282,7 +282,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * Whether the entry has been deleted. * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_DELETED, g_param_spec_boolean ("deleted", @@ -296,7 +296,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * The ETag of the contact's photo, if the contact has a photo; %NULL otherwise. * * Since: 0.9.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_PHOTO_ETAG, g_param_spec_string ("photo-etag", @@ -310,7 +310,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * The contact's name in a structured representation. * * Since: 0.5.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_NAME, g_param_spec_object ("name", @@ -324,7 +324,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * The contact's chosen nickname. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_NICKNAME, g_param_spec_string ("nickname", @@ -338,7 +338,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * The name to file the contact under for sorting purposes. * * Since: 0.11.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_FILE_AS, g_param_spec_string ("file-as", @@ -352,7 +352,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * The contact's birthday. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_BIRTHDAY, g_param_spec_boxed ("birthday", @@ -366,7 +366,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * Whether the contact's birthday includes their year of birth. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_BIRTHDAY_HAS_YEAR, g_param_spec_boolean ("birthday-has-year", @@ -380,7 +380,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * Billing information for the contact, such as their billing name and address. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_BILLING_INFORMATION, g_param_spec_string ("billing-information", @@ -394,7 +394,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * The name or address of a directory server associated with the contact. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_DIRECTORY_SERVER, g_param_spec_string ("directory-server", @@ -408,7 +408,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * The gender of the contact. For example: %GDATA_CONTACTS_GENDER_MALE or %GDATA_CONTACTS_GENDER_FEMALE. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_GENDER, g_param_spec_string ("gender", @@ -422,7 +422,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * The initials of the contact. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_INITIALS, g_param_spec_string ("initials", @@ -436,7 +436,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * The maiden name of the contact. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_MAIDEN_NAME, g_param_spec_string ("maiden-name", @@ -450,7 +450,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * A mileage associated with the contact, such as one for reimbursement purposes. It can be in any format. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_MILEAGE, g_param_spec_string ("mileage", @@ -464,7 +464,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * The contact's occupation. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_OCCUPATION, g_param_spec_string ("occupation", @@ -478,7 +478,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * The contact's importance. For example: %GDATA_CONTACTS_PRIORITY_NORMAL or %GDATA_CONTACTS_PRIORITY_HIGH. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_PRIORITY, g_param_spec_string ("priority", @@ -492,7 +492,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * The sensitivity of the contact's data. For example: %GDATA_CONTACTS_SENSITIVITY_NORMAL or %GDATA_CONTACTS_SENSITIVITY_PRIVATE. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_SENSITIVITY, g_param_spec_string ("sensitivity", @@ -507,7 +507,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * whereas #GDataContactsContact:nickname should be used for nicknames. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_SHORT_NAME, g_param_spec_string ("short-name", @@ -521,7 +521,7 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) * The subject of the contact. (i.e. The contact's relevance to the address book.) * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_SUBJECT, g_param_spec_string ("subject", @@ -1277,7 +1277,7 @@ get_entry_uri (const gchar *id) * Return value: a new #GDataContactsContact; unref with g_object_unref() * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataContactsContact * gdata_contacts_contact_new (const gchar *id) @@ -1294,7 +1294,7 @@ gdata_contacts_contact_new (const gchar *id) * Return value: the UNIX timestamp for the time the contact was last edited, or <code class="literal">-1</code> * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ gint64 gdata_contacts_contact_get_edited (GDataContactsContact *self) @@ -1312,7 +1312,7 @@ gdata_contacts_contact_get_edited (GDataContactsContact *self) * Return value: (transfer none): the contact's name, or %NULL * * Since: 0.5.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataGDName * gdata_contacts_contact_get_name (GDataContactsContact *self) @@ -1331,7 +1331,7 @@ gdata_contacts_contact_get_name (GDataContactsContact *self) * @name must not be %NULL, though all its properties may be %NULL. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_set_name (GDataContactsContact *self, GDataGDName *name) @@ -1357,7 +1357,7 @@ gdata_contacts_contact_set_name (GDataContactsContact *self, GDataGDName *name) * Return value: the contact's nickname, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_contact_get_nickname (GDataContactsContact *self) @@ -1376,7 +1376,7 @@ gdata_contacts_contact_get_nickname (GDataContactsContact *self) * If @nickname is %NULL, the contact's nickname will be removed. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_set_nickname (GDataContactsContact *self, const gchar *nickname) @@ -1397,7 +1397,7 @@ gdata_contacts_contact_set_nickname (GDataContactsContact *self, const gchar *ni * Return value: the name the contact's filed under, or %NULL * * Since: 0.11.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_contact_get_file_as (GDataContactsContact *self) @@ -1416,7 +1416,7 @@ gdata_contacts_contact_get_file_as (GDataContactsContact *self) * If @file_as is %NULL, the contact will be filed under their full name. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_set_file_as (GDataContactsContact *self, const gchar *file_as) @@ -1441,7 +1441,7 @@ gdata_contacts_contact_set_file_as (GDataContactsContact *self, const gchar *fil * Return value: whether the contact's birthday has the year set * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ gboolean gdata_contacts_contact_get_birthday (GDataContactsContact *self, GDate *birthday) @@ -1465,7 +1465,7 @@ gdata_contacts_contact_get_birthday (GDataContactsContact *self, GDate *birthday * If @birthday is %NULL, the contact's birthday will be removed. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_set_birthday (GDataContactsContact *self, GDate *birthday, gboolean birthday_has_year) @@ -1495,7 +1495,7 @@ gdata_contacts_contact_set_birthday (GDataContactsContact *self, GDate *birthday * Return value: the contact's billing information, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_contact_get_billing_information (GDataContactsContact *self) @@ -1514,7 +1514,7 @@ gdata_contacts_contact_get_billing_information (GDataContactsContact *self) * If @billing_information is %NULL, the contact's billing information will be removed. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_set_billing_information (GDataContactsContact *self, const gchar *billing_information) @@ -1536,7 +1536,7 @@ gdata_contacts_contact_set_billing_information (GDataContactsContact *self, cons * Return value: the name or address of a directory server associated with the contact, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_contact_get_directory_server (GDataContactsContact *self) @@ -1555,7 +1555,7 @@ gdata_contacts_contact_get_directory_server (GDataContactsContact *self) * If @directory_server is %NULL, the contact's directory server will be removed. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_set_directory_server (GDataContactsContact *self, const gchar *directory_server) @@ -1577,7 +1577,7 @@ gdata_contacts_contact_set_directory_server (GDataContactsContact *self, const g * Return value: the gender of the contact, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_contact_get_gender (GDataContactsContact *self) @@ -1596,7 +1596,7 @@ gdata_contacts_contact_get_gender (GDataContactsContact *self) * If @gender is %NULL, the contact's gender will be removed. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_set_gender (GDataContactsContact *self, const gchar *gender) @@ -1618,7 +1618,7 @@ gdata_contacts_contact_set_gender (GDataContactsContact *self, const gchar *gend * Return value: the initials of the contact, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_contact_get_initials (GDataContactsContact *self) @@ -1637,7 +1637,7 @@ gdata_contacts_contact_get_initials (GDataContactsContact *self) * If @initials is %NULL, the contact's initials will be removed. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_set_initials (GDataContactsContact *self, const gchar *initials) @@ -1658,7 +1658,7 @@ gdata_contacts_contact_set_initials (GDataContactsContact *self, const gchar *in * Return value: the maiden name of the contact, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_contact_get_maiden_name (GDataContactsContact *self) @@ -1677,7 +1677,7 @@ gdata_contacts_contact_get_maiden_name (GDataContactsContact *self) * If @maiden_name is %NULL, the contact's maiden name will be removed. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_set_maiden_name (GDataContactsContact *self, const gchar *maiden_name) @@ -1698,7 +1698,7 @@ gdata_contacts_contact_set_maiden_name (GDataContactsContact *self, const gchar * Return value: a mileage associated with the contact, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_contact_get_mileage (GDataContactsContact *self) @@ -1717,7 +1717,7 @@ gdata_contacts_contact_get_mileage (GDataContactsContact *self) * If @mileage is %NULL, the contact's mileage will be removed. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_set_mileage (GDataContactsContact *self, const gchar *mileage) @@ -1738,7 +1738,7 @@ gdata_contacts_contact_set_mileage (GDataContactsContact *self, const gchar *mil * Return value: the contact's occupation, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_contact_get_occupation (GDataContactsContact *self) @@ -1757,7 +1757,7 @@ gdata_contacts_contact_get_occupation (GDataContactsContact *self) * If @occupation is %NULL, the contact's occupation will be removed. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_set_occupation (GDataContactsContact *self, const gchar *occupation) @@ -1778,7 +1778,7 @@ gdata_contacts_contact_set_occupation (GDataContactsContact *self, const gchar * * Return value: the contact's priority, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_contact_get_priority (GDataContactsContact *self) @@ -1797,7 +1797,7 @@ gdata_contacts_contact_get_priority (GDataContactsContact *self) * If @priority is %NULL, the contact's priority will be removed. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_set_priority (GDataContactsContact *self, const gchar *priority) @@ -1819,7 +1819,7 @@ gdata_contacts_contact_set_priority (GDataContactsContact *self, const gchar *pr * Return value: the contact's sensitivity, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_contact_get_sensitivity (GDataContactsContact *self) @@ -1838,7 +1838,7 @@ gdata_contacts_contact_get_sensitivity (GDataContactsContact *self) * If @sensitivity is %NULL, the contact's sensitivity will be removed. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_set_sensitivity (GDataContactsContact *self, const gchar *sensitivity) @@ -1860,7 +1860,7 @@ gdata_contacts_contact_set_sensitivity (GDataContactsContact *self, const gchar * Return value: the contact's short name, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_contact_get_short_name (GDataContactsContact *self) @@ -1879,7 +1879,7 @@ gdata_contacts_contact_get_short_name (GDataContactsContact *self) * If @short_name is %NULL, the contact's short name will be removed. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_set_short_name (GDataContactsContact *self, const gchar *short_name) @@ -1900,7 +1900,7 @@ gdata_contacts_contact_set_short_name (GDataContactsContact *self, const gchar * * Return value: the contact's subject, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_contact_get_subject (GDataContactsContact *self) @@ -1919,7 +1919,7 @@ gdata_contacts_contact_get_subject (GDataContactsContact *self) * If @subject is %NULL, the contact's subject will be removed. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_set_subject (GDataContactsContact *self, const gchar *subject) @@ -1945,7 +1945,7 @@ gdata_contacts_contact_set_subject (GDataContactsContact *self, const gchar *sub * Duplicate e-mail addresses will not be added to the list. * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_add_email_address (GDataContactsContact *self, GDataGDEmailAddress *email_address) @@ -1966,7 +1966,7 @@ gdata_contacts_contact_add_email_address (GDataContactsContact *self, GDataGDEma * Return value: (element-type GData.GDEmailAddress) (transfer none): a #GList of #GDataGDEmailAddress<!-- -->es, or %NULL * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GList * gdata_contacts_contact_get_email_addresses (GDataContactsContact *self) @@ -1984,7 +1984,7 @@ gdata_contacts_contact_get_email_addresses (GDataContactsContact *self) * Return value: (transfer none): a #GDataGDEmailAddress, or %NULL * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataGDEmailAddress * gdata_contacts_contact_get_primary_email_address (GDataContactsContact *self) @@ -2008,7 +2008,7 @@ gdata_contacts_contact_get_primary_email_address (GDataContactsContact *self) * Removes all e-mail addresses from the contact. * * Since: 0.4.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_remove_all_email_addresses (GDataContactsContact *self) @@ -2035,7 +2035,7 @@ gdata_contacts_contact_remove_all_email_addresses (GDataContactsContact *self) * Duplicate IM addresses will not be added to the list. * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_add_im_address (GDataContactsContact *self, GDataGDIMAddress *im_address) @@ -2056,7 +2056,7 @@ gdata_contacts_contact_add_im_address (GDataContactsContact *self, GDataGDIMAddr * Return value: (element-type GData.GDIMAddress) (transfer none): a #GList of #GDataGDIMAddress<!-- -->es, or %NULL * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GList * gdata_contacts_contact_get_im_addresses (GDataContactsContact *self) @@ -2074,7 +2074,7 @@ gdata_contacts_contact_get_im_addresses (GDataContactsContact *self) * Return value: (transfer none): a #GDataGDIMAddress, or %NULL * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataGDIMAddress * gdata_contacts_contact_get_primary_im_address (GDataContactsContact *self) @@ -2098,7 +2098,7 @@ gdata_contacts_contact_get_primary_im_address (GDataContactsContact *self) * Removes all IM addresses from the contact. * * Since: 0.4.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_remove_all_im_addresses (GDataContactsContact *self) @@ -2125,7 +2125,7 @@ gdata_contacts_contact_remove_all_im_addresses (GDataContactsContact *self) * Duplicate phone numbers will not be added to the list. * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_add_phone_number (GDataContactsContact *self, GDataGDPhoneNumber *phone_number) @@ -2146,7 +2146,7 @@ gdata_contacts_contact_add_phone_number (GDataContactsContact *self, GDataGDPhon * Return value: (element-type GData.GDPhoneNumber) (transfer none): a #GList of #GDataGDPhoneNumbers, or %NULL * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GList * gdata_contacts_contact_get_phone_numbers (GDataContactsContact *self) @@ -2164,7 +2164,7 @@ gdata_contacts_contact_get_phone_numbers (GDataContactsContact *self) * Return value: (transfer none): a #GDataGDPhoneNumber, or %NULL * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataGDPhoneNumber * gdata_contacts_contact_get_primary_phone_number (GDataContactsContact *self) @@ -2188,7 +2188,7 @@ gdata_contacts_contact_get_primary_phone_number (GDataContactsContact *self) * Removes all phone numbers from the contact. * * Since: 0.4.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_remove_all_phone_numbers (GDataContactsContact *self) @@ -2215,7 +2215,7 @@ gdata_contacts_contact_remove_all_phone_numbers (GDataContactsContact *self) * Duplicate postal addresses will not be added to the list. * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_add_postal_address (GDataContactsContact *self, GDataGDPostalAddress *postal_address) @@ -2236,7 +2236,7 @@ gdata_contacts_contact_add_postal_address (GDataContactsContact *self, GDataGDPo * Return value: (element-type GData.GDPostalAddress) (transfer none): a #GList of #GDataGDPostalAddress<!-- -->es, or %NULL * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GList * gdata_contacts_contact_get_postal_addresses (GDataContactsContact *self) @@ -2254,7 +2254,7 @@ gdata_contacts_contact_get_postal_addresses (GDataContactsContact *self) * Return value: (transfer none): a #GDataGDPostalAddress, or %NULL * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataGDPostalAddress * gdata_contacts_contact_get_primary_postal_address (GDataContactsContact *self) @@ -2278,7 +2278,7 @@ gdata_contacts_contact_get_primary_postal_address (GDataContactsContact *self) * Removes all postal addresses from the contact. * * Since: 0.4.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_remove_all_postal_addresses (GDataContactsContact *self) @@ -2305,7 +2305,7 @@ gdata_contacts_contact_remove_all_postal_addresses (GDataContactsContact *self) * Duplicate organizations will not be added to the list. * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_add_organization (GDataContactsContact *self, GDataGDOrganization *organization) @@ -2326,7 +2326,7 @@ gdata_contacts_contact_add_organization (GDataContactsContact *self, GDataGDOrga * Return value: (element-type GData.GDOrganization) (transfer none): a #GList of #GDataGDOrganizations, or %NULL * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GList * gdata_contacts_contact_get_organizations (GDataContactsContact *self) @@ -2344,7 +2344,7 @@ gdata_contacts_contact_get_organizations (GDataContactsContact *self) * Return value: (transfer none): a #GDataGDOrganization, or %NULL * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataGDOrganization * gdata_contacts_contact_get_primary_organization (GDataContactsContact *self) @@ -2368,7 +2368,7 @@ gdata_contacts_contact_get_primary_organization (GDataContactsContact *self) * Removes all organizations from the contact. * * Since: 0.4.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_remove_all_organizations (GDataContactsContact *self) @@ -2391,7 +2391,7 @@ gdata_contacts_contact_remove_all_organizations (GDataContactsContact *self) * Duplicate jots will be added to the list, and multiple jots with the same relation type can be added to a single contact. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_add_jot (GDataContactsContact *self, GDataGContactJot *jot) @@ -2411,7 +2411,7 @@ gdata_contacts_contact_add_jot (GDataContactsContact *self, GDataGContactJot *jo * Return value: (element-type GData.GContactJot) (transfer none): a #GList of #GDataGContactJots, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GList * gdata_contacts_contact_get_jots (GDataContactsContact *self) @@ -2427,7 +2427,7 @@ gdata_contacts_contact_get_jots (GDataContactsContact *self) * Removes all jots from the contact. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_remove_all_jots (GDataContactsContact *self) @@ -2451,7 +2451,7 @@ gdata_contacts_contact_remove_all_jots (GDataContactsContact *self) * Though it may not make sense for some relation types to be repeated, adding them is allowed. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_add_relation (GDataContactsContact *self, GDataGContactRelation *relation) @@ -2471,7 +2471,7 @@ gdata_contacts_contact_add_relation (GDataContactsContact *self, GDataGContactRe * Return value: (element-type GData.GContactRelation) (transfer none): a #GList of #GDataGContactRelations, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GList * gdata_contacts_contact_get_relations (GDataContactsContact *self) @@ -2487,7 +2487,7 @@ gdata_contacts_contact_get_relations (GDataContactsContact *self) * Removes all relations from the contact. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_remove_all_relations (GDataContactsContact *self) @@ -2511,7 +2511,7 @@ gdata_contacts_contact_remove_all_relations (GDataContactsContact *self) * relation types or labels. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_add_website (GDataContactsContact *self, GDataGContactWebsite *website) @@ -2532,7 +2532,7 @@ gdata_contacts_contact_add_website (GDataContactsContact *self, GDataGContactWeb * Return value: (element-type GData.GContactWebsite) (transfer none): a #GList of #GDataGContactWebsites, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GList * gdata_contacts_contact_get_websites (GDataContactsContact *self) @@ -2550,7 +2550,7 @@ gdata_contacts_contact_get_websites (GDataContactsContact *self) * Return value: (transfer none): a #GDataGContactWebsite, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataGContactWebsite * gdata_contacts_contact_get_primary_website (GDataContactsContact *self) @@ -2574,7 +2574,7 @@ gdata_contacts_contact_get_primary_website (GDataContactsContact *self) * Removes all websites from the contact. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_remove_all_websites (GDataContactsContact *self) @@ -2598,7 +2598,7 @@ gdata_contacts_contact_remove_all_websites (GDataContactsContact *self) * Though it may not make sense for some event types to be repeated, adding them is allowed. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_add_event (GDataContactsContact *self, GDataGContactEvent *event) @@ -2618,7 +2618,7 @@ gdata_contacts_contact_add_event (GDataContactsContact *self, GDataGContactEvent * Return value: (element-type GData.GContactEvent) (transfer none): a #GList of #GDataGContactEvents, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GList * gdata_contacts_contact_get_events (GDataContactsContact *self) @@ -2634,7 +2634,7 @@ gdata_contacts_contact_get_events (GDataContactsContact *self) * Removes all events from the contact. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_remove_all_events (GDataContactsContact *self) @@ -2658,7 +2658,7 @@ gdata_contacts_contact_remove_all_events (GDataContactsContact *self) * relation types or labels. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_add_calendar (GDataContactsContact *self, GDataGContactCalendar *calendar) @@ -2679,7 +2679,7 @@ gdata_contacts_contact_add_calendar (GDataContactsContact *self, GDataGContactCa * Return value: (element-type GData.GContactCalendar) (transfer none): a #GList of #GDataGContactCalendars, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GList * gdata_contacts_contact_get_calendars (GDataContactsContact *self) @@ -2697,7 +2697,7 @@ gdata_contacts_contact_get_calendars (GDataContactsContact *self) * Return value: (transfer none): a #GDataGContactCalendar, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataGContactCalendar * gdata_contacts_contact_get_primary_calendar (GDataContactsContact *self) @@ -2721,7 +2721,7 @@ gdata_contacts_contact_get_primary_calendar (GDataContactsContact *self) * Removes all calendars from the contact. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_remove_all_calendars (GDataContactsContact *self) @@ -2744,7 +2744,7 @@ gdata_contacts_contact_remove_all_calendars (GDataContactsContact *self) * Duplicate IDs will not be added to the list. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_add_external_id (GDataContactsContact *self, GDataGContactExternalID *external_id) @@ -2765,7 +2765,7 @@ gdata_contacts_contact_add_external_id (GDataContactsContact *self, GDataGContac * Return value: (element-type GData.GContactExternalID) (transfer none): a #GList of #GDataGContactExternalIDs, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GList * gdata_contacts_contact_get_external_ids (GDataContactsContact *self) @@ -2781,7 +2781,7 @@ gdata_contacts_contact_get_external_ids (GDataContactsContact *self) * Removes all external IDs from the contact. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_remove_all_external_ids (GDataContactsContact *self) @@ -2804,7 +2804,7 @@ gdata_contacts_contact_remove_all_external_ids (GDataContactsContact *self) * Duplicate hobbies will not be added to the list. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_add_hobby (GDataContactsContact *self, const gchar *hobby) @@ -2825,7 +2825,7 @@ gdata_contacts_contact_add_hobby (GDataContactsContact *self, const gchar *hobby * Return value: (element-type utf8) (transfer none): a #GList of hobby strings, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GList * gdata_contacts_contact_get_hobbies (GDataContactsContact *self) @@ -2841,7 +2841,7 @@ gdata_contacts_contact_get_hobbies (GDataContactsContact *self) * Removes all hobbies from the contact. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_remove_all_hobbies (GDataContactsContact *self) @@ -2864,7 +2864,7 @@ gdata_contacts_contact_remove_all_hobbies (GDataContactsContact *self) * Duplicate languages will not be added to the list. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_add_language (GDataContactsContact *self, GDataGContactLanguage *language) @@ -2885,7 +2885,7 @@ gdata_contacts_contact_add_language (GDataContactsContact *self, GDataGContactLa * Return value: (element-type GData.GContactLanguage) (transfer none): a #GList of #GDataGContactLanguages, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GList * gdata_contacts_contact_get_languages (GDataContactsContact *self) @@ -2901,7 +2901,7 @@ gdata_contacts_contact_get_languages (GDataContactsContact *self) * Removes all languages from the contact. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_remove_all_languages (GDataContactsContact *self) @@ -2925,7 +2925,7 @@ gdata_contacts_contact_remove_all_languages (GDataContactsContact *self) * Return value: the property's value, or %NULL * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_contact_get_extended_property (GDataContactsContact *self, const gchar *name) @@ -2944,7 +2944,7 @@ gdata_contacts_contact_get_extended_property (GDataContactsContact *self, const * Return value: (transfer none): a #GHashTable of extended properties * * Since: 0.4.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GHashTable * gdata_contacts_contact_get_extended_properties (GDataContactsContact *self) @@ -2972,7 +2972,7 @@ gdata_contacts_contact_get_extended_properties (GDataContactsContact *self) * Return value: %TRUE if the property was updated or deleted successfully, %FALSE otherwise * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ gboolean gdata_contacts_contact_set_extended_property (GDataContactsContact *self, const gchar *name, const gchar *value) @@ -3012,7 +3012,7 @@ gdata_contacts_contact_set_extended_property (GDataContactsContact *self, const * Return value: the field's value, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_contact_get_user_defined_field (GDataContactsContact *self, const gchar *name) @@ -3031,7 +3031,7 @@ gdata_contacts_contact_get_user_defined_field (GDataContactsContact *self, const * Return value: (transfer none): a #GHashTable of user-defined fields * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GHashTable * gdata_contacts_contact_get_user_defined_fields (GDataContactsContact *self) @@ -3054,7 +3054,7 @@ gdata_contacts_contact_get_user_defined_fields (GDataContactsContact *self) * To unset a field, set @value to %NULL. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_set_user_defined_field (GDataContactsContact *self, const gchar *name, const gchar *value) @@ -3079,7 +3079,7 @@ gdata_contacts_contact_set_user_defined_field (GDataContactsContact *self, const * Adds the contact to the given group. @href should be a URI. * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_add_group (GDataContactsContact *self, const gchar *href) @@ -3097,7 +3097,7 @@ gdata_contacts_contact_add_group (GDataContactsContact *self, const gchar *href) * Removes the contact from the given group. @href should be a URI. * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_remove_group (GDataContactsContact *self, const gchar *href) @@ -3122,7 +3122,7 @@ gdata_contacts_contact_remove_group (GDataContactsContact *self, const gchar *hr * Return value: %TRUE if the contact has recently been removed from the group, %FALSE otherwise * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ gboolean gdata_contacts_contact_is_group_deleted (GDataContactsContact *self, const gchar *href) @@ -3141,7 +3141,7 @@ gdata_contacts_contact_is_group_deleted (GDataContactsContact *self, const gchar * Return value: (element-type utf8) (transfer container): a #GList of constant group ID URIs, or %NULL; free with g_list_free() * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GList * gdata_contacts_contact_get_groups (GDataContactsContact *self) @@ -3180,7 +3180,7 @@ gdata_contacts_contact_get_groups (GDataContactsContact *self) * Return value: %TRUE if the contact has been deleted, %FALSE otherwise * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ gboolean gdata_contacts_contact_is_deleted (GDataContactsContact *self) @@ -3200,7 +3200,7 @@ gdata_contacts_contact_is_deleted (GDataContactsContact *self) * Return value: the contact's photo's ETag if it exists, %NULL otherwise * * Since: 0.9.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_contact_get_photo_etag (GDataContactsContact *self) @@ -3230,7 +3230,7 @@ gdata_contacts_contact_get_photo_etag (GDataContactsContact *self) * Return value: (transfer full) (array length=length): the image data, or %NULL; free with g_free() * * Since: 0.8.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ guint8 * gdata_contacts_contact_get_photo (GDataContactsContact *self, GDataContactsService *service, gsize *length, gchar **content_type, @@ -3355,7 +3355,7 @@ get_photo_thread (GTask *task, gpointer source_object, gpointer task_data, GCanc * If there is an error getting the photo, a %GDATA_SERVICE_ERROR_PROTOCOL_ERROR error will be returned by gdata_contacts_contact_get_photo_finish(). * * Since: 0.8.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_get_photo_async (GDataContactsContact *self, GDataContactsService *service, GCancellable *cancellable, @@ -3391,7 +3391,7 @@ gdata_contacts_contact_get_photo_async (GDataContactsContact *self, GDataContact * Return value: (transfer full) (array length=length): the image data, or %NULL; free with g_free() * * Since: 0.8.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ guint8 * gdata_contacts_contact_get_photo_finish (GDataContactsContact *self, GAsyncResult *async_result, gsize *length, gchar **content_type, GError **error) @@ -3445,7 +3445,7 @@ gdata_contacts_contact_get_photo_finish (GDataContactsContact *self, GAsyncResul * Return value: %TRUE on success, %FALSE otherwise * * Since: 0.8.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ gboolean gdata_contacts_contact_set_photo (GDataContactsContact *self, GDataContactsService *service, const guint8 *data, gsize length, @@ -3550,7 +3550,7 @@ set_photo_thread (GTask *task, gpointer source_object, gpointer task_data, GCanc * If there is an error setting the photo, a %GDATA_SERVICE_ERROR_PROTOCOL_ERROR error will be returned by gdata_contacts_contact_set_photo_finish(). * * Since: 0.8.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_contact_set_photo_async (GDataContactsContact *self, GDataContactsService *service, const guint8 *data, gsize length, @@ -3594,7 +3594,7 @@ gdata_contacts_contact_set_photo_async (GDataContactsContact *self, GDataContact * Return value: %TRUE on success, %FALSE otherwise * * Since: 0.8.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ gboolean gdata_contacts_contact_set_photo_finish (GDataContactsContact *self, GAsyncResult *async_result, GError **error) diff --git a/gdata/services/contacts/gdata-contacts-group.c b/gdata/services/contacts/gdata-contacts-group.c index f8954f37..fb25f772 100644 --- a/gdata/services/contacts/gdata-contacts-group.c +++ b/gdata/services/contacts/gdata-contacts-group.c @@ -90,7 +90,7 @@ * </example> * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ #include <config.h> @@ -162,7 +162,7 @@ gdata_contacts_group_class_init (GDataContactsGroupClass *klass) * Atom Publishing Protocol specification</ulink>. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_EDITED, g_param_spec_int64 ("edited", @@ -176,7 +176,7 @@ gdata_contacts_group_class_init (GDataContactsGroupClass *klass) * Whether the entry has been deleted. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_DELETED, g_param_spec_boolean ("deleted", @@ -197,7 +197,7 @@ gdata_contacts_group_class_init (GDataContactsGroupClass *klass) * group ID. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_SYSTEM_GROUP_ID, g_param_spec_string ("system-group-id", @@ -460,7 +460,7 @@ get_entry_uri (const gchar *id) * Return value: a new #GDataContactsGroup; unref with g_object_unref() * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataContactsGroup * gdata_contacts_group_new (const gchar *id) @@ -477,7 +477,7 @@ gdata_contacts_group_new (const gchar *id) * Return value: the UNIX timestamp for the time the file was last edited, or <code class="literal">-1</code> * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ gint64 gdata_contacts_group_get_edited (GDataContactsGroup *self) @@ -495,7 +495,7 @@ gdata_contacts_group_get_edited (GDataContactsGroup *self) * Return value: the group's system group ID, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_group_get_system_group_id (GDataContactsGroup *self) @@ -515,7 +515,7 @@ gdata_contacts_group_get_system_group_id (GDataContactsGroup *self) * Return value: the property's value, or %NULL * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_group_get_extended_property (GDataContactsGroup *self, const gchar *name) @@ -534,7 +534,7 @@ gdata_contacts_group_get_extended_property (GDataContactsGroup *self, const gcha * Return value: (transfer none): a #GHashTable of extended properties * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GHashTable * gdata_contacts_group_get_extended_properties (GDataContactsGroup *self) @@ -561,7 +561,7 @@ gdata_contacts_group_get_extended_properties (GDataContactsGroup *self) * Return value: %TRUE if the property was updated or deleted successfully, %FALSE otherwise * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ gboolean gdata_contacts_group_set_extended_property (GDataContactsGroup *self, const gchar *name, const gchar *value) @@ -600,7 +600,7 @@ gdata_contacts_group_set_extended_property (GDataContactsGroup *self, const gcha * Return value: %TRUE if the group has been deleted, %FALSE otherwise * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ gboolean gdata_contacts_group_is_deleted (GDataContactsGroup *self) diff --git a/gdata/services/contacts/gdata-contacts-query.c b/gdata/services/contacts/gdata-contacts-query.c index 9c8fc7f9..1cda4eaa 100644 --- a/gdata/services/contacts/gdata-contacts-query.c +++ b/gdata/services/contacts/gdata-contacts-query.c @@ -75,7 +75,7 @@ * </example> * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ #include <config.h> @@ -128,7 +128,7 @@ gdata_contacts_query_class_init (GDataContactsQueryClass *klass) * Sorting criterion. The only supported value is <literal>lastmodified</literal>. * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_ORDER_BY, g_param_spec_string ("order-by", @@ -144,7 +144,7 @@ gdata_contacts_query_class_init (GDataContactsQueryClass *klass) * normally appear in query results. * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_SHOW_DELETED, g_param_spec_boolean ("show-deleted", @@ -158,7 +158,7 @@ gdata_contacts_query_class_init (GDataContactsQueryClass *klass) * Sorting order direction. Can be either <literal>ascending</literal> or <literal>descending</literal>. * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_SORT_ORDER, g_param_spec_string ("sort-order", @@ -173,7 +173,7 @@ gdata_contacts_query_class_init (GDataContactsQueryClass *klass) * should be a group ID URI. * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ g_object_class_install_property (gobject_class, PROP_GROUP, g_param_spec_string ("group", @@ -302,7 +302,7 @@ get_query_uri (GDataQuery *self, const gchar *feed_uri, GString *query_uri, gboo * Return value: a new #GDataContactsQuery * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataContactsQuery * gdata_contacts_query_new (const gchar *q) @@ -322,7 +322,7 @@ gdata_contacts_query_new (const gchar *q) * Return value: a new #GDataContactsQuery * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataContactsQuery * gdata_contacts_query_new_with_limits (const gchar *q, guint start_index, guint max_results) @@ -343,7 +343,7 @@ gdata_contacts_query_new_with_limits (const gchar *q, guint start_index, guint m * Return value: the order by property, or %NULL if it is unset * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_query_get_order_by (GDataContactsQuery *self) @@ -362,7 +362,7 @@ gdata_contacts_query_get_order_by (GDataContactsQuery *self) * Set @order_by to %NULL to unset the property in the query URI. * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_query_set_order_by (GDataContactsQuery *self, const gchar *order_by) @@ -386,7 +386,7 @@ gdata_contacts_query_set_order_by (GDataContactsQuery *self, const gchar *order_ * Return value: %TRUE if deleted contacts should be shown, %FALSE otherwise * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ gboolean gdata_contacts_query_show_deleted (GDataContactsQuery *self) @@ -403,7 +403,7 @@ gdata_contacts_query_show_deleted (GDataContactsQuery *self) * Sets the #GDataContactsQuery:show-deleted property of the #GDataContactsQuery. * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_query_set_show_deleted (GDataContactsQuery *self, gboolean show_deleted) @@ -425,7 +425,7 @@ gdata_contacts_query_set_show_deleted (GDataContactsQuery *self, gboolean show_d * Return value: the sort order property, or %NULL if it is unset * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_query_get_sort_order (GDataContactsQuery *self) @@ -444,7 +444,7 @@ gdata_contacts_query_get_sort_order (GDataContactsQuery *self) * Set @sort_order to %NULL to unset the property in the query URI. * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_query_set_sort_order (GDataContactsQuery *self, const gchar *sort_order) @@ -468,7 +468,7 @@ gdata_contacts_query_set_sort_order (GDataContactsQuery *self, const gchar *sort * Return value: the group property, or %NULL if it is unset * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ const gchar * gdata_contacts_query_get_group (GDataContactsQuery *self) @@ -487,7 +487,7 @@ gdata_contacts_query_get_group (GDataContactsQuery *self) * Set @group to %NULL to unset the property in the query URI. * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_query_set_group (GDataContactsQuery *self, const gchar *group) diff --git a/gdata/services/contacts/gdata-contacts-service.c b/gdata/services/contacts/gdata-contacts-service.c index 2c6de1c4..91ed73a3 100644 --- a/gdata/services/contacts/gdata-contacts-service.c +++ b/gdata/services/contacts/gdata-contacts-service.c @@ -149,7 +149,7 @@ * </example> * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ #include <config.h> @@ -201,7 +201,7 @@ get_authorization_domains (void) * Return value: a new #GDataContactsService, or %NULL; unref with g_object_unref() * * Since: 0.9.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataContactsService * gdata_contacts_service_new (GDataAuthorizer *authorizer) @@ -225,7 +225,7 @@ gdata_contacts_service_new (GDataAuthorizer *authorizer) * Return value: (transfer none): the service's authorization domain * * Since: 0.9.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataAuthorizationDomain * gdata_contacts_service_get_primary_authorization_domain (void) @@ -249,7 +249,7 @@ gdata_contacts_service_get_primary_authorization_domain (void) * Return value: (transfer full): a #GDataFeed of query results; unref with g_object_unref() * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataFeed * gdata_contacts_service_query_contacts (GDataContactsService *self, GDataQuery *query, GCancellable *cancellable, @@ -298,7 +298,7 @@ gdata_contacts_service_query_contacts (GDataContactsService *self, GDataQuery *q * and gdata_service_query_async(), which is the base asynchronous query function. * * Since: 0.9.1 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_service_query_contacts_async (GDataContactsService *self, GDataQuery *query, GCancellable *cancellable, @@ -347,7 +347,7 @@ gdata_contacts_service_query_contacts_async (GDataContactsService *self, GDataQu * Return value: (transfer full): an updated #GDataContactsContact, or %NULL; unref with g_object_unref() * * Since: 0.2.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataContactsContact * gdata_contacts_service_insert_contact (GDataContactsService *self, GDataContactsContact *contact, GCancellable *cancellable, GError **error) @@ -386,7 +386,7 @@ gdata_contacts_service_insert_contact (GDataContactsService *self, GDataContacts * and gdata_service_insert_entry_async(), which is the base asynchronous insertion function. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_service_insert_contact_async (GDataContactsService *self, GDataContactsContact *contact, GCancellable *cancellable, @@ -420,7 +420,7 @@ gdata_contacts_service_insert_contact_async (GDataContactsService *self, GDataCo * Return value: (transfer full): a #GDataFeed of query results; unref with g_object_unref() * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataFeed * gdata_contacts_service_query_groups (GDataContactsService *self, GDataQuery *query, GCancellable *cancellable, @@ -469,7 +469,7 @@ gdata_contacts_service_query_groups (GDataContactsService *self, GDataQuery *que * which is the base asynchronous query function. * * Since: 0.9.1 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_service_query_groups_async (GDataContactsService *self, GDataQuery *query, GCancellable *cancellable, @@ -516,7 +516,7 @@ gdata_contacts_service_query_groups_async (GDataContactsService *self, GDataQuer * Return value: (transfer full): the inserted #GDataContactsGroup; unref with g_object_unref() * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ GDataContactsGroup * gdata_contacts_service_insert_group (GDataContactsService *self, GDataContactsGroup *group, GCancellable *cancellable, GError **error) @@ -568,7 +568,7 @@ gdata_contacts_service_insert_group (GDataContactsService *self, GDataContactsGr * gdata_service_insert_entry_async(), which is the base asynchronous insertion function. * * Since: 0.7.0 - * Deprecated: 0.18.0: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. + * Deprecated: 0.18.2: The Google Contacts service is deprecated. Use Google’s CardDAV interface instead. */ void gdata_contacts_service_insert_group_async (GDataContactsService *self, GDataContactsGroup *group, GCancellable *cancellable, diff --git a/gdata/symbol.map b/gdata/symbol.map index 70038472..53135d1a 100644 --- a/gdata/symbol.map +++ b/gdata/symbol.map @@ -767,24 +767,6 @@ global: gdata_media_thumbnail_get_type; gdata_media_thumbnail_get_uri; gdata_media_thumbnail_get_width; - gdata_oauth1_authorizer_get_application_name; - gdata_oauth1_authorizer_get_locale; - gdata_oauth1_authorizer_get_proxy_resolver; - gdata_oauth1_authorizer_get_proxy_uri; - gdata_oauth1_authorizer_get_timeout; - gdata_oauth1_authorizer_get_type; - gdata_oauth1_authorizer_new; - gdata_oauth1_authorizer_new_for_authorization_domains; - gdata_oauth1_authorizer_request_authentication_uri; - gdata_oauth1_authorizer_request_authentication_uri_async; - gdata_oauth1_authorizer_request_authentication_uri_finish; - gdata_oauth1_authorizer_request_authorization; - gdata_oauth1_authorizer_request_authorization_async; - gdata_oauth1_authorizer_request_authorization_finish; - gdata_oauth1_authorizer_set_locale; - gdata_oauth1_authorizer_set_proxy_resolver; - gdata_oauth1_authorizer_set_proxy_uri; - gdata_oauth1_authorizer_set_timeout; gdata_oauth2_authorizer_build_authentication_uri; gdata_oauth2_authorizer_dup_refresh_token; gdata_oauth2_authorizer_get_client_id; diff --git a/gdata/tests/calendar.c b/gdata/tests/calendar.c index 8c3544b1..a3302dee 100644 --- a/gdata/tests/calendar.c +++ b/gdata/tests/calendar.c @@ -1437,7 +1437,7 @@ mock_server_notify_resolver_cb (GObject *object, GParamSpec *pspec, gpointer use } /* Set up a global GDataAuthorizer to be used for all the tests. Unfortunately, - * the Google Calendar API is limited to OAuth1 and OAuth2 authorisation, so + * the Google Calendar API is limited to OAuth2 authorisation, so * this requires user interaction when online. * * If not online, use a dummy authoriser. */ diff --git a/gdata/tests/contacts.c b/gdata/tests/contacts.c index b6f4de2d..59698898 100644 --- a/gdata/tests/contacts.c +++ b/gdata/tests/contacts.c @@ -2547,7 +2547,7 @@ mock_server_notify_resolver_cb (GObject *object, GParamSpec *pspec, gpointer use } /* Set up a global GDataAuthorizer to be used for all the tests. Unfortunately, - * the Google Contacts API is effectively limited to OAuth1 and OAuth2 + * the Google Contacts API is effectively limited to OAuth2 * authorisation, so this requires user interaction when online. * * If not online, use a dummy authoriser. */ diff --git a/gdata/tests/meson.build b/gdata/tests/meson.build index 05184deb..22648ea8 100644 --- a/gdata/tests/meson.build +++ b/gdata/tests/meson.build @@ -23,7 +23,6 @@ tests = { 'should_fail': true, }, 'general': {}, - 'oauth1-authorizer': {}, 'oauth2-authorizer': {}, 'perf': {}, 'picasaweb': { diff --git a/gdata/tests/oauth1-authorizer.c b/gdata/tests/oauth1-authorizer.c deleted file mode 100644 index 480de207..00000000 --- a/gdata/tests/oauth1-authorizer.c +++ /dev/null @@ -1,1144 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * GData Client - * Copyright (C) Philip Withnall 2011 <philip@tecnocode.co.uk> - * - * GData Client is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GData Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GData Client. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <config.h> -#include <glib.h> -#include <gdata/gdata.h> - -#include "common.h" - -/* Uses the Contacts API for tests, but it’s deprecated */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - -static GThread *main_thread = NULL; -static UhmServer *mock_server = NULL; - -static void -test_oauth1_authorizer_constructor (void) -{ - GDataOAuth1Authorizer *authorizer; - - authorizer = gdata_oauth1_authorizer_new ("Application name", GDATA_TYPE_CONTACTS_SERVICE); - - g_assert (authorizer != NULL); - g_assert (GDATA_IS_OAUTH1_AUTHORIZER (authorizer)); - g_assert (GDATA_IS_AUTHORIZER (authorizer)); - - g_object_unref (authorizer); -} - -static void -test_oauth1_authorizer_constructor_for_domains (void) -{ - GDataOAuth1Authorizer *authorizer; - GDataAuthorizationDomain *domain; - GList *domains; - - /* Try with standard domains first */ - domains = gdata_service_get_authorization_domains (GDATA_TYPE_CONTACTS_SERVICE); - authorizer = gdata_oauth1_authorizer_new_for_authorization_domains ("Application name", domains); - g_list_free (domains); - - g_assert (authorizer != NULL); - g_assert (GDATA_IS_OAUTH1_AUTHORIZER (authorizer)); - g_assert (GDATA_IS_AUTHORIZER (authorizer)); - - g_object_unref (authorizer); - - /* Try again with a custom domain. Note that, as in test_authorization_domain_properties() this should not normally happen in client code. */ - domain = GDATA_AUTHORIZATION_DOMAIN (g_object_new (GDATA_TYPE_AUTHORIZATION_DOMAIN, - "service-name", "test", - "scope", "test", - NULL)); - - domains = g_list_prepend (NULL, domain); - authorizer = gdata_oauth1_authorizer_new_for_authorization_domains ("Application name", domains); - g_list_free (domains); - - g_assert (authorizer != NULL); - g_assert (GDATA_IS_OAUTH1_AUTHORIZER (authorizer)); - g_assert (GDATA_IS_AUTHORIZER (authorizer)); - - g_object_unref (authorizer); - g_object_unref (domain); -} - -typedef struct { - GDataOAuth1Authorizer *authorizer; - - guint locale_notification_count; - gulong locale_signal_handler; - guint proxy_resolver_notification_count; - gulong proxy_resolver_signal_handler; - guint timeout_notification_count; - gulong timeout_signal_handler; -} OAuth1AuthorizerData; - -/* Used to count that exactly the right number of notify signals are emitted when setting properties */ -static void -notify_cb (GObject *object, GParamSpec *pspec, guint *notification_count) -{ - /* Check we're running in the main thread */ - g_assert (g_thread_self () == main_thread); - - /* Increment the notification count */ - *notification_count = *notification_count + 1; -} - -static void -connect_to_oauth1_authorizer (OAuth1AuthorizerData *data) -{ - /* Connect to notifications from the object to verify they're only emitted the correct number of times */ - data->locale_signal_handler = g_signal_connect (data->authorizer, "notify::locale", (GCallback) notify_cb, - &(data->locale_notification_count)); - data->proxy_resolver_signal_handler = g_signal_connect (data->authorizer, "notify::proxy-resolver", (GCallback) notify_cb, - &(data->proxy_resolver_notification_count)); - data->timeout_signal_handler = g_signal_connect (data->authorizer, "notify::timeout", (GCallback) notify_cb, - &(data->timeout_notification_count)); -} - -static void -set_up_oauth1_authorizer_data (OAuth1AuthorizerData *data, gconstpointer user_data) -{ - data->authorizer = gdata_oauth1_authorizer_new ("Application name", GDATA_TYPE_CONTACTS_SERVICE); - connect_to_oauth1_authorizer (data); -} - -static void -set_up_oauth1_authorizer_data_fallback_application_name (OAuth1AuthorizerData *data, gconstpointer user_data) -{ - g_set_application_name ("Fallback name"); - data->authorizer = gdata_oauth1_authorizer_new (NULL, GDATA_TYPE_CONTACTS_SERVICE); - connect_to_oauth1_authorizer (data); -} - -static void -set_up_oauth1_authorizer_data_multiple_domains (OAuth1AuthorizerData *data, gconstpointer user_data) -{ - GList *authorization_domains = NULL; - - authorization_domains = g_list_prepend (authorization_domains, gdata_contacts_service_get_primary_authorization_domain ()); - authorization_domains = g_list_prepend (authorization_domains, gdata_picasaweb_service_get_primary_authorization_domain ()); - data->authorizer = gdata_oauth1_authorizer_new_for_authorization_domains ("Application name", authorization_domains); - g_list_free (authorization_domains); - - connect_to_oauth1_authorizer (data); -} - -static void -set_up_oauth1_authorizer_data_locale (OAuth1AuthorizerData *data, gconstpointer user_data) -{ - data->authorizer = gdata_oauth1_authorizer_new ("Application name", GDATA_TYPE_CONTACTS_SERVICE); - gdata_oauth1_authorizer_set_locale (data->authorizer, "en_GB"); - connect_to_oauth1_authorizer (data); -} - -static void -set_up_oauth1_authorizer_data_authenticated (OAuth1AuthorizerData *data, gconstpointer user_data) -{ - gboolean *skip_test = (gboolean*) user_data; - gchar *authentication_uri, *token, *token_secret, *verifier; - - gdata_test_mock_server_start_trace (mock_server, "setup-oauth1-authorizer-data-authenticated"); - - /* Chain up */ - set_up_oauth1_authorizer_data (data, NULL); - - /* Get an authentication URI */ - authentication_uri = gdata_oauth1_authorizer_request_authentication_uri (data->authorizer, &token, &token_secret, NULL, NULL); - g_assert (authentication_uri != NULL); - - /* Get the verifier off the user */ - verifier = gdata_test_query_user_for_verifier (authentication_uri); - - g_free (authentication_uri); - - if (verifier == NULL) { - *skip_test = TRUE; - goto skip_test; - } - - /* Authorise the token */ - g_assert (gdata_oauth1_authorizer_request_authorization (data->authorizer, token, token_secret, verifier, NULL, NULL) == TRUE); - -skip_test: - g_free (token); - g_free (token_secret); - g_free (verifier); - - uhm_server_end_trace (mock_server); -} - -static void -tear_down_oauth1_authorizer_data (OAuth1AuthorizerData *data, gconstpointer user_data) -{ - /* Clean up signal handlers */ - g_signal_handler_disconnect (data->authorizer, data->timeout_signal_handler); - g_signal_handler_disconnect (data->authorizer, data->proxy_resolver_signal_handler); - g_signal_handler_disconnect (data->authorizer, data->locale_signal_handler); - - g_object_unref (data->authorizer); -} - -/* Test getting and setting the application-name property */ -static void -test_oauth1_authorizer_properties_application_name (OAuth1AuthorizerData *data, gconstpointer user_data) -{ - gchar *application_name; - - /* Verifying the normal state of the property in a newly-constructed instance of GDataOAuth1Authorizer */ - g_assert_cmpstr (gdata_oauth1_authorizer_get_application_name (data->authorizer), ==, "Application name"); - - g_object_get (data->authorizer, "application-name", &application_name, NULL); - g_assert_cmpstr (application_name, ==, "Application name"); - g_free (application_name); -} - -/* Test the fallback for the application-name property */ -static void -test_oauth1_authorizer_properties_application_name_fallback (OAuth1AuthorizerData *data, gconstpointer user_data) -{ - gchar *application_name; - - /* Verifying the normal state of the property in a newly-constructed instance of GDataOAuth1Authorizer */ - g_assert_cmpstr (gdata_oauth1_authorizer_get_application_name (data->authorizer), ==, "Fallback name"); - - g_object_get (data->authorizer, "application-name", &application_name, NULL); - g_assert_cmpstr (application_name, ==, "Fallback name"); - g_free (application_name); -} - -/* Test getting and setting the locale property */ -static void -test_oauth1_authorizer_properties_locale (OAuth1AuthorizerData *data, gconstpointer user_data) -{ - gchar *locale; - - /* Verifying the normal state of the property in a newly-constructed instance of GDataOAuth1Authorizer */ - g_assert_cmpstr (gdata_oauth1_authorizer_get_locale (data->authorizer), ==, NULL); - - g_object_get (data->authorizer, "locale", &locale, NULL); - g_assert_cmpstr (locale, ==, NULL); - g_free (locale); - - g_assert_cmpuint (data->locale_notification_count, ==, 0); - - /* Check setting it works and emits a notification */ - gdata_oauth1_authorizer_set_locale (data->authorizer, "en"); - - g_assert_cmpuint (data->locale_notification_count, ==, 1); - - g_assert_cmpstr (gdata_oauth1_authorizer_get_locale (data->authorizer), ==, "en"); - - g_object_get (data->authorizer, "locale", &locale, NULL); - g_assert_cmpstr (locale, ==, "en"); - g_free (locale); - - /* Check setting it to the same value is a no-op */ - gdata_oauth1_authorizer_set_locale (data->authorizer, "en"); - g_assert_cmpuint (data->locale_notification_count, ==, 1); - - /* Check setting it back to NULL works */ - gdata_oauth1_authorizer_set_locale (data->authorizer, NULL); - - g_assert_cmpuint (data->locale_notification_count, ==, 2); - - g_assert_cmpstr (gdata_oauth1_authorizer_get_locale (data->authorizer), ==, NULL); - - g_object_get (data->authorizer, "locale", &locale, NULL); - g_assert_cmpstr (locale, ==, NULL); - g_free (locale); - - /* Test that setting it using g_object_set() works */ - g_object_set (data->authorizer, "locale", "de", NULL); - g_assert_cmpstr (gdata_oauth1_authorizer_get_locale (data->authorizer), ==, "de"); -} - -/* Test getting and setting the proxy-resolver property */ -static void -test_oauth1_authorizer_properties_proxy_resolver (OAuth1AuthorizerData *data, gconstpointer user_data) -{ - GProxyResolver *old_proxy_resolver, *proxy_resolver, *new_proxy_resolver; - - /* Verifying the normal state of the property in a newly-constructed instance of GDataOAuth1Authorizer. - * Since the resolver comes from the SoupSession, we don’t know whether it’s initially NULL. */ - old_proxy_resolver = gdata_oauth1_authorizer_get_proxy_resolver (data->authorizer); - - g_object_get (data->authorizer, "proxy-resolver", &proxy_resolver, NULL); - g_assert (proxy_resolver == old_proxy_resolver); - - g_assert_cmpuint (data->proxy_resolver_notification_count, ==, 0); - - /* Check setting it works and emits a notification */ - new_proxy_resolver = g_object_ref (g_proxy_resolver_get_default ()); - gdata_oauth1_authorizer_set_proxy_resolver (data->authorizer, new_proxy_resolver); - - g_assert_cmpuint (data->proxy_resolver_notification_count, ==, 1); - - g_assert (gdata_oauth1_authorizer_get_proxy_resolver (data->authorizer) != NULL); - g_assert (gdata_oauth1_authorizer_get_proxy_resolver (data->authorizer) == new_proxy_resolver); - - g_object_get (data->authorizer, "proxy-resolver", &proxy_resolver, NULL); - g_assert (proxy_resolver != NULL); - g_assert (gdata_oauth1_authorizer_get_proxy_resolver (data->authorizer) == new_proxy_resolver); - g_object_unref (proxy_resolver); - - g_object_unref (new_proxy_resolver); - - /* Check setting it back to NULL works */ - gdata_oauth1_authorizer_set_proxy_resolver (data->authorizer, NULL); - - g_assert_cmpuint (data->proxy_resolver_notification_count, ==, 2); - - g_assert (gdata_oauth1_authorizer_get_proxy_resolver (data->authorizer) == NULL); - - g_object_get (data->authorizer, "proxy-resolver", &proxy_resolver, NULL); - g_assert (proxy_resolver == NULL); - - /* Test that setting it using g_object_set() works */ - new_proxy_resolver = g_object_ref (g_proxy_resolver_get_default ()); - g_object_set (data->authorizer, "proxy-resolver", new_proxy_resolver, NULL); - g_object_unref (new_proxy_resolver); - - g_assert (gdata_oauth1_authorizer_get_proxy_resolver (data->authorizer) != NULL); -} - -/* Test getting and setting the timeout property */ -static void -test_oauth1_authorizer_properties_timeout (OAuth1AuthorizerData *data, gconstpointer user_data) -{ - guint timeout; - - /* Verifying the normal state of the property in a newly-constructed instance of GDataOAuth1Authorizer */ - g_assert_cmpuint (gdata_oauth1_authorizer_get_timeout (data->authorizer), ==, 0); - - g_object_get (data->authorizer, "timeout", &timeout, NULL); - g_assert_cmpuint (timeout, ==, 0); - - g_assert_cmpuint (data->timeout_notification_count, ==, 0); - - /* Check setting it works and emits a notification */ - gdata_oauth1_authorizer_set_timeout (data->authorizer, 30); - - g_assert_cmpuint (data->timeout_notification_count, ==, 1); - - g_assert_cmpuint (gdata_oauth1_authorizer_get_timeout (data->authorizer), ==, 30); - - g_object_get (data->authorizer, "timeout", &timeout, NULL); - g_assert_cmpuint (timeout, ==, 30); - - /* Check setting it to the same value is a no-op */ - gdata_oauth1_authorizer_set_timeout (data->authorizer, 30); - g_assert_cmpuint (data->timeout_notification_count, ==, 1); - - /* Check setting it back to 0 works */ - gdata_oauth1_authorizer_set_timeout (data->authorizer, 0); - - g_assert_cmpuint (data->timeout_notification_count, ==, 2); - - g_assert_cmpuint (gdata_oauth1_authorizer_get_timeout (data->authorizer), ==, 0); - - g_object_get (data->authorizer, "timeout", &timeout, NULL); - g_assert_cmpuint (timeout, ==, 0); - - /* Test that setting it using g_object_set() works */ - g_object_set (data->authorizer, "timeout", 15, NULL); - g_assert_cmpuint (gdata_oauth1_authorizer_get_timeout (data->authorizer), ==, 15); -} - -/* Test that gdata_authorizer_refresh_authorization() is a no-op (whether authorised or not) */ -static void -test_oauth1_authorizer_refresh_authorization (OAuth1AuthorizerData *data, gconstpointer user_data) -{ - gboolean *skip_test = (gboolean*) user_data; - GError *error = NULL; - - /* Skip the test if the user's requested */ - if (skip_test != NULL && *skip_test == TRUE) { - return; - } - - gdata_test_mock_server_start_trace (mock_server, "oauth1-authorizer-refresh-authorization"); - - g_assert (gdata_authorizer_refresh_authorization (GDATA_AUTHORIZER (data->authorizer), NULL, &error) == FALSE); - g_assert_no_error (error); - g_clear_error (&error); - - uhm_server_end_trace (mock_server); -} - -/* Test that processing a request with a NULL domain will not change the request. */ -static void -test_oauth1_authorizer_process_request_null (OAuth1AuthorizerData *data, gconstpointer user_data) -{ - SoupMessage *message; - SoupMessageHeadersIter iter; - guint header_count = 0; - const gchar *name, *value; - - /* Create a new message with an empty set of request headers */ - message = soup_message_new (SOUP_METHOD_GET, "https://example.com/"); - - /* Process the message */ - gdata_authorizer_process_request (GDATA_AUTHORIZER (data->authorizer), NULL, message); - - /* Check that the set of request headers is still empty */ - soup_message_headers_iter_init (&iter, message->request_headers); - - while (soup_message_headers_iter_next (&iter, &name, &value) == TRUE) { - header_count++; - } - - g_assert_cmpuint (header_count, ==, 0); - - g_object_unref (message); -} - -/* Test that processing a request with an authorizer which hasn't been authenticated yet will not change the request. */ -static void -test_oauth1_authorizer_process_request_unauthenticated (OAuth1AuthorizerData *data, gconstpointer user_data) -{ - SoupMessage *message; - SoupMessageHeadersIter iter; - guint header_count = 0; - const gchar *name, *value; - - /* Create a new message with an empty set of request headers */ - message = soup_message_new (SOUP_METHOD_GET, "https://example.com/"); - - /* Process the message */ - gdata_authorizer_process_request (GDATA_AUTHORIZER (data->authorizer), gdata_contacts_service_get_primary_authorization_domain (), message); - - /* Check that the set of request headers is still empty */ - soup_message_headers_iter_init (&iter, message->request_headers); - - while (soup_message_headers_iter_next (&iter, &name, &value) == TRUE) { - header_count++; - } - - g_assert_cmpuint (header_count, ==, 0); - - g_object_unref (message); -} - -/* Test that processing a request with an authorizer which has been authenticated will change the request. */ -static void -test_oauth1_authorizer_process_request_authenticated (OAuth1AuthorizerData *data, gconstpointer user_data) -{ - gboolean *skip_test = (gboolean*) user_data; - SoupMessage *message; - SoupMessageHeadersIter iter; - guint header_count = 0; - const gchar *name, *value; - - /* Skip the test if the user's requested */ - if (skip_test != NULL && *skip_test == TRUE) { - return; - } - - /* Create a new message with an empty set of request headers */ - message = soup_message_new (SOUP_METHOD_GET, "http://example.com/"); - - /* Process the message */ - gdata_authorizer_process_request (GDATA_AUTHORIZER (data->authorizer), gdata_contacts_service_get_primary_authorization_domain (), message); - - /* Check that at least one new header has been set */ - soup_message_headers_iter_init (&iter, message->request_headers); - - while (soup_message_headers_iter_next (&iter, &name, &value) == TRUE) { - header_count++; - } - - g_assert_cmpuint (header_count, >, 0); - - g_object_unref (message); -} - -/* Test that requesting an authentication URI synchronously works correctly */ -static void -test_oauth1_authorizer_request_authentication_uri_sync (OAuth1AuthorizerData *data, gconstpointer user_data) -{ - gchar *authentication_uri, *token, *token_secret; - GError *error = NULL; - - gdata_test_mock_server_start_trace (mock_server, "oauth1-authorizer-request-authentication-uri-sync"); - - authentication_uri = gdata_oauth1_authorizer_request_authentication_uri (data->authorizer, &token, &token_secret, NULL, &error); -#ifdef ENABLE_OAUTH1 - g_assert_no_error (error); - g_assert (authentication_uri != NULL && *authentication_uri != '\0'); - g_assert (token != NULL && *token != '\0'); - g_assert (token_secret != NULL && *token_secret != '\0'); - g_clear_error (&error); - - g_test_message ("Requesting an authentication URI gave “%s” with request token “%s” and request token secret “%s”.", - authentication_uri, token, token_secret); - - g_free (authentication_uri); - g_free (token); - g_free (token_secret); -#else - g_assert_error (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_UNAVAILABLE); - g_assert_null (authentication_uri); - g_clear_error (&error); -#endif - - uhm_server_end_trace (mock_server); -} - -/* Test that requesting an authentication URI synchronously can be cancelled */ -static void -test_oauth1_authorizer_request_authentication_uri_sync_cancellation (OAuth1AuthorizerData *data, gconstpointer user_data) -{ - /* Initialise token and token_secret so we check that gdata_oauth1_authorizer_request_authentication_uri() NULLifies them on error */ - gchar *authentication_uri, *token = (gchar*) "error", *token_secret = (gchar*) "error"; - GCancellable *cancellable; - GError *error = NULL; - - gdata_test_mock_server_start_trace (mock_server, "oauth1-authorizer-request-authentication-uri-sync-cancellation"); - - /* Set up the cancellable */ - cancellable = g_cancellable_new (); - - /* Get a request token. This should return immediately as the cancellable was cancelled beforehand. */ - g_cancellable_cancel (cancellable); - authentication_uri = gdata_oauth1_authorizer_request_authentication_uri (data->authorizer, &token, &token_secret, cancellable, &error); - g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED); - g_assert (authentication_uri == NULL); - g_assert (token == NULL); - g_assert (token_secret == NULL); - g_clear_error (&error); - - g_free (authentication_uri); - g_free (token); - g_free (token_secret); - - g_object_unref (cancellable); - - uhm_server_end_trace (mock_server); -} - -typedef struct { - OAuth1AuthorizerData parent; - GMainLoop *main_loop; -} OAuth1AuthorizerAsyncData; - -static void -set_up_oauth1_authorizer_async_data (OAuth1AuthorizerAsyncData *data, gconstpointer user_data) -{ - /* Chain up */ - set_up_oauth1_authorizer_data ((OAuth1AuthorizerData*) data, user_data); - - /* Set up the main loop */ - data->main_loop = g_main_loop_new (NULL, FALSE); -} - -static void -set_up_oauth1_authorizer_async_data_multiple_domains (OAuth1AuthorizerAsyncData *data, gconstpointer user_data) -{ - /* Chain up */ - set_up_oauth1_authorizer_data_multiple_domains ((OAuth1AuthorizerData*) data, user_data); - - /* Set up the main loop */ - data->main_loop = g_main_loop_new (NULL, FALSE); -} - -static void -tear_down_oauth1_authorizer_async_data (OAuth1AuthorizerAsyncData *data, gconstpointer user_data) -{ - g_main_loop_unref (data->main_loop); - - /* Chain up */ - tear_down_oauth1_authorizer_data ((OAuth1AuthorizerData*) data, user_data); -} - -static void -test_oauth1_authorizer_request_authentication_uri_async_cb (GDataOAuth1Authorizer *authorizer, GAsyncResult *async_result, - OAuth1AuthorizerAsyncData *data) -{ - gchar *authentication_uri, *token, *token_secret; - GError *error = NULL; - - authentication_uri = gdata_oauth1_authorizer_request_authentication_uri_finish (authorizer, async_result, &token, &token_secret, &error); -#ifdef ENABLE_OAUTH1 - g_assert_no_error (error); - g_assert (authentication_uri != NULL && *authentication_uri != '\0'); - g_assert (token != NULL && *token != '\0'); - g_assert (token_secret != NULL && *token_secret != '\0'); - g_clear_error (&error); - - g_test_message ("Requesting an authentication URI asynchronously gave “%s” with request token “%s” and request token secret “%s”.", - authentication_uri, token, token_secret); - - g_free (authentication_uri); - g_free (token); - g_free (token_secret); -#else - g_assert_error (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_UNAVAILABLE); - g_assert_null (authentication_uri); - g_clear_error (&error); -#endif - - g_main_loop_quit (data->main_loop); -} - -/* Test that asynchronously requesting an authentication URI for a single authorization domain works */ -static void -test_oauth1_authorizer_request_authentication_uri_async (OAuth1AuthorizerAsyncData *data, gconstpointer user_data) -{ - gdata_test_mock_server_start_trace (mock_server, "oauth1-authorizer-request-authentication-uri-async"); - - /* Create a main loop and request an authentication URI */ - gdata_oauth1_authorizer_request_authentication_uri_async (data->parent.authorizer, NULL, - (GAsyncReadyCallback) test_oauth1_authorizer_request_authentication_uri_async_cb, - data); - - g_main_loop_run (data->main_loop); - - uhm_server_end_trace (mock_server); -} - -static void -test_oauth1_authorizer_request_authentication_uri_async_cancellation_cb (GDataOAuth1Authorizer *authorizer, GAsyncResult *async_result, - OAuth1AuthorizerAsyncData *data) -{ - /* Initialise token and token_secret so we check that gdata_oauth1_authorizer_request_authentication_uri_finish() NULLifies them on error */ - gchar *authentication_uri, *token = (gchar*) "error", *token_secret = (gchar*) "error"; - GError *error = NULL; - - authentication_uri = gdata_oauth1_authorizer_request_authentication_uri_finish (authorizer, async_result, &token, &token_secret, &error); - g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED); - g_assert (authentication_uri == NULL); - g_assert (token == NULL); - g_assert (token_secret == NULL); - g_clear_error (&error); - - g_free (authentication_uri); - g_free (token); - g_free (token_secret); - - g_main_loop_quit (data->main_loop); -} - -/* Test that cancellation of asynchronous authentication URI requests work */ -static void -test_oauth1_authorizer_request_authentication_uri_async_cancellation (OAuth1AuthorizerAsyncData *data, gconstpointer user_data) -{ - GCancellable *cancellable; - - gdata_test_mock_server_start_trace (mock_server, "oauth1-authorizer-request-authentication-uri-async-cancellation"); - - /* Set up the cancellable */ - cancellable = g_cancellable_new (); - - /* Create a main loop and request an authentication URI */ - gdata_oauth1_authorizer_request_authentication_uri_async (data->parent.authorizer, cancellable, - (GAsyncReadyCallback) - test_oauth1_authorizer_request_authentication_uri_async_cancellation_cb, - data); - g_cancellable_cancel (cancellable); - - g_main_loop_run (data->main_loop); - - g_object_unref (cancellable); - - uhm_server_end_trace (mock_server); -} - -typedef struct { - OAuth1AuthorizerData parent; - gchar *token; - gchar *token_secret; - gchar *verifier; -} OAuth1AuthorizerInteractiveData; - -/* NOTE: Any consumer of this data has to check for (data->verifier == NULL) and skip the test in that case */ -static void -set_up_oauth1_authorizer_interactive_data (OAuth1AuthorizerInteractiveData *data, gconstpointer user_data) -{ - gchar *authentication_uri; - - /* Chain up */ - set_up_oauth1_authorizer_data ((OAuth1AuthorizerData*) data, user_data); - - gdata_test_mock_server_start_trace (mock_server, "setup-oauth1-authorizer-interactive-data"); - - /* Get an authentication URI */ - authentication_uri = gdata_oauth1_authorizer_request_authentication_uri (data->parent.authorizer, &(data->token), &(data->token_secret), - NULL, NULL); - g_assert (authentication_uri != NULL); - - /* Wait for the user to retrieve and enter the verifier */ - data->verifier = gdata_test_query_user_for_verifier (authentication_uri); - - g_free (authentication_uri); - - uhm_server_end_trace (mock_server); -} - -#ifdef ENABLE_OAUTH1 -static void -set_up_oauth1_authorizer_interactive_data_bad_credentials (OAuth1AuthorizerInteractiveData *data, gconstpointer user_data) -{ - gchar *authentication_uri; - - /* Chain up */ - set_up_oauth1_authorizer_data ((OAuth1AuthorizerData*) data, user_data); - - gdata_test_mock_server_start_trace (mock_server, "oauth1-authorizer-interactive-data-bad-credentials"); - - /* Get an authentication URI */ - authentication_uri = gdata_oauth1_authorizer_request_authentication_uri (data->parent.authorizer, &(data->token), &(data->token_secret), - NULL, NULL); - g_assert (authentication_uri != NULL); - - /* Give a bogus verifier */ - data->verifier = g_strdup ("test"); - - g_free (authentication_uri); - - uhm_server_end_trace (mock_server); -} -#endif /* ENABLE_OAUTH1 */ - -static void -tear_down_oauth1_authorizer_interactive_data (OAuth1AuthorizerInteractiveData *data, gconstpointer user_data) -{ - g_free (data->token); - g_free (data->token_secret); - g_free (data->verifier); - - /* Chain up */ - tear_down_oauth1_authorizer_data ((OAuth1AuthorizerData*) data, user_data); -} - -/* Test that synchronously authorizing a request token is successful. Note that this test has to be interactive, as the user has to visit the - * authentication URI to retrieve a verifier for the request token. */ -static void -test_oauth1_authorizer_request_authorization_sync (OAuth1AuthorizerInteractiveData *data, gconstpointer user_data) -{ - gboolean success; - GError *error = NULL; - - /* Skip the test if the user's requested */ - if (data->verifier == NULL) { - return; - } - - gdata_test_mock_server_start_trace (mock_server, "oauth1-authorizer-request-authorization-sync"); - - /* Check we're not authorised beforehand */ - g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER (data->parent.authorizer), - gdata_contacts_service_get_primary_authorization_domain ()) == FALSE); - - /* Test that authorising the token retrieved previously is successful */ - success = gdata_oauth1_authorizer_request_authorization (data->parent.authorizer, data->token, data->token_secret, data->verifier, NULL, - &error); - g_assert_no_error (error); - g_assert (success == TRUE); - g_clear_error (&error); - - /* Are we authorised now? */ - g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER (data->parent.authorizer), - gdata_contacts_service_get_primary_authorization_domain ()) == TRUE); - - uhm_server_end_trace (mock_server); -} - -#ifdef ENABLE_OAUTH1 -/* Test that synchronously authorizing a request token fails if an invalid verifier is provided. */ -static void -test_oauth1_authorizer_request_authorization_sync_bad_credentials (OAuth1AuthorizerInteractiveData *data, gconstpointer user_data) -{ - gboolean success; - GError *error = NULL; - - gdata_test_mock_server_start_trace (mock_server, "oauth1-authorizer-request-authorization-sync-bad-credentials"); - - /* Check we're not authorised beforehand */ - g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER (data->parent.authorizer), - gdata_contacts_service_get_primary_authorization_domain ()) == FALSE); - - /* Test that authorising the token retrieved above fails */ - success = gdata_oauth1_authorizer_request_authorization (data->parent.authorizer, data->token, data->token_secret, data->verifier, NULL, - &error); - g_assert_error (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_FORBIDDEN); - g_assert (success == FALSE); - g_clear_error (&error); - - /* Are we authorised now? */ - g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER (data->parent.authorizer), - gdata_contacts_service_get_primary_authorization_domain ()) == FALSE); - - uhm_server_end_trace (mock_server); -} -#endif /* ENABLE_OAUTH1 */ - -/* Test that cancellation of synchronously authorizing a request token works. Note that this test has to be interactive, as the user has to visit the - * authentication URI to retrieve a verifier for the request token. */ -static void -test_oauth1_authorizer_request_authorization_sync_cancellation (OAuth1AuthorizerInteractiveData *data, gconstpointer user_data) -{ - gboolean success; - GCancellable *cancellable; - GError *error = NULL; - - /* Skip the test if the user's requested */ - if (data->verifier == NULL) { - return; - } - - gdata_test_mock_server_start_trace (mock_server, "oauth1-authorizer-request-authorization-sync-cancellation"); - - /* Check we're not authorised beforehand */ - g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER (data->parent.authorizer), - gdata_contacts_service_get_primary_authorization_domain ()) == FALSE); - - /* Create the cancellable */ - cancellable = g_cancellable_new (); - - /* Test that authorising the token retrieved above is successful */ - g_cancellable_cancel (cancellable); - success = gdata_oauth1_authorizer_request_authorization (data->parent.authorizer, data->token, data->token_secret, data->verifier, - cancellable, &error); - g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED); - g_assert (success == FALSE); - g_clear_error (&error); - - /* Are we authorised now? */ - g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER (data->parent.authorizer), - gdata_contacts_service_get_primary_authorization_domain ()) == FALSE); - - g_object_unref (cancellable); - - uhm_server_end_trace (mock_server); -} - -typedef struct { - OAuth1AuthorizerInteractiveData parent; - GMainLoop *main_loop; -} OAuth1AuthorizerInteractiveAsyncData; - -/* NOTE: Any consumer of this data has to check for (data->verifier == NULL) and skip the test in that case */ -static void -set_up_oauth1_authorizer_interactive_async_data (OAuth1AuthorizerInteractiveAsyncData *data, gconstpointer user_data) -{ - /* Chain up */ - set_up_oauth1_authorizer_interactive_data ((OAuth1AuthorizerInteractiveData*) data, user_data); - - /* Set up the main loop */ - data->main_loop = g_main_loop_new (NULL, FALSE); -} - -#ifdef ENABLE_OAUTH1 -static void -set_up_oauth1_authorizer_interactive_async_data_bad_credentials (OAuth1AuthorizerInteractiveAsyncData *data, gconstpointer user_data) -{ - /* Chain up */ - set_up_oauth1_authorizer_interactive_data_bad_credentials ((OAuth1AuthorizerInteractiveData*) data, user_data); - - /* Set up the main loop */ - data->main_loop = g_main_loop_new (NULL, FALSE); -} -#endif /* ENABLE_OAUTH1 */ - -static void -tear_down_oauth1_authorizer_interactive_async_data (OAuth1AuthorizerInteractiveAsyncData *data, gconstpointer user_data) -{ - g_main_loop_unref (data->main_loop); - - /* Chain up */ - tear_down_oauth1_authorizer_interactive_data ((OAuth1AuthorizerInteractiveData*) data, user_data); -} - -static void -test_oauth1_authorizer_request_authorization_async_cb (GDataOAuth1Authorizer *authorizer, GAsyncResult *async_result, - OAuth1AuthorizerInteractiveAsyncData *data) -{ - gboolean success; - GError *error = NULL; - - success = gdata_oauth1_authorizer_request_authorization_finish (authorizer, async_result, &error); - g_assert_no_error (error); - g_assert (success == TRUE); - g_clear_error (&error); - - /* Are we authorised now? */ - g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER (authorizer), - gdata_contacts_service_get_primary_authorization_domain ()) == TRUE); - - g_main_loop_quit (data->main_loop); -} - -/* Test that asynchronously authorizing a request token works. Note that this test has to be interactive, as the user has to visit the - * authentication URI to retrieve a verifier for the request token. */ -static void -test_oauth1_authorizer_request_authorization_async (OAuth1AuthorizerInteractiveAsyncData *data, gconstpointer user_data) -{ - /* Skip the test if the user's requested */ - if (data->parent.verifier == NULL) { - return; - } - - gdata_test_mock_server_start_trace (mock_server, "oauth1-authorizer-request-authorization-async"); - - /* Check we're not authorised beforehand */ - g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER (data->parent.parent.authorizer), - gdata_contacts_service_get_primary_authorization_domain ()) == FALSE); - - /* Create a main loop and request authorization */ - gdata_oauth1_authorizer_request_authorization_async (data->parent.parent.authorizer, data->parent.token, data->parent.token_secret, - data->parent.verifier, NULL, - (GAsyncReadyCallback) test_oauth1_authorizer_request_authorization_async_cb, data); - - g_main_loop_run (data->main_loop); - - uhm_server_end_trace (mock_server); -} - -#ifdef ENABLE_OAUTH1 -static void -test_oauth1_authorizer_request_authorization_async_bad_credentials_cb (GDataOAuth1Authorizer *authorizer, GAsyncResult *async_result, - OAuth1AuthorizerInteractiveAsyncData *data) -{ - gboolean success; - GError *error = NULL; - - success = gdata_oauth1_authorizer_request_authorization_finish (authorizer, async_result, &error); - g_assert_error (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_FORBIDDEN); - g_assert (success == FALSE); - g_clear_error (&error); - - /* Are we authorised now? */ - g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER (authorizer), - gdata_contacts_service_get_primary_authorization_domain ()) == FALSE); - - g_main_loop_quit (data->main_loop); -} - -/* Test that asynchronously authorizing a request token fails if an invalid verifier is provided. */ -static void -test_oauth1_authorizer_request_authorization_async_bad_credentials (OAuth1AuthorizerInteractiveAsyncData *data, gconstpointer user_data) -{ - gdata_test_mock_server_start_trace (mock_server, "oauth1-authorizer-request-authorization-async-bad-credentials"); - - /* Check we're not authorised beforehand */ - g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER (data->parent.parent.authorizer), - gdata_contacts_service_get_primary_authorization_domain ()) == FALSE); - - /* Create a main loop and request authorization */ - gdata_oauth1_authorizer_request_authorization_async (data->parent.parent.authorizer, data->parent.token, data->parent.token_secret, - data->parent.verifier, NULL, - (GAsyncReadyCallback) - test_oauth1_authorizer_request_authorization_async_bad_credentials_cb, - data); - - g_main_loop_run (data->main_loop); - - uhm_server_end_trace (mock_server); -} -#endif /* ENABLE_OAUTH1 */ - -static void -test_oauth1_authorizer_request_authorization_async_cancellation_cb (GDataOAuth1Authorizer *authorizer, GAsyncResult *async_result, - OAuth1AuthorizerInteractiveAsyncData *data) -{ - gboolean success; - GError *error = NULL; - - success = gdata_oauth1_authorizer_request_authorization_finish (authorizer, async_result, &error); - g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED); - g_assert (success == FALSE); - g_clear_error (&error); - - /* Are we authorised now? */ - g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER (authorizer), - gdata_contacts_service_get_primary_authorization_domain ()) == FALSE); - - g_main_loop_quit (data->main_loop); -} - -/* Test that cancelling asynchronously authorizing a request token works. Note that this test has to be interactive, as the user has to visit the - * authentication URI to retrieve a verifier for the request token. */ -static void -test_oauth1_authorizer_request_authorization_async_cancellation (OAuth1AuthorizerInteractiveAsyncData *data, gconstpointer user_data) -{ - GCancellable *cancellable; - - /* Skip the test if the user's requested */ - if (data->parent.verifier == NULL) { - return; - } - - gdata_test_mock_server_start_trace (mock_server, "oauth1-authorizer-request-authorization-async-cancellation"); - - /* Check we're not authorised beforehand */ - g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER (data->parent.parent.authorizer), - gdata_contacts_service_get_primary_authorization_domain ()) == FALSE); - - /* Create the cancellable */ - cancellable = g_cancellable_new (); - - /* Create a main loop and request authorization */ - gdata_oauth1_authorizer_request_authorization_async (data->parent.parent.authorizer, data->parent.token, data->parent.token_secret, - data->parent.verifier, cancellable, - (GAsyncReadyCallback) test_oauth1_authorizer_request_authorization_async_cancellation_cb, - data); - g_cancellable_cancel (cancellable); - - g_main_loop_run (data->main_loop); - - g_object_unref (cancellable); - - uhm_server_end_trace (mock_server); -} - -static void -mock_server_notify_resolver_cb (GObject *object, GParamSpec *pspec, gpointer user_data) -{ - UhmServer *server; - UhmResolver *resolver; - - server = UHM_SERVER (object); - - /* Set up the expected domain names here. This should technically be split up between - * the different unit test suites, but that's too much effort. */ - resolver = uhm_server_get_resolver (server); - - if (resolver != NULL) { - const gchar *ip_address = uhm_server_get_address (server); - - uhm_resolver_add_A (resolver, "www.google.com", ip_address); - } -} - -int -main (int argc, char *argv[]) -{ - GFile *trace_directory; - gchar *path = NULL; - - gdata_test_init (argc, argv); - - mock_server = gdata_test_get_mock_server (); - g_signal_connect (G_OBJECT (mock_server), "notify::resolver", (GCallback) mock_server_notify_resolver_cb, NULL); - path = g_test_build_filename (G_TEST_DIST, "traces/oauth1-authorizer", NULL); - trace_directory = g_file_new_for_path (path); - g_free (path); - uhm_server_set_trace_directory (mock_server, trace_directory); - g_object_unref (trace_directory); - - main_thread = g_thread_self (); - - g_test_add_func ("/oauth1-authorizer/constructor", test_oauth1_authorizer_constructor); - g_test_add_func ("/oauth1-authorizer/constructor/for-domains", test_oauth1_authorizer_constructor_for_domains); - - g_test_add ("/oauth1-authorizer/properties/application-name", OAuth1AuthorizerData, NULL, set_up_oauth1_authorizer_data, - test_oauth1_authorizer_properties_application_name, tear_down_oauth1_authorizer_data); - g_test_add ("/oauth1-authorizer/properties/application-name/fallback", OAuth1AuthorizerData, NULL, - set_up_oauth1_authorizer_data_fallback_application_name, test_oauth1_authorizer_properties_application_name_fallback, - tear_down_oauth1_authorizer_data); - g_test_add ("/oauth1-authorizer/properties/locale", OAuth1AuthorizerData, NULL, set_up_oauth1_authorizer_data, - test_oauth1_authorizer_properties_locale, tear_down_oauth1_authorizer_data); - g_test_add ("/oauth1-authorizer/properties/proxy-resolver", OAuth1AuthorizerData, NULL, set_up_oauth1_authorizer_data, - test_oauth1_authorizer_properties_proxy_resolver, tear_down_oauth1_authorizer_data); - g_test_add ("/oauth1-authorizer/properties/timeout", OAuth1AuthorizerData, NULL, set_up_oauth1_authorizer_data, - test_oauth1_authorizer_properties_timeout, tear_down_oauth1_authorizer_data); - - g_test_add ("/oauth1-authorizer/refresh-authorization/unauthenticated", OAuth1AuthorizerData, NULL, - set_up_oauth1_authorizer_data, test_oauth1_authorizer_refresh_authorization, tear_down_oauth1_authorizer_data); - - g_test_add ("/oauth1-authorizer/process-request/null", OAuth1AuthorizerData, NULL, - set_up_oauth1_authorizer_data, test_oauth1_authorizer_process_request_null, tear_down_oauth1_authorizer_data); - g_test_add ("/oauth1-authorizer/process-request/unauthenticated", OAuth1AuthorizerData, NULL, - set_up_oauth1_authorizer_data, test_oauth1_authorizer_process_request_unauthenticated, tear_down_oauth1_authorizer_data); - - /* Sync request-authentication-uri tests */ - g_test_add ("/oauth1-authorizer/request-authentication-uri/sync", OAuth1AuthorizerData, NULL, set_up_oauth1_authorizer_data, - test_oauth1_authorizer_request_authentication_uri_sync, tear_down_oauth1_authorizer_data); - g_test_add ("/oauth1-authorizer/request-authentication-uri/sync/multiple-domains", OAuth1AuthorizerData, NULL, - set_up_oauth1_authorizer_data_multiple_domains, test_oauth1_authorizer_request_authentication_uri_sync, - tear_down_oauth1_authorizer_data); - g_test_add ("/oauth1-authorizer/request-authentication-uri/sync/locale", OAuth1AuthorizerData, NULL, - set_up_oauth1_authorizer_data_locale, test_oauth1_authorizer_request_authentication_uri_sync, - tear_down_oauth1_authorizer_data); - g_test_add ("/oauth1-authorizer/request-authentication-uri/sync/cancellation", OAuth1AuthorizerData, NULL, - set_up_oauth1_authorizer_data, test_oauth1_authorizer_request_authentication_uri_sync_cancellation, - tear_down_oauth1_authorizer_data); - - /* Async request-authentication-uri tests */ - g_test_add ("/oauth1-authorizer/request-authentication-uri/async", OAuth1AuthorizerAsyncData, NULL, - set_up_oauth1_authorizer_async_data, test_oauth1_authorizer_request_authentication_uri_async, - tear_down_oauth1_authorizer_async_data); - g_test_add ("/oauth1-authorizer/request-authentication-uri/async/multiple-domains", OAuth1AuthorizerAsyncData, NULL, - set_up_oauth1_authorizer_async_data_multiple_domains, test_oauth1_authorizer_request_authentication_uri_async, - tear_down_oauth1_authorizer_async_data); - g_test_add ("/oauth1-authorizer/request-authentication-uri/async/cancellation", OAuth1AuthorizerAsyncData, NULL, - set_up_oauth1_authorizer_async_data, test_oauth1_authorizer_request_authentication_uri_async_cancellation, - tear_down_oauth1_authorizer_async_data); - - /* Sync request-authorization tests */ - if (gdata_test_interactive () == TRUE) { - g_test_add ("/oauth1-authorizer/request-authorization/sync", OAuth1AuthorizerInteractiveData, NULL, - set_up_oauth1_authorizer_interactive_data, test_oauth1_authorizer_request_authorization_sync, - tear_down_oauth1_authorizer_interactive_data); - g_test_add ("/oauth1-authorizer/request-authorization/sync/cancellation", OAuth1AuthorizerInteractiveData, NULL, - set_up_oauth1_authorizer_interactive_data, test_oauth1_authorizer_request_authorization_sync_cancellation, - tear_down_oauth1_authorizer_interactive_data); - } - -#ifdef ENABLE_OAUTH1 - g_test_add ("/oauth1-authorizer/request-authorization/sync/bad-credentials", OAuth1AuthorizerInteractiveData, NULL, - set_up_oauth1_authorizer_interactive_data_bad_credentials, - test_oauth1_authorizer_request_authorization_sync_bad_credentials, tear_down_oauth1_authorizer_interactive_data); -#endif - - /* Async request-authorization tests */ - if (gdata_test_interactive () == TRUE) { - g_test_add ("/oauth1-authorizer/request-authorization/async", OAuth1AuthorizerInteractiveAsyncData, NULL, - set_up_oauth1_authorizer_interactive_async_data, test_oauth1_authorizer_request_authorization_async, - tear_down_oauth1_authorizer_interactive_async_data); - g_test_add ("/oauth1-authorizer/request-authorization/async/cancellation", OAuth1AuthorizerInteractiveAsyncData, NULL, - set_up_oauth1_authorizer_interactive_async_data, test_oauth1_authorizer_request_authorization_async_cancellation, - tear_down_oauth1_authorizer_interactive_async_data); - } - -#ifdef ENABLE_OAUTH1 - g_test_add ("/oauth1-authorizer/request-authorization/async/bad-credentials", OAuth1AuthorizerInteractiveAsyncData, NULL, - set_up_oauth1_authorizer_interactive_async_data_bad_credentials, - test_oauth1_authorizer_request_authorization_async_bad_credentials, tear_down_oauth1_authorizer_interactive_async_data); -#endif - - /* Miscellaneous tests */ - if (gdata_test_interactive () == TRUE) { - gboolean skip_test = FALSE; - - g_test_add ("/oauth1-authorizer/refresh-authorization/authenticated", OAuth1AuthorizerData, &skip_test, - set_up_oauth1_authorizer_data_authenticated, test_oauth1_authorizer_refresh_authorization, - tear_down_oauth1_authorizer_data); - - g_test_add ("/oauth1-authorizer/process-request/authenticated", OAuth1AuthorizerData, &skip_test, - set_up_oauth1_authorizer_data_authenticated, test_oauth1_authorizer_process_request_authenticated, - tear_down_oauth1_authorizer_data); - } - - return g_test_run (); -} - -G_GNUC_END_IGNORE_DEPRECATIONS diff --git a/gdata/tests/picasaweb.c b/gdata/tests/picasaweb.c index 19978e3c..b218aa7f 100644 --- a/gdata/tests/picasaweb.c +++ b/gdata/tests/picasaweb.c @@ -2074,7 +2074,7 @@ mock_server_notify_resolver_cb (GObject *object, GParamSpec *pspec, gpointer use } /* Set up a global GDataAuthorizer to be used for all the tests. Unfortunately, - * the Google PicasaWeb API is limited to OAuth1 and OAuth2 authorisation, so + * the Google PicasaWeb API is limited to OAuth2 authorisation, so * this requires user interaction when online. * * If not online, use a dummy authoriser. */ diff --git a/gdata/tests/tasks.c b/gdata/tests/tasks.c index 6f3073ad..9ea0ed27 100644 --- a/gdata/tests/tasks.c +++ b/gdata/tests/tasks.c @@ -1303,7 +1303,7 @@ mock_server_notify_resolver_cb (GObject *object, GParamSpec *pspec, } /* Set up a global GDataAuthorizer to be used for all the tests. Unfortunately, - * the Google Tasks API is limited to OAuth1 and OAuth2 authorisation, so this + * the Google Tasks API is limited to OAuth2 authorisation, so this * requires user interaction when online. * * If not online, use a dummy authoriser. */ diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-interactive-data-bad-credentials b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-interactive-data-bad-credentials deleted file mode 100644 index 5187564a..00000000 --- a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-interactive-data-bad-credentials +++ /dev/null @@ -1,25 +0,0 @@ -> POST /accounts/OAuthGetRequestToken HTTP/1.1 -> Soup-Debug-Timestamp: 1375114467 -> Soup-Debug: SoupSession 1 (0x6502c0), SoupMessage 1 (0x9750e0), SoupSocket 1 (0x9933b0) -> Host: www.google.com -> Content-Type: application/x-www-form-urlencoded -> Authorization: OAuth oauth_consumer_key="anonymous",oauth_signature_method="HMAC-SHA1",oauth_signature="N7FRU%2BJKa4kkjlUpzlGAHSxPUqg%3D",oauth_timestamp="1375114466",oauth_nonce="JKLrpVu2KW9WiZwsbko1MHtRh",oauth_version="1.0" -> Accept-Encoding: gzip, deflate -> Connection: Keep-Alive -> -> xoauth%5Fdisplayname=Application+name&scope=https%3A%2F%2Fwww%2Egoogle%2Ecom%2Fm8%2Ffeeds%2F&oauth%5Fcallback=oob - -< HTTP/1.1 200 OK -< Soup-Debug-Timestamp: 1375114467 -< Soup-Debug: SoupMessage 1 (0x9750e0) -< Content-Type: text/plain; charset=UTF-8 -< Date: Mon, 29 Jul 2013 16:14:27 GMT -< Expires: Mon, 29 Jul 2013 16:14:27 GMT -< Cache-Control: private, max-age=0 -< X-Content-Type-Options: nosniff -< X-XSS-Protection: 1; mode=block -< Content-Length: 118 -< Server: GSE -< -< oauth_token=4%2FcPV6prKvQtxeeXkhgI1iJ6nLQbCX&oauth_token_secret=BdUGkbnkl6_UTaa0I2049cxp&oauth_callback_confirmed=true - diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-refresh-authorization b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-refresh-authorization deleted file mode 100644 index e69de29b..00000000 --- a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-refresh-authorization +++ /dev/null diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-async b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-async deleted file mode 100644 index 282d8df2..00000000 --- a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-async +++ /dev/null @@ -1,25 +0,0 @@ -> POST /accounts/OAuthGetRequestToken HTTP/1.1 -> Soup-Debug-Timestamp: 1375114409 -> Soup-Debug: SoupSession 1 (0x650700), SoupMessage 1 (0x7fffe0012c60), SoupSocket 1 (0x7fffe0026d30) -> Host: www.google.com -> Content-Type: application/x-www-form-urlencoded -> Authorization: OAuth oauth_consumer_key="anonymous",oauth_signature_method="HMAC-SHA1",oauth_signature="EKMKB4gUkr5rUEeps37CrSS7iWI%3D",oauth_timestamp="1375114409",oauth_nonce="IFERKYPbzEzuA3QE_Zgw1moU1ZR",oauth_version="1.0" -> Accept-Encoding: gzip, deflate -> Connection: Keep-Alive -> -> xoauth%5Fdisplayname=Application+name&scope=https%3A%2F%2Fwww%2Egoogle%2Ecom%2Fm8%2Ffeeds%2F+http%3A%2F%2Fpicasaweb%2Egoogle%2Ecom%2Fdata%2F&oauth%5Fcallback=oob - -< HTTP/1.1 200 OK -< Soup-Debug-Timestamp: 1375114409 -< Soup-Debug: SoupMessage 1 (0x7fffe0012c60) -< Content-Type: text/plain; charset=UTF-8 -< Date: Mon, 29 Jul 2013 16:13:29 GMT -< Expires: Mon, 29 Jul 2013 16:13:29 GMT -< Cache-Control: private, max-age=0 -< X-Content-Type-Options: nosniff -< X-XSS-Protection: 1; mode=block -< Content-Length: 118 -< Server: GSE -< -< oauth_token=4%2FRzdH5fU5KLdaoDTqznYQlkMez4Wj&oauth_token_secret=GYkwQ3BIHviff69Y9Zld6g2u&oauth_callback_confirmed=true - diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-async-cancellation b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-async-cancellation deleted file mode 100644 index e69de29b..00000000 --- a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-async-cancellation +++ /dev/null diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-sync b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-sync deleted file mode 100644 index 6a454463..00000000 --- a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-sync +++ /dev/null @@ -1,25 +0,0 @@ -> POST /accounts/OAuthGetRequestToken HTTP/1.1 -> Soup-Debug-Timestamp: 1375114409 -> Soup-Debug: SoupSession 1 (0x6505f0), SoupMessage 1 (0x975590), SoupSocket 1 (0x993530) -> Host: www.google.com -> Content-Type: application/x-www-form-urlencoded -> Authorization: OAuth oauth_consumer_key="anonymous",oauth_signature_method="HMAC-SHA1",oauth_signature="tfOHmtfJ3fBhyQK9pvma4kx6OlM%3D",oauth_timestamp="1375114409",oauth_nonce="X4sZD_njIKcgSr6paHPVByY8LOjFA",oauth_version="1.0" -> Accept-Encoding: gzip, deflate -> Connection: Keep-Alive -> -> xoauth%5Fdisplayname=Application+name&scope=https%3A%2F%2Fwww%2Egoogle%2Ecom%2Fm8%2Ffeeds%2F&oauth%5Fcallback=oob - -< HTTP/1.1 200 OK -< Soup-Debug-Timestamp: 1375114409 -< Soup-Debug: SoupMessage 1 (0x975590) -< Content-Type: text/plain; charset=UTF-8 -< Date: Mon, 29 Jul 2013 16:13:29 GMT -< Expires: Mon, 29 Jul 2013 16:13:29 GMT -< Cache-Control: private, max-age=0 -< X-Content-Type-Options: nosniff -< X-XSS-Protection: 1; mode=block -< Content-Length: 118 -< Server: GSE -< -< oauth_token=4%2F12bPxj_QaPxom9ALAmIMn5-ZU3wR&oauth_token_secret=Kiuy8Zz-8SzZJ8jQU_83nk9w&oauth_callback_confirmed=true - diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-sync-cancellation b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-sync-cancellation deleted file mode 100644 index e69de29b..00000000 --- a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-sync-cancellation +++ /dev/null diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-async b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-async deleted file mode 100644 index d9ba4aee..00000000 --- a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-async +++ /dev/null @@ -1,25 +0,0 @@ -> POST /accounts/OAuthGetAccessToken HTTP/1.1 -> Soup-Debug-Timestamp: 1375114434 -> Soup-Debug: SoupSession 1 (0x6503d0), SoupMessage 2 (0x7fffe0012e40), SoupSocket 2 (0x7fffe0026df0) -> Host: www.google.com -> Content-Type: application/x-www-form-urlencoded -> Authorization: OAuth oauth_consumer_key="anonymous",oauth_token="4%2FfV2Y0aq-WjEgiSDxvVQdNqQZvX8l",oauth_signature_method="HMAC-SHA1",oauth_signature="8Px9eqo%2BkXJdZg5ufcmTGXNGHGw%3D",oauth_timestamp="1375114434",oauth_nonce="_bRhTyvvq372wr_XjB4WPWl0qt2Uq",oauth_version="1.0" -> Accept-Encoding: gzip, deflate -> Connection: Keep-Alive -> -> oauth%5Fverifier=ks5YXkMmIT1KT4%2DG1IdRW8zH - -< HTTP/1.1 200 OK -< Soup-Debug-Timestamp: 1375114434 -< Soup-Debug: SoupMessage 2 (0x7fffe0012e40) -< Content-Type: text/plain; charset=UTF-8 -< Date: Mon, 29 Jul 2013 16:13:54 GMT -< Expires: Mon, 29 Jul 2013 16:13:54 GMT -< Cache-Control: private, max-age=0 -< X-Content-Type-Options: nosniff -< X-XSS-Protection: 1; mode=block -< Content-Length: 103 -< Server: GSE -< -< oauth_token=1%2FvMhevC5FJZeYIy87nMSvAaIoxJRDfq9MRuuYL_ASuIc&oauth_token_secret=ALKifRvO9cC4rQL43CygXqcE - diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-async-bad-credentials b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-async-bad-credentials deleted file mode 100644 index 492fc92b..00000000 --- a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-async-bad-credentials +++ /dev/null @@ -1,26 +0,0 @@ -> POST /accounts/OAuthGetAccessToken HTTP/1.1 -> Soup-Debug-Timestamp: 1375114467 -> Soup-Debug: SoupSession 1 (0x6502c0), SoupMessage 2 (0x7fffe40108c0), SoupSocket 2 (0x7fffe0026eb0) -> Host: www.google.com -> Content-Type: application/x-www-form-urlencoded -> Authorization: OAuth oauth_consumer_key="anonymous",oauth_token="4%2FcPV6prKvQtxeeXkhgI1iJ6nLQbCX",oauth_signature_method="HMAC-SHA1",oauth_signature="rtly12Qq%2FK30HSglMmLqwZVCpMM%3D",oauth_timestamp="1375114467",oauth_nonce="qBZpBSAZauOCA8vEqy5zOQBZcAS",oauth_version="1.0" -> Accept-Encoding: gzip, deflate -> Connection: Keep-Alive -> -> oauth%5Fverifier=test - -< HTTP/1.1 400 Bad Request -< Soup-Debug-Timestamp: 1375114475 -< Soup-Debug: SoupMessage 2 (0x7fffe40108c0) -< Content-Type: text/plain; charset=UTF-8 -< Date: Mon, 29 Jul 2013 16:14:35 GMT -< Expires: Mon, 29 Jul 2013 16:14:35 GMT -< Cache-Control: private, max-age=0 -< X-Content-Type-Options: nosniff -< X-XSS-Protection: 1; mode=block -< Content-Length: 23 -< Server: GSE -< -< The token is invalid. -< - diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-async-cancellation b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-async-cancellation deleted file mode 100644 index e69de29b..00000000 --- a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-async-cancellation +++ /dev/null diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-sync b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-sync deleted file mode 100644 index 7fdfe8c4..00000000 --- a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-sync +++ /dev/null @@ -1,25 +0,0 @@ -> POST /accounts/OAuthGetAccessToken HTTP/1.1 -> Soup-Debug-Timestamp: 1375114421 -> Soup-Debug: SoupSession 1 (0x6504e0), SoupMessage 2 (0x9753b0), SoupSocket 2 (0x993470) -> Host: www.google.com -> Content-Type: application/x-www-form-urlencoded -> Authorization: OAuth oauth_consumer_key="anonymous",oauth_token="4%2FT27iiKNpM8PHQ2ztKzZBywZ2uKnO",oauth_signature_method="HMAC-SHA1",oauth_signature="gZChlEpXlBLy8bYjktVEfRh4XhA%3D",oauth_timestamp="1375114421",oauth_nonce="W8iIqbvygOUYCkuQdp",oauth_version="1.0" -> Accept-Encoding: gzip, deflate -> Connection: Keep-Alive -> -> oauth%5Fverifier=7MQzdhPyajVrbVUBnaQRgj73 - -< HTTP/1.1 200 OK -< Soup-Debug-Timestamp: 1375114422 -< Soup-Debug: SoupMessage 2 (0x9753b0) -< Content-Type: text/plain; charset=UTF-8 -< Date: Mon, 29 Jul 2013 16:13:41 GMT -< Expires: Mon, 29 Jul 2013 16:13:41 GMT -< Cache-Control: private, max-age=0 -< X-Content-Type-Options: nosniff -< X-XSS-Protection: 1; mode=block -< Content-Length: 103 -< Server: GSE -< -< oauth_token=1%2FkJjrwN7c2Vzx387AQP2jL3BYQHXssRU0w3XeZq4H2Mw&oauth_token_secret=98SsHIgW-Sn8Ix0Klk3wv4oy - diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-sync-bad-credentials b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-sync-bad-credentials deleted file mode 100644 index 8809a967..00000000 --- a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-sync-bad-credentials +++ /dev/null @@ -1,26 +0,0 @@ -> POST /accounts/OAuthGetAccessToken HTTP/1.1 -> Soup-Debug-Timestamp: 1375114446 -> Soup-Debug: SoupSession 1 (0x6501b0), SoupMessage 2 (0x9751d0), SoupSocket 2 (0x993230) -> Host: www.google.com -> Content-Type: application/x-www-form-urlencoded -> Authorization: OAuth oauth_consumer_key="anonymous",oauth_token="4%2FlydzQSwq7wb73eJbj197qsgNP5Kr",oauth_signature_method="HMAC-SHA1",oauth_signature="hQRNpZi3kAzkGA1sa84EjobE%2BsU%3D",oauth_timestamp="1375114446",oauth_nonce="mqbX8TahJGtxkoP3oX_73qzA",oauth_version="1.0" -> Accept-Encoding: gzip, deflate -> Connection: Keep-Alive -> -> oauth%5Fverifier=test - -< HTTP/1.1 400 Bad Request -< Soup-Debug-Timestamp: 1375114453 -< Soup-Debug: SoupMessage 2 (0x9751d0) -< Content-Type: text/plain; charset=UTF-8 -< Date: Mon, 29 Jul 2013 16:14:13 GMT -< Expires: Mon, 29 Jul 2013 16:14:13 GMT -< Cache-Control: private, max-age=0 -< X-Content-Type-Options: nosniff -< X-XSS-Protection: 1; mode=block -< Content-Length: 23 -< Server: GSE -< -< The token is invalid. -< - diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-sync-cancellation b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-sync-cancellation deleted file mode 100644 index e69de29b..00000000 --- a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-sync-cancellation +++ /dev/null diff --git a/gdata/tests/traces/oauth1-authorizer/setup-oauth1-authorizer-data-authenticated b/gdata/tests/traces/oauth1-authorizer/setup-oauth1-authorizer-data-authenticated deleted file mode 100644 index 1710b251..00000000 --- a/gdata/tests/traces/oauth1-authorizer/setup-oauth1-authorizer-data-authenticated +++ /dev/null @@ -1,50 +0,0 @@ -> POST /accounts/OAuthGetRequestToken HTTP/1.1 -> Soup-Debug-Timestamp: 1375114396 -> Soup-Debug: SoupSession 1 (0x6501b0), SoupMessage 1 (0x975590), SoupSocket 1 (0x993230) -> Host: www.google.com -> Content-Type: application/x-www-form-urlencoded -> Authorization: OAuth oauth_consumer_key="anonymous",oauth_signature_method="HMAC-SHA1",oauth_signature="VfeOs%2BWTIJRUkCErU1zxKqH38oQ%3D",oauth_timestamp="1375114396",oauth_nonce="9VmUWSVrJu_zhF2cwFRdWrZFl8WUGy",oauth_version="1.0" -> Accept-Encoding: gzip, deflate -> Connection: Keep-Alive -> -> xoauth%5Fdisplayname=Application+name&scope=https%3A%2F%2Fwww%2Egoogle%2Ecom%2Fm8%2Ffeeds%2F&oauth%5Fcallback=oob - -< HTTP/1.1 200 OK -< Soup-Debug-Timestamp: 1375114396 -< Soup-Debug: SoupMessage 1 (0x975590) -< Content-Type: text/plain; charset=UTF-8 -< Date: Mon, 29 Jul 2013 16:13:16 GMT -< Expires: Mon, 29 Jul 2013 16:13:16 GMT -< Cache-Control: private, max-age=0 -< X-Content-Type-Options: nosniff -< X-XSS-Protection: 1; mode=block -< Content-Length: 118 -< Server: GSE -< -< oauth_token=4%2F-hFowsVMagtdWjX8hTFUGw0de9nL&oauth_token_secret=kuu2KlszmJhimCI8C7uNbV6z&oauth_callback_confirmed=true - -> POST /accounts/OAuthGetAccessToken HTTP/1.1 -> Soup-Debug-Timestamp: 1375114407 -> Soup-Debug: SoupSession 1 (0x6501b0), SoupMessage 2 (0x9752c0), SoupSocket 2 (0x9932f0) -> Host: www.google.com -> Content-Type: application/x-www-form-urlencoded -> Authorization: OAuth oauth_consumer_key="anonymous",oauth_token="4%2F-hFowsVMagtdWjX8hTFUGw0de9nL",oauth_signature_method="HMAC-SHA1",oauth_signature="lWSS%2BTKHABoDsZuVU6LFxVgBrsM%3D",oauth_timestamp="1375114407",oauth_nonce="P1LCHSMETyO0IpQnTCVc",oauth_version="1.0" -> Accept-Encoding: gzip, deflate -> Connection: Keep-Alive -> -> oauth%5Fverifier=qT64ktZBdmUVwpRClZmO6s7j - -< HTTP/1.1 200 OK -< Soup-Debug-Timestamp: 1375114408 -< Soup-Debug: SoupMessage 2 (0x9752c0) -< Content-Type: text/plain; charset=UTF-8 -< Date: Mon, 29 Jul 2013 16:13:28 GMT -< Expires: Mon, 29 Jul 2013 16:13:28 GMT -< Cache-Control: private, max-age=0 -< X-Content-Type-Options: nosniff -< X-XSS-Protection: 1; mode=block -< Content-Length: 103 -< Server: GSE -< -< oauth_token=1%2F17nuamcqEOCaMMCg9Oc9ekcfGEzkepP5_5ANtDkuwks&oauth_token_secret=wUozdZTGrBPaGKTEB9lfK61J - diff --git a/gdata/tests/traces/oauth1-authorizer/setup-oauth1-authorizer-interactive-data b/gdata/tests/traces/oauth1-authorizer/setup-oauth1-authorizer-interactive-data deleted file mode 100644 index 7731e22f..00000000 --- a/gdata/tests/traces/oauth1-authorizer/setup-oauth1-authorizer-interactive-data +++ /dev/null @@ -1,25 +0,0 @@ -> POST /accounts/OAuthGetRequestToken HTTP/1.1 -> Soup-Debug-Timestamp: 1375114454 -> Soup-Debug: SoupSession 1 (0x6501b0), SoupMessage 1 (0x9750e0), SoupSocket 1 (0x993230) -> Host: www.google.com -> Content-Type: application/x-www-form-urlencoded -> Authorization: OAuth oauth_consumer_key="anonymous",oauth_signature_method="HMAC-SHA1",oauth_signature="c%2FBP0C511rwGZYAGnXlXTzh5uno%3D",oauth_timestamp="1375114453",oauth_nonce="ppVVbibizHKVmJHDNHHjdc",oauth_version="1.0" -> Accept-Encoding: gzip, deflate -> Connection: Keep-Alive -> -> xoauth%5Fdisplayname=Application+name&scope=https%3A%2F%2Fwww%2Egoogle%2Ecom%2Fm8%2Ffeeds%2F&oauth%5Fcallback=oob - -< HTTP/1.1 200 OK -< Soup-Debug-Timestamp: 1375114454 -< Soup-Debug: SoupMessage 1 (0x9750e0) -< Content-Type: text/plain; charset=UTF-8 -< Date: Mon, 29 Jul 2013 16:14:14 GMT -< Expires: Mon, 29 Jul 2013 16:14:14 GMT -< Cache-Control: private, max-age=0 -< X-Content-Type-Options: nosniff -< X-XSS-Protection: 1; mode=block -< Content-Length: 118 -< Server: GSE -< -< oauth_token=4%2F-OewZRiOoq_qWvwTpTMIsvNEqMaU&oauth_token_secret=NF1c22V04ZV6SLLLnCG4w7Ue&oauth_callback_confirmed=true - diff --git a/meson.build b/meson.build index a5ec8ef3..5021f380 100644 --- a/meson.build +++ b/meson.build @@ -93,13 +93,6 @@ gdata_private_deps = [ dependency('gthread-2.0'), ] -oauth_dep = dependency('oauth', version: '>= 0.9.4', required: get_option('oauth1')) -enable_oauth1 = oauth_dep.found() -if enable_oauth1 - gdata_private_deps += oauth_dep -endif -config_h.set('ENABLE_OAUTH1', enable_oauth1) - libsoup_dep = dependency('libsoup-2.4', version: '>= 2.42.0') gdata_deps += libsoup_dep # libsoup 2.47.3 is needed for the new SoupServer API; but it contained a bug in diff --git a/meson_options.txt b/meson_options.txt index 19bfd95c..73565981 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -13,11 +13,6 @@ option('goa', value: 'enabled', description: 'enable Gnome Online Accounts (goa) support') -option('oauth1', - type: 'feature', - value: 'disabled', - description: 'enable OAuth 1.0 support (deprecated)') - option('always_build_tests', type: 'boolean', value: true, diff --git a/po/POTFILES.in b/po/POTFILES.in index 2e259b41..160a57ee 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -7,7 +7,6 @@ gdata/gdata-commentable.c gdata/gdata-download-stream.c gdata/gdata-entry.c gdata/gdata-feed.c -gdata/gdata-oauth1-authorizer.c gdata/gdata-oauth2-authorizer.c gdata/gdata-parsable.c gdata/gdata-parser.c |