Commit aa4ef88e authored by Zeeshan Ali's avatar Zeeshan Ali

config: Separate bool option to enable submission

Instead of relying on submission URL being provided or not, provide an
explicit boolean option in config to enable submission.
parent beedd4bf
......@@ -20,10 +20,14 @@ url=https://location.services.mozilla.com/v1/geolocate?key=geoclue
#
#url=https://www.googleapis.com/geolocation/v1/geolocate?key=YOUR_KEY
# URL to submission API of Mozilla Location Service
# If uncommented, geoclue will automatically submit network data to Mozilla
# Submit data to Mozilla Location Service
# If set to true, geoclue will automatically submit network data to Mozilla
# each time it gets a GPS lock.
#submission-url=https://location.services.mozilla.com/v1/submit?key=geoclue
#
submit-data=false
# URL to submission API of Mozilla Location Service
submission-url=https://location.services.mozilla.com/v1/submit?key=geoclue
# A nickname to submit network data with. This is currently used for leaderboard:
# https://location.services.mozilla.com/leaders
......
......@@ -199,6 +199,8 @@ gclue_config_get_wifi_url (GClueConfig *config)
return url;
}
#define DEFAULT_WIFI_SUBMIT_URL "https://location.services.mozilla.com/v1/submit?key=geoclue"
char *
gclue_config_get_wifi_submit_url (GClueConfig *config)
{
......@@ -212,6 +214,7 @@ gclue_config_get_wifi_submit_url (GClueConfig *config)
if (error != NULL) {
g_debug ("No wifi submission URL: %s", error->message);
g_error_free (error);
url = g_strdup (DEFAULT_WIFI_SUBMIT_URL);
}
return url;
......@@ -234,3 +237,22 @@ gclue_config_get_wifi_submit_nick (GClueConfig *config)
return nick;
}
gboolean
gclue_config_get_wifi_submit_data (GClueConfig *config)
{
gboolean submit = FALSE;
GError *error = NULL;
submit = g_key_file_get_boolean (config->priv->key_file,
"wifi",
"submit-data",
&error);
if (error != NULL) {
g_debug ("Failed to get config wifi/submit-data: %s",
error->message);
g_error_free (error);
}
return submit;
}
......@@ -67,6 +67,7 @@ gboolean gclue_config_is_app_allowed (GClueConfig *config,
char * gclue_config_get_wifi_url (GClueConfig *config);
char * gclue_config_get_wifi_submit_url (GClueConfig *config);
char * gclue_config_get_wifi_submit_nick (GClueConfig *config);
gboolean gclue_config_get_wifi_submit_data (GClueConfig *config);
G_END_DECLS
......
......@@ -686,6 +686,9 @@ get_submit_config (char **nick)
GClueConfig *config;
config = gclue_config_get_singleton ();
if (!gclue_config_get_wifi_submit_data (config))
return NULL;
*nick = gclue_config_get_wifi_submit_nick (config);
return gclue_config_get_wifi_submit_url (config);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment