Free location_struct, set user agent and don't log if no location has been acquired

This commit is contained in:
X3F200C 2024-06-27 20:10:47 -04:00
parent 794b9909a2
commit e5acc54597

View File

@ -44,6 +44,7 @@ int upload_location_data(struct location_data *location) {
CURL *upload_request;
upload_request = curl_easy_init();
curl_easy_setopt(upload_request, CURLOPT_URL, location_url);
curl_easy_setopt(upload_request, CURLOPT_USERAGENT, "phonetrack-linux");
CURLcode response = curl_easy_perform(upload_request);
@ -79,7 +80,13 @@ void get_location(GClueSimple *simple) {
location_struct->timestamp = timestamp_sec;
}
if (location_struct->latitude == 0.0F && location_struct->longitude == 0.0F) {
return;
}
upload_location_data(location_struct);
free(location_struct);
}
void on_geoclue_client_active(GClueClient *geoclue_client, GParamSpec *parameter_spec, gpointer user_data) {