From: Michael Tremer Date: Sun, 13 Oct 2019 17:24:17 +0000 (+0000) Subject: Handle A1, A2, A3 as special cases when searching for countries X-Git-Tag: 0.9.0~43 X-Git-Url: http://git.ipfire.org/?p=location%2Flibloc.git;a=commitdiff_plain;h=4ef1761fe7a01859a8c4dbdda084d768f5cb8ed8 Handle A1, A2, A3 as special cases when searching for countries Signed-off-by: Michael Tremer --- diff --git a/src/database.c b/src/database.c index ea2ae86..f293ac1 100644 --- a/src/database.c +++ b/src/database.c @@ -649,6 +649,19 @@ LOC_EXPORT int loc_database_enumerator_set_country_code(struct loc_database_enum if (strlen(country_code) != 2) return -EINVAL; + // Treat A1, A2, A3 as special country codes, + // but perform search for flags instead + if (strcmp(country_code, "A1") == 0) { + return loc_database_enumerator_set_flag(enumerator, + LOC_NETWORK_FLAG_ANONYMOUS_PROXY); + } else if (strcmp(country_code, "A2") == 0) { + return loc_database_enumerator_set_flag(enumerator, + LOC_NETWORK_FLAG_SATELLITE_PROVIDER); + } else if (strcmp(country_code, "A3") == 0) { + return loc_database_enumerator_set_flag(enumerator, + LOC_NETWORK_FLAG_ANYCAST); + } + for (unsigned int i = 0; i < 3; i++) { enumerator->country_code[i] = country_code[i]; }