From c193bdca42988cc7b01617a301d404c0d5af1d9b Mon Sep 17 00:00:00 2001 From: Alan F Date: Mon, 3 Feb 2014 15:43:20 +0000 Subject: allow GeoIPCity.dat instead of GeoLiteCity.dat, since some installs seem to use this --- src/trg-peers-model.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/trg-peers-model.c') 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 -- cgit v1.2.3