diff options
author | Debarshi Ray <debarshir@gnome.org> | 2022-06-16 17:57:57 +0200 |
---|---|---|
committer | Debarshi Ray <debarshir@gnome.org> | 2022-06-16 17:57:57 +0200 |
commit | 3ab0d4668376d3f218eda9055b5566f919bb582a (patch) | |
tree | 7f499646c58ccba7d2a3ea9c91f7fb4df390d2b3 | |
parent | f939caf956f901f7000b3fbf54fe5b408327a179 (diff) | |
download | gnome-online-accounts-3ab0d4668376d3f218eda9055b5566f919bb582a.tar.gz |
Remove Foursquare
Foursquare was added for GNOME Maps. However, GNOME Maps recently
removed it's Foursquare support [1], so there's no use for it anymore.
[1] https://gitlab.gnome.org/GNOME/gnome-maps/-/issues/440
https://gitlab.gnome.org/GNOME/gnome-maps/-/merge_requests/219
https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/issues/184
-rw-r--r-- | README | 6 | ||||
-rw-r--r-- | configure.ac | 19 | ||||
-rw-r--r-- | data/icons/meson.build | 2 | ||||
-rw-r--r-- | data/icons/scalable/Makefile.am | 1 | ||||
-rw-r--r-- | data/icons/scalable/goa-account-foursquare.svg | 108 | ||||
-rw-r--r-- | data/icons/symbolic/Makefile.am | 1 | ||||
-rw-r--r-- | data/icons/symbolic/goa-account-foursquare-symbolic.svg | 31 | ||||
-rw-r--r-- | gnome-online-accounts.doap | 4 | ||||
-rw-r--r-- | meson.build | 14 | ||||
-rw-r--r-- | meson_options.txt | 3 | ||||
-rw-r--r-- | po/POTFILES.in | 1 | ||||
-rw-r--r-- | src/goabackend/Makefile.am | 1 | ||||
-rw-r--r-- | src/goabackend/goabackendenums.h | 2 | ||||
-rw-r--r-- | src/goabackend/goafoursquareprovider.c | 371 | ||||
-rw-r--r-- | src/goabackend/goafoursquareprovider.h | 37 | ||||
-rw-r--r-- | src/goabackend/goaprovider.c | 4 | ||||
-rw-r--r-- | src/goabackend/meson.build | 1 |
17 files changed, 3 insertions, 603 deletions
@@ -27,12 +27,6 @@ Flickr OAuth 1.0: http://www.flickr.com/services/api/auth.oauth.html -Foursquare ----------- - -OAuth 2.0: https://developer.foursquare.com/overview/auth - - Google ------ diff --git a/configure.ac b/configure.ac index 9dc412a..51a2d67 100644 --- a/configure.ac +++ b/configure.ac @@ -233,24 +233,6 @@ if test "$enable_flickr" != "no"; then AC_DEFINE(GOA_FLICKR_ENABLED, 1, [Enable Flickr data provider]) fi -# Foursquare -AC_DEFINE(GOA_FOURSQUARE_NAME, ["foursquare"], [ProviderType and extension point name]) -AC_ARG_ENABLE([foursquare], - [AS_HELP_STRING([--enable-foursquare], [Enable Foursquare provider])], - [], - [enable_foursquare=yes]) -AC_ARG_WITH(foursquare-client-id, - [AS_HELP_STRING([--with-foursquare-client-id], [Foursquare OAuth 2.0 client id])], - [], - []) -if test "$with_foursquare_client_id" = ""; then - with_foursquare_client_id="MBNU2NES5HASNDQJ25YPFGG2UGRZHPI3IYTNJGE0KIWT2HCF" -fi -AC_DEFINE_UNQUOTED(GOA_FOURSQUARE_CLIENT_ID, ["$with_foursquare_client_id"], [Foursquare OAuth 2.0 client id]) -if test "$enable_foursquare" != "no"; then - AC_DEFINE(GOA_FOURSQUARE_ENABLED, 1, [Enable Foursquare data provider]) -fi - # Google AC_DEFINE(GOA_GOOGLE_NAME, ["google"], [ProviderType and extension point name]) AC_ARG_ENABLE([google], @@ -567,7 +549,6 @@ echo " Fedora Account System provider: ${enable_fedora} Flickr provider: ${enable_flickr} (OAuth 1.0, key:${with_flickr_consumer_key} secret:${with_flickr_consumer_secret}) - Foursquare provider: ${enable_foursquare} (id:${with_foursquare_client_id}) Google provider: ${enable_google} (OAuth 2.0, id:${with_google_client_id} secret:${with_google_client_secret}) IMAP/SMTP provider: ${enable_imap_smtp} Media Server provider: ${enable_media_server} diff --git a/data/icons/meson.build b/data/icons/meson.build index 281c538..ce76e85 100644 --- a/data/icons/meson.build +++ b/data/icons/meson.build @@ -4,7 +4,6 @@ icon_scalable_data = [ 'goa-account-facebook.svg', 'goa-account-fedora.svg', 'goa-account-flickr.svg', - 'goa-account-foursquare.svg', 'goa-account-google.svg', 'goa-account-lastfm.svg', 'goa-account-msn.svg', @@ -16,7 +15,6 @@ icon_symbolic_data = [ 'goa-account-exchange-symbolic.svg', 'goa-account-facebook-symbolic.svg', 'goa-account-flickr-symbolic.svg', - 'goa-account-foursquare-symbolic.svg', 'goa-account-google-symbolic.svg', 'goa-account-lastfm-symbolic.svg', 'goa-account-msn-symbolic.svg', diff --git a/data/icons/scalable/Makefile.am b/data/icons/scalable/Makefile.am index 5721dd5..bfca08e 100644 --- a/data/icons/scalable/Makefile.am +++ b/data/icons/scalable/Makefile.am @@ -11,7 +11,6 @@ icon_DATA = \ goa-account-lastfm.svg \ goa-account-msn.svg \ goa-account-owncloud.svg \ - goa-account-foursquare.svg \ $(NULL) EXTRA_DIST = \ diff --git a/data/icons/scalable/goa-account-foursquare.svg b/data/icons/scalable/goa-account-foursquare.svg deleted file mode 100644 index 7bdd67e..0000000 --- a/data/icons/scalable/goa-account-foursquare.svg +++ /dev/null @@ -1,108 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - viewBox="0 0 128 128" - style="display:inline;enable-background:new" - version="1.0" - id="svg11300" - height="128" - width="128"> - <title - id="title4162">Adwaita Icon Template</title> - <defs - id="defs3" /> - <metadata - id="metadata4"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:creator> - <cc:Agent> - <dc:title>GNOME Design Team</dc:title> - </cc:Agent> - </dc:creator> - <dc:source /> - <cc:license - rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" /> - <dc:title>Adwaita Icon Template</dc:title> - <dc:subject> - <rdf:Bag /> - </dc:subject> - <dc:date /> - <dc:rights> - <cc:Agent> - <dc:title /> - </cc:Agent> - </dc:rights> - <dc:publisher> - <cc:Agent> - <dc:title /> - </cc:Agent> - </dc:publisher> - <dc:identifier /> - <dc:relation /> - <dc:language /> - <dc:coverage /> - <dc:description /> - <dc:contributor> - <cc:Agent> - <dc:title /> - </cc:Agent> - </dc:contributor> - </cc:Work> - <cc:License - rdf:about="http://creativecommons.org/licenses/by-sa/4.0/"> - <cc:permits - rdf:resource="http://creativecommons.org/ns#Reproduction" /> - <cc:permits - rdf:resource="http://creativecommons.org/ns#Distribution" /> - <cc:requires - rdf:resource="http://creativecommons.org/ns#Notice" /> - <cc:requires - rdf:resource="http://creativecommons.org/ns#Attribution" /> - <cc:permits - rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> - <cc:requires - rdf:resource="http://creativecommons.org/ns#ShareAlike" /> - </cc:License> - </rdf:RDF> - </metadata> - <g - transform="translate(0,-172)" - style="display:inline" - id="layer1"> - <g - style="display:inline" - id="layer9"> - <g - transform="translate(-8.5,-20.000002)" - id="g211"> - <g - transform="translate(376.5,19.999882)" - id="g2147" - style="display:inline;enable-background:new"> - <rect - style="display:inline;opacity:1;vector-effect:none;fill:#ef2975;fill-opacity:1;stroke:none;stroke-width:0.24999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal;enable-background:new" - id="rect2145" - width="104" - height="104.00024" - x="-356" - y="184" - rx="7.9999986" - ry="8" /> - </g> - <path - style="display:inline;fill:#ffffff;stroke-width:1;enable-background:new" - d="m 92.100159,230.55017 -1.75001,8.45003 c -0.2,0.90001 -1.05001,1.70001 -2.10001,1.70001 h -15.20006 c -1.70001,0 -3.10002,1.40001 -3.10002,3.10002 v 1.85 c 0,1.70001 1.40001,3.10002 3.10002,3.10002 h 12.85005 c 1.20001,0 2.20001,1.15 1.95001,2.40001 -0.25,1.3 -1.60001,7.90003 -1.75001,8.60003 -0.1,0.75001 -0.9,1.70001 -2.10001,1.70001 h -10.50004 c -2.20001,0.05 -2.65001,0.1 -3.95002,1.70001 -1.3,1.6 -12.80005,16.00006 -12.80005,16.00006 -0.1,0.15001 -0.2,0.1 -0.2,-0.05 v -48.9502 c 0,-1.15001 0.95,-2.10001 2.10001,-2.10001 h 31.55013 c 1.1,0 2.20001,1.1 1.90001,2.50001 m 2.30001,-10.55005 c 0,0 -33.55015,0 -38.95017,0 -5.35002,0 -6.95003,4.05002 -6.95003,6.60003 v 61.90026 c 0,3.05002 1.55001,3.95002 2.40001,4.30002 0.85001,0.35 3.10002,0.6 4.70002,-1 0,0 18.50008,-21.55009 18.80008,-21.90009 0.3,-0.35001 0.45,-0.35001 0.65,-0.35001 0.20001,0 7.85004,0 11.70005,0 5.00003,0 5.95003,-3.45001 6.50003,-5.55002 0.45,-1.75001 5.600031,-26.75011 7.200031,-34.65015 1.20001,-6.10002 -0.35,-9.35004 -6.050021,-9.35004" - id="path22" /> - </g> - </g> - </g> -</svg> diff --git a/data/icons/symbolic/Makefile.am b/data/icons/symbolic/Makefile.am index 1ba8100..abc00f6 100644 --- a/data/icons/symbolic/Makefile.am +++ b/data/icons/symbolic/Makefile.am @@ -10,7 +10,6 @@ icon_DATA = \ goa-account-lastfm-symbolic.svg \ goa-account-msn-symbolic.svg \ goa-account-owncloud-symbolic.svg \ - goa-account-foursquare-symbolic.svg \ $(NULL) EXTRA_DIST = \ diff --git a/data/icons/symbolic/goa-account-foursquare-symbolic.svg b/data/icons/symbolic/goa-account-foursquare-symbolic.svg deleted file mode 100644 index 43293f7..0000000 --- a/data/icons/symbolic/goa-account-foursquare-symbolic.svg +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - width="15.999999" - height="16" - viewBox="0 0 15.999999 16" - version="1.1" - id="svg4043"> - <defs - id="defs4037" /> - <metadata - id="metadata4040"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> - <path - style="display:inline;fill:#241f31;fill-opacity:1;stroke-width:1;enable-background:new" - d="M 11.75796,3.87645 11.44658,5.38 c -0.0356,0.16014 -0.18683,0.30249 -0.37367,0.30249 H 8.3682901 c -0.30249,0 -0.55161,0.24911 -0.55161,0.5516 v 0.32918 c 0,0.3025 0.24912,0.5516 0.55161,0.5516 H 10.65476 c 0.21353,0 0.39146,0.20463 0.34697,0.42705 -0.0444,0.2313103 -0.28469,1.4057003 -0.31138,1.5302503 -0.0178,0.13344 -0.16014,0.3025 -0.37367,0.3025 H 8.4483601 c -0.39146,0.008 -0.47152,0.0178 -0.70284,0.30248 -0.23132,0.2847003 -2.27758,2.8469807 -2.27758,2.8469807 -0.0178,0.0266 -0.0356,0.0178 -0.0356,-0.008 V 3.80617 c 0,-0.20463 0.16904,-0.37366 0.37367,-0.37366 H 11.41989 c 0.19572,0 0.39145,0.19573 0.33806,0.44484 m 0.40926,-1.87723 c 0,0 -5.9697399,0 -6.9305899,0 -0.95196,0 -1.23665,0.72064 -1.23665,1.17438 v 11.014221 c 0,0.54271 0.27579,0.70285 0.42704,0.76513 0.15124,0.0622 0.5516,0.10681 0.83629,-0.17794 0,0 3.29182,-3.83451 3.34519,-3.89679 0.0534,-0.0622 0.08,-0.0622 0.11564,-0.0622 0.0356,0 1.3967899,0 2.0818399,0 0.88968,0 1.05872,-0.61389 1.15658,-0.9875504 0.08,-0.3113903 0.99645,-4.7597806 1.28114,-6.1654806 0.21353,-1.0854 -0.0622,-1.6637 -1.07651,-1.6637" - id="path2832" /> -</svg> diff --git a/gnome-online-accounts.doap b/gnome-online-accounts.doap index b8d4e7c..38321df 100644 --- a/gnome-online-accounts.doap +++ b/gnome-online-accounts.doap @@ -12,8 +12,8 @@ <description xml:lang="en"> GNOME Online Accounts provides interfaces so that applications and libraries in GNOME can access the user's online accounts. It has providers for Google, -Nextcloud, Facebook, Fedora, Microsoft, Flickr, Foursquare, Microsoft -Exchange, Last.fm, IMAP/SMTP and Kerberos. +Nextcloud, Facebook, Fedora, Microsoft, Flickr, Microsoft Exchange, Last.fm, +IMAP/SMTP and Kerberos. </description> <homepage rdf:resource="https://wiki.gnome.org/Projects/GnomeOnlineAccounts" /> diff --git a/meson.build b/meson.build index cd3fffe..788ff2f 100644 --- a/meson.build +++ b/meson.build @@ -154,15 +154,6 @@ config_h.set_quoted('GOA_FLICKR_CONSUMER_SECRET', flickr_consumer_secret) enable_flickr = get_option('flickr') config_h.set('GOA_FLICKR_ENABLED', enable_flickr) -# Foursquare -config_h.set_quoted('GOA_FOURSQUARE_NAME', 'foursquare') - -foursquare_client_id = get_option('foursquare_client_id') -config_h.set_quoted('GOA_FOURSQUARE_CLIENT_ID', foursquare_client_id) - -enable_foursquare = get_option('foursquare') -config_h.set('GOA_FOURSQUARE_ENABLED', enable_foursquare) - # Google config_h.set_quoted('GOA_GOOGLE_NAME', 'google') @@ -319,11 +310,6 @@ if enable_flickr output += ' (OAuth 1.0, key:@0@)'.format(flickr_consumer_key) endif output += '\n' -output += ' Foursquare provider: ' + enable_foursquare.to_string() -if enable_foursquare - output += ' (id:@0@)'.format(foursquare_client_id) -endif -output += '\n' output += ' Google provider: ' + enable_google.to_string() if enable_google output += ' (OAuth 2.0, id:@0@ secret:@1@)'.format(google_client_id, google_client_secret) diff --git a/meson_options.txt b/meson_options.txt index 08c65ec..c276594 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -12,9 +12,6 @@ option('flickr', type: 'boolean', value: true, description: 'Enable Flickr provi option('flickr_consumer_key', type: 'string', value: 'ed00ad7e0869897506e23c0d18e34d01', description: 'Flickr OAuth 1.0 consumer key') option('flickr_consumer_secret', type: 'string', value: 'ebd556dd187188b1', description: 'Flickr OAuth 1.0 consumer secret') -option('foursquare', type: 'boolean', value: true, description: 'Enable Foursquare provider') -option('foursquare_client_id', type: 'string', value: 'MBNU2NES5HASNDQJ25YPFGG2UGRZHPI3IYTNJGE0KIWT2HCF', description: 'Foursquare OAuth 2.0 client id') - option('google', type: 'boolean', value: true, description: 'Enable Google provider') option('google_client_id', type: 'string', value: '44438659992-7kgjeitenc16ssihbtdjbgguch7ju55s.apps.googleusercontent.com', description: 'Google OAuth 2.0 client id') option('google_client_secret', type: 'string', value: '-gMLuQyDiI0XrQS_vx_mhuYF', description: 'Google OAuth 2.0 client secret') diff --git a/po/POTFILES.in b/po/POTFILES.in index 279fb64..aee26ab 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -7,7 +7,6 @@ src/goabackend/goaexchangeprovider.c src/goabackend/goafacebookprovider.c src/goabackend/goafedoraprovider.c src/goabackend/goaflickrprovider.c -src/goabackend/goafoursquareprovider.c src/goabackend/goagoogleprovider.c src/goabackend/goaimapauthlogin.c src/goabackend/goaimapsmtpprovider.c diff --git a/src/goabackend/Makefile.am b/src/goabackend/Makefile.am index 8385237..105ea2c 100644 --- a/src/goabackend/Makefile.am +++ b/src/goabackend/Makefile.am @@ -90,7 +90,6 @@ libgoa_backend_1_0_la_SOURCES = \ goamediaserverprovider.h goamediaserverprovider.c \ goaowncloudprovider.h goaowncloudprovider.c \ goaflickrprovider.h goaflickrprovider.c \ - goafoursquareprovider.h goafoursquareprovider.c \ goawindowsliveprovider.h goawindowsliveprovider.c \ goalastfmprovider.h goalastfmprovider.c \ goaobjectskeletonutils.h goaobjectskeletonutils.c \ diff --git a/src/goabackend/goabackendenums.h b/src/goabackend/goabackendenums.h index cba20e2..6957475 100644 --- a/src/goabackend/goabackendenums.h +++ b/src/goabackend/goabackendenums.h @@ -69,7 +69,7 @@ typedef enum * @GOA_PROVIDER_FEATURE_TICKETING: Ticketing services (ie. Kerberos). * @GOA_PROVIDER_FEATURE_READ_LATER: Deprecated; currently unused. * @GOA_PROVIDER_FEATURE_PRINTERS: Network printing services (e.g. Google Cloud Print). - * @GOA_PROVIDER_FEATURE_MAPS: Maps related services (e.g. Foursquare, Facebook). + * @GOA_PROVIDER_FEATURE_MAPS: Maps related services (e.g. Facebook). * @GOA_PROVIDER_FEATURE_MUSIC: Music related services (e.g. Vkontakte). * @GOA_PROVIDER_FEATURE_TODO: Deprecated; currently unused. * @GOA_PROVIDER_FEATURE_INVALID: Used for error handling. No provider diff --git a/src/goabackend/goafoursquareprovider.c b/src/goabackend/goafoursquareprovider.c deleted file mode 100644 index c1e4146..0000000 --- a/src/goabackend/goafoursquareprovider.c +++ /dev/null @@ -1,371 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -/* - * Copyright © 2014 Damián Nohales - * Copyright © 2015 – 2017 Red Hat, Inc. - * - * This library 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 of the License, or (at your option) any later version. - * - * This library 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 this library; if not, see <http://www.gnu.org/licenses/>. - */ - -#include "config.h" -#include <glib/gi18n-lib.h> - -#include <rest/rest-proxy.h> -#include <json-glib/json-glib.h> - -#include "goaprovider.h" -#include "goaprovider-priv.h" -#include "goaoauth2provider.h" -#include "goafoursquareprovider.h" -#include "goaobjectskeletonutils.h" -#include "goarestproxy.h" - -struct _GoaFoursquareProvider -{ - GoaOAuth2Provider parent_instance; -}; - -G_DEFINE_TYPE_WITH_CODE (GoaFoursquareProvider, goa_foursquare_provider, GOA_TYPE_OAUTH2_PROVIDER, - goa_provider_ensure_extension_points_registered (); - g_io_extension_point_implement (GOA_PROVIDER_EXTENSION_POINT_NAME, - g_define_type_id, - GOA_FOURSQUARE_NAME, - 0)); - -/* ---------------------------------------------------------------------------------------------------- */ - -static const gchar * -get_provider_type (GoaProvider *provider) -{ - return GOA_FOURSQUARE_NAME; -} - -static gchar * -get_provider_name (GoaProvider *provider, - GoaObject *object) -{ - return g_strdup (_("Foursquare")); -} - -static GoaProviderGroup -get_provider_group (GoaProvider *provider) -{ - return GOA_PROVIDER_GROUP_BRANDED; -} - -static GoaProviderFeatures -get_provider_features (GoaProvider *provider) -{ - return GOA_PROVIDER_FEATURE_BRANDED | - GOA_PROVIDER_FEATURE_MAPS; -} - -static gchar * -build_authorization_uri (GoaOAuth2Provider *oauth2_provider, - const gchar *authorization_uri, - const gchar *escaped_redirect_uri, - const gchar *escaped_client_id, - const gchar *escaped_scope) -{ - gchar *uri; - - uri = g_strdup_printf ("%s" - "?response_type=token" - "&redirect_uri=%s" - "&client_id=%s", - authorization_uri, - escaped_redirect_uri, - escaped_client_id); - return uri; -} - -static const gchar * -get_authorization_uri (GoaOAuth2Provider *oauth2_provider) -{ - return "https://foursquare.com/oauth2/authenticate"; -} - -static const gchar * -get_redirect_uri (GoaOAuth2Provider *oauth2_provider) -{ - return "https://localhost/"; -} - -static const gchar * -get_client_id (GoaOAuth2Provider *oauth2_provider) -{ - return GOA_FOURSQUARE_CLIENT_ID; -} - -static const gchar * -get_client_secret (GoaOAuth2Provider *oauth2_provider) -{ - /* The client secret is not used in the Foursquare Token Flow - * that is the recommended flow for serverless apps. - */ - return NULL; -} - -/* ---------------------------------------------------------------------------------------------------- */ - -static gchar * -get_identity_sync (GoaOAuth2Provider *oauth2_provider, - const gchar *access_token, - gchar **out_presentation_identity, - GCancellable *cancellable, - GError **error) -{ - GError *identity_error = NULL; - RestProxy *proxy = NULL; - RestProxyCall *call = NULL; - JsonParser *parser = NULL; - JsonObject *json_object; - gchar *ret = NULL; - gchar *id = NULL; - gchar *presentation_identity = NULL; - - /* TODO: cancellable */ - - proxy = goa_rest_proxy_new ("https://api.foursquare.com/v2/users/self", FALSE); - call = rest_proxy_new_call (proxy); - rest_proxy_call_set_method (call, "GET"); - rest_proxy_call_add_param (call, "oauth_token", access_token); - - /* See https://developer.foursquare.com/overview/versioning */ - rest_proxy_call_add_param (call, "v", "20140226"); - - if (!rest_proxy_call_sync (call, error)) - goto out; - if (rest_proxy_call_get_status_code (call) != 200) - { - g_set_error (error, - GOA_ERROR, - GOA_ERROR_FAILED, - _("Expected status 200 when requesting your identity, instead got status %d (%s)"), - rest_proxy_call_get_status_code (call), - rest_proxy_call_get_status_message (call)); - goto out; - } - - parser = json_parser_new (); - if (!json_parser_load_from_data (parser, - rest_proxy_call_get_payload (call), - rest_proxy_call_get_payload_length (call), - &identity_error)) - { - g_warning ("json_parser_load_from_data() failed: %s (%s, %d)", - identity_error->message, - g_quark_to_string (identity_error->domain), - identity_error->code); - g_set_error (error, - GOA_ERROR, - GOA_ERROR_FAILED, - _("Could not parse response")); - goto out; - } - - json_object = json_node_get_object (json_parser_get_root (parser)); - if (!json_object_has_member (json_object, "response")) - { - g_warning ("Did not find response in JSON data"); - g_set_error (error, - GOA_ERROR, - GOA_ERROR_FAILED, - _("Could not parse response")); - goto out; - } - - json_object = json_object_get_object_member (json_object, "response"); - if (!json_object_has_member (json_object, "user")) - { - g_warning ("Did not find response.user in JSON data"); - g_set_error (error, - GOA_ERROR, - GOA_ERROR_FAILED, - _("Could not parse response")); - goto out; - } - - json_object = json_object_get_object_member (json_object, "user"); - if (!json_object_has_member (json_object, "id")) - { - g_warning ("Did not find response.user.id in JSON data"); - g_set_error (error, - GOA_ERROR, - GOA_ERROR_FAILED, - _("Could not parse response")); - goto out; - } - if (!json_object_has_member (json_object, "contact")) - { - g_warning ("Did not find response.user.contact in JSON data"); - g_set_error (error, - GOA_ERROR, - GOA_ERROR_FAILED, - _("Could not parse response")); - goto out; - } - - id = g_strdup (json_object_get_string_member (json_object, "id")); - - json_object = json_object_get_object_member (json_object, "contact"); - if (!json_object_has_member (json_object, "email")) - { - g_warning ("Did not find response.user.contact.email in JSON data"); - g_set_error (error, - GOA_ERROR, - GOA_ERROR_FAILED, - _("Could not parse response")); - goto out; - } - - presentation_identity = g_strdup (json_object_get_string_member (json_object, "email")); - - ret = id; - id = NULL; - if (out_presentation_identity != NULL) - { - *out_presentation_identity = presentation_identity; - presentation_identity = NULL; - } - - out: - g_clear_error (&identity_error); - g_clear_object (&call); - g_clear_object (&parser); - g_clear_object (&proxy); - g_free (id); - g_free (presentation_identity); - return ret; -} - -/* ---------------------------------------------------------------------------------------------------- */ - -static gboolean -is_identity_node (GoaOAuth2Provider *oauth2_provider, WebKitDOMHTMLInputElement *element) -{ - gboolean ret = FALSE; - gchar *element_type = NULL; - gchar *name = NULL; - - g_object_get (element, "type", &element_type, NULL); - if (g_strcmp0 (element_type, "email") != 0) - goto out; - - name = webkit_dom_html_input_element_get_name (element); - if (g_strcmp0 (name, "emailOrPhone") != 0) - goto out; - - ret = TRUE; - - out: - g_free (element_type); - g_free (name); - return ret; -} - -/* ---------------------------------------------------------------------------------------------------- */ - -static gboolean -build_object (GoaProvider *provider, - GoaObjectSkeleton *object, - GKeyFile *key_file, - const gchar *group, - GDBusConnection *connection, - gboolean just_added, - GError **error) -{ - GoaAccount *account = NULL; - gboolean maps_enabled; - gboolean ret = FALSE; - - /* Chain up */ - if (!GOA_PROVIDER_CLASS (goa_foursquare_provider_parent_class)->build_object (provider, - object, - key_file, - group, - connection, - just_added, - error)) - goto out; - - account = goa_object_get_account (GOA_OBJECT (object)); - - /* Maps */ - maps_enabled = g_key_file_get_boolean (key_file, group, "MapsEnabled", NULL); - goa_object_skeleton_attach_maps (object, maps_enabled); - - if (just_added) - { - goa_account_set_maps_disabled (account, !maps_enabled); - g_signal_connect (account, - "notify::maps-disabled", - G_CALLBACK (goa_util_account_notify_property_cb), - (gpointer) "MapsEnabled"); - } - - ret = TRUE; - - out: - g_clear_object (&account); - return ret; -} - -/* ---------------------------------------------------------------------------------------------------- */ - -static gboolean -get_use_mobile_browser (GoaOAuth2Provider *oauth2_provider) -{ - return TRUE; -} - -/* ---------------------------------------------------------------------------------------------------- */ - -static void -add_account_key_values (GoaOAuth2Provider *oauth2_provider, - GVariantBuilder *builder) -{ - g_variant_builder_add (builder, "{ss}", "MapsEnabled", "true"); -} - -/* ---------------------------------------------------------------------------------------------------- */ - -static void -goa_foursquare_provider_init (GoaFoursquareProvider *self) -{ -} - -static void -goa_foursquare_provider_class_init (GoaFoursquareProviderClass *klass) -{ - GoaProviderClass *provider_class; - GoaOAuth2ProviderClass *oauth2_class; - - provider_class = GOA_PROVIDER_CLASS (klass); - provider_class->get_provider_type = get_provider_type; - provider_class->get_provider_name = get_provider_name; - provider_class->get_provider_group = get_provider_group; - provider_class->get_provider_features = get_provider_features; - provider_class->build_object = build_object; - - oauth2_class = GOA_OAUTH2_PROVIDER_CLASS (klass); - oauth2_class->get_authorization_uri = get_authorization_uri; - oauth2_class->build_authorization_uri = build_authorization_uri; - oauth2_class->get_redirect_uri = get_redirect_uri; - oauth2_class->get_client_id = get_client_id; - oauth2_class->get_client_secret = get_client_secret; - oauth2_class->get_use_mobile_browser = get_use_mobile_browser; - oauth2_class->get_identity_sync = get_identity_sync; - oauth2_class->is_identity_node = is_identity_node; - oauth2_class->add_account_key_values = add_account_key_values; -} diff --git a/src/goabackend/goafoursquareprovider.h b/src/goabackend/goafoursquareprovider.h deleted file mode 100644 index a6f70c4..0000000 --- a/src/goabackend/goafoursquareprovider.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -/* - * Copyright © 2014 Damián Nohales - * - * This library 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 of the License, or (at your option) any later version. - * - * This library 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 this library; if not, see <http://www.gnu.org/licenses/>. - */ - -#if !defined (__GOA_BACKEND_INSIDE_GOA_BACKEND_H__) && !defined (GOA_BACKEND_COMPILATION) -#error "Only <goabackend/goabackend.h> can be included directly." -#endif - -#ifndef __GOA_FOURSQUARE_PROVIDER_H__ -#define __GOA_FOURSQUARE_PROVIDER_H__ - -#include <glib-object.h> - -#include "goaoauth2provider-priv.h" - -G_BEGIN_DECLS - -#define GOA_TYPE_FOURSQUARE_PROVIDER (goa_foursquare_provider_get_type ()) -G_DECLARE_FINAL_TYPE (GoaFoursquareProvider, goa_foursquare_provider, GOA, FOURSQUARE_PROVIDER, GoaOAuth2Provider); - -G_END_DECLS - -#endif /* __GOA_FOURSQUARE_PROVIDER_H__ */ diff --git a/src/goabackend/goaprovider.c b/src/goabackend/goaprovider.c index 9e5bd45..8055957 100644 --- a/src/goabackend/goaprovider.c +++ b/src/goabackend/goaprovider.c @@ -28,7 +28,6 @@ #include "goaimapsmtpprovider.h" #include "goaowncloudprovider.h" #include "goaflickrprovider.h" -#include "goafoursquareprovider.h" #include "goawindowsliveprovider.h" #include "goamediaserverprovider.h" #include "goalastfmprovider.h" @@ -950,9 +949,6 @@ static struct #ifdef GOA_FLICKR_ENABLED { GOA_FLICKR_NAME, goa_flickr_provider_get_type }, #endif -#ifdef GOA_FOURSQUARE_ENABLED - { GOA_FOURSQUARE_NAME, goa_foursquare_provider_get_type }, -#endif #ifdef GOA_EXCHANGE_ENABLED { GOA_EXCHANGE_NAME, goa_exchange_provider_get_type }, #endif diff --git a/src/goabackend/meson.build b/src/goabackend/meson.build index 3d9dee8..8244fad 100644 --- a/src/goabackend/meson.build +++ b/src/goabackend/meson.build @@ -10,7 +10,6 @@ libgoa_backend_sources = files( 'goaexchangeprovider.c', 'goafacebookprovider.c', 'goaflickrprovider.c', - 'goafoursquareprovider.c', 'goagoogleprovider.c', 'goahttpclient.c', 'goaimapauthlogin.c', |