mirror of
https://github.com/owntracks/recorder.git
synced 2026-08-27 16:57:21 +00:00
correctly handle all revgeocoding errors
This commit is contained in:
@@ -3,11 +3,10 @@
|
||||
#include <time.h>
|
||||
#include <curl/curl.h>
|
||||
#include "utstring.h"
|
||||
#include "config.h"
|
||||
#include "geo.h"
|
||||
#include "json.h"
|
||||
|
||||
#define GURL "http://maps.googleapis.com/maps/api/geocode/json?latlng=%lf,%lf&sensor=false&language=EN"
|
||||
|
||||
static CURL *curl;
|
||||
|
||||
static size_t writemem(void *contents, size_t size, size_t nmemb, void *userp)
|
||||
@@ -57,8 +56,8 @@ static int goog_decode(UT_string *geodata, UT_string *addr, UT_string *cc)
|
||||
// printf("%s\n", utstring_body(geodata));
|
||||
if ((j = json_find_member(json, "status")) != NULL) {
|
||||
// printf("}}}}}} %s\n", j->string_);
|
||||
if (strcmp(j->string_, "OVER_QUERY_LIMIT") == 0) {
|
||||
fprintf(stderr, "revgeo: %s\n", j->string_);
|
||||
if (strcmp(j->string_, "OK") != 0) {
|
||||
fprintf(stderr, "revgeo: %s (%s)\n", j->string_, utstring_body(geodata));
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user