diff options
author | Alan F <ajf@eth0.org.uk> | 2014-02-03 15:43:20 +0000 |
---|---|---|
committer | Alan F <ajf@eth0.org.uk> | 2014-02-03 15:43:20 +0000 |
commit | c193bdca42988cc7b01617a301d404c0d5af1d9b (patch) | |
tree | be5de321ae3d1bc451bb8821d3c794085082b43d /src | |
parent | 044bfd7d985c152a4d2350f3d7d51f8302ec49c9 (diff) |
allow GeoIPCity.dat instead of GeoLiteCity.dat, since some installs seem to use this
Diffstat (limited to 'src')
-rw-r--r-- | src/trg-peers-model.c | 14 | ||||
-rw-r--r-- | src/trg-peers-model.h | 1 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/trg-peers-model.c b/src/trg-peers-model.c index 0137c9d..a3b7458 100644 --- a/src/trg-peers-model.c +++ b/src/trg-peers-model.c @@ -263,6 +263,7 @@ static void trg_peers_model_init(TrgPeersModel * self) gchar *geoip_db_path = NULL; gchar *geoip_v6_db_path = NULL; gchar *geoip_city_db_path = NULL; + gchar *geoip_city_alt_db_path = NULL; #endif GType column_types[PEERSCOL_COLUMNS]; @@ -289,10 +290,12 @@ static void trg_peers_model_init(TrgPeersModel * self) geoip_db_path = trg_win32_support_path("GeoIP.dat"); geoip_v6_db_path = trg_win32_support_path("GeoIPv6.dat"); geoip_city_db_path = trg_win32_support_path("GeoLiteCity.dat"); + geoip_city_alt_db_path = trg_win32_support_path("GeoIPCity.dat"); #else geoip_db_path = g_strdup(TRG_GEOIP_DATABASE); geoip_v6_db_path = g_strdup(TRG_GEOIPV6_DATABASE); geoip_city_db_path = g_strdup(TRG_GEOIP_CITY_DATABASE); + geoip_city_alt_db_path = g_strdup(TRG_GEOIP_CITY_ALT_DATABASE); #endif if (g_file_test(geoip_db_path, G_FILE_TEST_EXISTS) == TRUE) @@ -303,13 +306,18 @@ static void trg_peers_model_init(TrgPeersModel * self) priv->geoipv6 = GeoIP_open(geoip_v6_db_path, GEOIP_STANDARD | GEOIP_CHECK_CACHE); - if (g_file_test(geoip_city_db_path, G_FILE_TEST_EXISTS) == TRUE) { + if (g_file_test(geoip_city_db_path, G_FILE_TEST_EXISTS) == TRUE) priv->geoipcity = GeoIP_open(geoip_city_db_path, GEOIP_STANDARD | GEOIP_CHECK_CACHE); - GeoIP_set_charset(priv->geoipcity, GEOIP_CHARSET_UTF8); - } + else if (g_file_test(geoip_city_alt_db_path, G_FILE_TEST_EXISTS) == TRUE) + priv->geoipcity = GeoIP_open(geoip_city_alt_db_path, + GEOIP_STANDARD | GEOIP_CHECK_CACHE); + + if (priv->geoipcity) + GeoIP_set_charset(priv->geoipcity, GEOIP_CHARSET_UTF8); g_free(geoip_city_db_path); + g_free(geoip_city_alt_db_path); g_free(geoip_db_path); g_free(geoip_v6_db_path); #endif diff --git a/src/trg-peers-model.h b/src/trg-peers-model.h index 22d4efe..4995ab0 100644 --- a/src/trg-peers-model.h +++ b/src/trg-peers-model.h @@ -97,3 +97,4 @@ gboolean trg_peers_model_has_country_db(TrgPeersModel *model); #define TRG_GEOIP_DATABASE "/usr/share/GeoIP/GeoIP.dat" #define TRG_GEOIPV6_DATABASE "/usr/share/GeoIP/GeoIPv6.dat" #define TRG_GEOIP_CITY_DATABASE "/usr/share/GeoIP/GeoLiteCity.dat" +#define TRG_GEOIP_CITY_ALT_DATABASE "/usr/share/GeoIP/GeoIPCity.dat" |