← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2626: GeoIP improvements

 

------------------------------------------------------------
revno: 2626
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2011-10-06 20:58:07 +0200
message:
  GeoIP improvements
removed:
  geoip/db/
  geoip/db/GeoIP.dat.gz
  geoip/db/GeoIPv6.dat.gz
  geoip/db/Links.txt
modified:
  changelog.txt
  dcpp/GeoIP.cpp
  dcpp/GeoIP.h
  dcpp/Util.cpp
  dcpp/Util.h
  geoip/GeoIP.c
  geoip/GeoIP.h
  geoip/SConscript
  geoip/readme.txt
  help/settings_appearance.html
  installer/DCPlusPlus.nsi
  installer/Strings.xml
  win32/MainWindow.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt	2011-10-01 14:33:43 +0000
+++ changelog.txt	2011-10-06 18:58:07 +0000
@@ -41,7 +41,6 @@
 * [L#309402] Initial IPv6 support
 * Update boost to version 1.47
 * COM initialization fix for the Windows UPnP mapper (thanks bigmuscle)
-* Show country codes next to country names (poy)
 * [L#425667] More accurate indexing time left calculation (poy)
 * Switch to binary GeoIP databases, add the IPv6 one (poy)
 * The country format can be customized, see help for available codes (poy)

=== modified file 'dcpp/GeoIP.cpp'
--- dcpp/GeoIP.cpp	2011-09-30 12:13:00 +0000
+++ dcpp/GeoIP.cpp	2011-10-06 18:58:07 +0000
@@ -33,29 +33,40 @@
 }
 
 GeoIP::~GeoIP() {
-	GeoIP_delete(geo);
-}
-
-void GeoIP::init(const string& path) {
-	if(File::getSize(path) <= 0) {
-		if(File::getSize(path + ".gz") <= 0) {
-			return;
+	Lock l(cs);
+	close();
+}
+
+void GeoIP::init(const string& path_) {
+	path = move(path_);
+	init();
+}
+
+namespace {
+
+string forwardRet(const char* ret) {
+	return ret ? ret : Util::emptyString;
+}
+
+#ifdef _WIN32
+string getGeoInfo(int id, GEOTYPE type) {
+	id = GeoIP_Win_GEOID_by_id(id);
+	if(id) {
+		tstring str(GetGeoInfo(id, type, 0, 0, 0), 0);
+		str.resize(GetGeoInfo(id, type, &str[0], str.size(), 0));
+		if(!str.empty()) {
+			return Text::fromT(str);
 		}
-
-		// there is a .gz file but no .dat; decompress the .gz.
-		try { GZ::decompress(path + ".gz", path); }
-		catch(const Exception&) { return; }
-	}
-
-	geo = GeoIP_open(path.c_str(), GEOIP_STANDARD);
-	if(geo) {
-		GeoIP_set_charset(geo, GEOIP_CHARSET_UTF8);
-	}
+	}
+	return Util::emptyString;
 }
+#endif
 
-namespace { string forwardRet(const char* ret) { return ret ? ret : Util::emptyString; } }
+} // unnamed namespace
 
 string GeoIP::getCountry(const string& ip) const {
+	Lock l(cs);
+
 	if(geo) {
 
 		auto id = (v6() ? GeoIP_id_by_addr_v6 : GeoIP_id_by_addr)(geo, ip.c_str());
@@ -65,8 +76,22 @@
 
 			params["2code"] = [id] { return forwardRet(GeoIP_code_by_id(id)); };
 			params["3code"] = [id] { return forwardRet(GeoIP_code3_by_id(id)); };
-			params["name"] = [this, id] { return forwardRet(GeoIP_country_name_by_id(geo, id)); };
 			params["continent"] = [id] { return forwardRet(GeoIP_continent_by_id(id)); };
+			params["engname"] = [id] { return forwardRet(GeoIP_name_by_id(id)); };
+#ifdef _WIN32
+			params["name"] = [id]() -> string {
+				auto str = getGeoInfo(id, GEO_FRIENDLYNAME);
+				return str.empty() ? forwardRet(GeoIP_name_by_id(id)) : str;
+			};
+			params["officialname"] = [id]() -> string {
+				auto str = getGeoInfo(id, GEO_OFFICIALNAME);
+				return str.empty() ? forwardRet(GeoIP_name_by_id(id)) : str;
+			};
+#else
+			/// @todo any way to get localized country names on non-Windows?
+			params["name"] = [id] { return forwardRet(GeoIP_name_by_id(id)); };
+			params["officialname"] = [id] { return forwardRet(GeoIP_name_by_id(id)); };
+#endif
 
 			return Util::formatParams(SETTING(COUNTRY_FORMAT), params);
 		}
@@ -75,6 +100,47 @@
 	return Util::emptyString;
 }
 
+void GeoIP::update() {
+	Lock l(cs);
+
+	close();
+
+	if(decompress()) {
+		open();
+	}
+}
+
+void GeoIP::init() {
+	if(File::getSize(path) <= 0 && !decompress()) {
+		return;
+	}
+
+	open();
+}
+
+bool GeoIP::decompress() const {
+	if(File::getSize(path + ".gz") <= 0) {
+		return false;
+	}
+
+	try { GZ::decompress(path + ".gz", path); }
+	catch(const Exception&) { return false; }
+
+	return true;
+}
+
+void GeoIP::open() {
+	geo = GeoIP_open(path.c_str(), GEOIP_STANDARD);
+	if(geo) {
+		GeoIP_set_charset(geo, GEOIP_CHARSET_UTF8);
+	}
+}
+
+void GeoIP::close() {
+	GeoIP_delete(geo);
+	geo = 0;
+}
+
 bool GeoIP::v6() const {
 	return geo->databaseType == GEOIP_COUNTRY_EDITION_V6 || geo->databaseType == GEOIP_LARGE_COUNTRY_EDITION_V6;
 }

=== modified file 'dcpp/GeoIP.h'
--- dcpp/GeoIP.h	2011-09-28 17:00:17 +0000
+++ dcpp/GeoIP.h	2011-10-06 18:58:07 +0000
@@ -19,6 +19,8 @@
 #ifndef DCPLUSPLUS_DCPP_GEOIP_H
 #define DCPLUSPLUS_DCPP_GEOIP_H
 
+#include "CriticalSection.h"
+
 #include <string>
 
 typedef struct GeoIPTag GeoIP;
@@ -32,13 +34,21 @@
 	GeoIP();
 	~GeoIP();
 
-	void init(const string& path);
+	void init(const string& path_);
 	string getCountry(const string& ip) const;
+	void update();
 
 private:
+	void init();
+	bool decompress() const;
+	void open();
+	void close();
 	bool v6() const;
 
+	mutable CriticalSection cs;
 	::GeoIP* geo;
+
+	string path;
 };
 
 } // namespace dcpp

=== modified file 'dcpp/Util.cpp'
--- dcpp/Util.cpp	2011-10-01 14:33:43 +0000
+++ dcpp/Util.cpp	2011-10-06 18:58:07 +0000
@@ -968,6 +968,10 @@
 	return emptyString;
 }
 
+void Util::updateCountryDb(bool v6) {
+	(v6 ? geo6 : geo4).update();
+}
+
 string Util::getTimeString() {
 	char buf[64];
 	time_t _tt;

=== modified file 'dcpp/Util.h'
--- dcpp/Util.h	2011-10-01 14:33:43 +0000
+++ dcpp/Util.h	2011-10-06 18:58:07 +0000
@@ -434,6 +434,7 @@
 
 	enum { V6 = 1 << 1, V4 = 1 << 2 };
 	static string getCountry(const string& ip, int flags = V6 | V4);
+	static void updateCountryDb(bool v6);
 
 	static bool getAway();
 	static void setAway(bool aAway);

=== modified file 'geoip/GeoIP.c'
--- geoip/GeoIP.c	2011-09-23 11:33:15 +0000
+++ geoip/GeoIP.c	2011-10-06 18:58:07 +0000
@@ -157,6 +157,36 @@
 	"ZMB","MNE","ZWE","A1","A2","O1","ALA","GGY","IMN","JEY",
   "BLM","MAF", "BES"};
 
+#ifdef _WIN32
+// from <http://msdn.microsoft.com/en-us/library/dd374073.aspx>
+int GeoIP_Win_GEOID[254] = { 0x0,0x0,0x0,0x8,0xE0,0x3,0x2,0x12C,0x6,0x7,0x0,
+	0x9,0x12D,0xB,0xA,0xE,0xC,0x12E,0x5,0x19,0x12,
+	0x17,0x15,0xF5,0x23,0x11,0x26,0x1C,0x14,0x25,0x1A,
+	0x20,0x16,0x22,0x132,0x13,0x1D,0x18,0x27,0x137,0x2C,
+	0x37,0x2B,0xDF,0x77,0x138,0x2E,0x31,0x2D,0x33,0x36,
+	0x38,0x39,0x135,0x3B,0x4B,0x5E,0x3E,0x3D,0x3F,0x41,
+	0x4,0x42,0x46,0x43,0x0,0x47,0xD9,0x49,0x4D,0x4E,
+	0x13B,0x50,0x51,0x54,0x0,0x57,0xF2,0x5B,0x58,0x13D,
+	0x59,0x5A,0x5D,0x56,0x64,0x141,0x45,0x62,0x156,0x63,
+	0x142,0xC4,0x65,0x68,0x145,0x6A,0x6C,0x67,0x6D,0x6F,
+	0x44,0x75,0x71,0x72,0x79,0x74,0x6E,0x76,0x7C,0x7E,
+	0x7A,0x81,0x82,0x28,0x85,0x32,0xCF,0x83,0x86,0x88,
+	0x133,0x89,0x8A,0x8B,0xDA,0x91,0x2A,0x8E,0x92,0x8D,
+	0x93,0x8C,0x94,0x9F,0x9E,0x98,0x95,0xC7,0x4CA2,0x9D,
+	0x1B,0x9A,0x97,0x151,0x14A,0xA2,0x14C,0xA3,0xA0,0xA5,
+	0x9C,0xA6,0xA7,0xA8,0xFE,0x14E,0xAD,0x150,0xAF,0xB6,
+	0xB0,0xB1,0xB2,0xB4,0x14F,0xB7,0xA4,0xC0,0xBB,0x13E,
+	0xC2,0xC9,0xBE,0xBF,0xCE,0x153,0xCA,0xB8,0xC1,0xC3,
+	0xB9,0xC5,0xC6,0xC8,0xCB,0xCC,0xCD,0x1E,0xD0,0xDB,
+	0xDD,0xD7,0x157,0xD4,0xDC,0x8F,0xD5,0xD6,0xD2,0xD8,0xB5,
+	0xE9,0x48,0xDE,0x104,0x15D,0x29,0x13F,0xE8,0xE3,
+	0xE4,0x15B,0xEE,0xEA,0xE7,0x6F60E7,0xEB,0xE1,0xEC,0xED,
+	0xEF,0xF1,0xF0,0xF4,0xF4,0xF6,0xF7,0xFD,0xF8,0xF9,
+	0x15F,0xFC,0xFB,0xAE,0x160,0x103,0x105,0x14B,0x10F,0xD1,
+	0x107,0x10E,0x108,0x0,0x0,0x0,0x0,0x144,0x3B16,0x148,
+	0x0,0x0,0x0 };
+#endif
+
 const char * GeoIP_utf8_country_name[254] = {"N/A","Asia/Pacific Region","Europe","Andorra","United Arab Emirates","Afghanistan","Antigua and Barbuda","Anguilla","Albania","Armenia","Cura" "\xc3\xa7" "ao",
 	"Angola","Antarctica","Argentina","American Samoa","Austria","Australia","Aruba","Azerbaijan","Bosnia and Herzegovina","Barbados",
 	"Bangladesh","Belgium","Burkina Faso","Bulgaria","Bahrain","Burundi","Benin","Bermuda","Brunei Darussalam","Bolivia",
@@ -184,33 +214,6 @@
 	"Zambia","Montenegro","Zimbabwe","Anonymous Proxy","Satellite Provider","Other","Aland Islands","Guernsey","Isle of Man","Jersey",
   "Saint Barthelemy","Saint Martin", "Bonaire, Saint Eustatius and Saba"};
 
-const char * GeoIP_country_name[254] = {"N/A","Asia/Pacific Region","Europe","Andorra","United Arab Emirates","Afghanistan","Antigua and Barbuda","Anguilla","Albania","Armenia","Cura" "\xe7" "ao",
-	"Angola","Antarctica","Argentina","American Samoa","Austria","Australia","Aruba","Azerbaijan","Bosnia and Herzegovina","Barbados",
-	"Bangladesh","Belgium","Burkina Faso","Bulgaria","Bahrain","Burundi","Benin","Bermuda","Brunei Darussalam","Bolivia",
-	"Brazil","Bahamas","Bhutan","Bouvet Island","Botswana","Belarus","Belize","Canada","Cocos (Keeling) Islands","Congo, The Democratic Republic of the",
-	"Central African Republic","Congo","Switzerland","Cote D'Ivoire","Cook Islands","Chile","Cameroon","China","Colombia","Costa Rica",
-	"Cuba","Cape Verde","Christmas Island","Cyprus","Czech Republic","Germany","Djibouti","Denmark","Dominica","Dominican Republic",
-	"Algeria","Ecuador","Estonia","Egypt","Western Sahara","Eritrea","Spain","Ethiopia","Finland","Fiji",
-	"Falkland Islands (Malvinas)","Micronesia, Federated States of","Faroe Islands","France","Sint Maarten (Dutch part)","Gabon","United Kingdom","Grenada","Georgia","French Guiana",
-	"Ghana","Gibraltar","Greenland","Gambia","Guinea","Guadeloupe","Equatorial Guinea","Greece","South Georgia and the South Sandwich Islands","Guatemala",
-	"Guam","Guinea-Bissau","Guyana","Hong Kong","Heard Island and McDonald Islands","Honduras","Croatia","Haiti","Hungary","Indonesia",
-	"Ireland","Israel","India","British Indian Ocean Territory","Iraq","Iran, Islamic Republic of","Iceland","Italy","Jamaica","Jordan",
-	"Japan","Kenya","Kyrgyzstan","Cambodia","Kiribati","Comoros","Saint Kitts and Nevis","Korea, Democratic People's Republic of","Korea, Republic of","Kuwait",
-	"Cayman Islands","Kazakhstan","Lao People's Democratic Republic","Lebanon","Saint Lucia","Liechtenstein","Sri Lanka","Liberia","Lesotho","Lithuania",
-	"Luxembourg","Latvia","Libyan Arab Jamahiriya","Morocco","Monaco","Moldova, Republic of","Madagascar","Marshall Islands","Macedonia","Mali",
-	"Myanmar","Mongolia","Macau","Northern Mariana Islands","Martinique","Mauritania","Montserrat","Malta","Mauritius","Maldives",
-	"Malawi","Mexico","Malaysia","Mozambique","Namibia","New Caledonia","Niger","Norfolk Island","Nigeria","Nicaragua",
-	"Netherlands","Norway","Nepal","Nauru","Niue","New Zealand","Oman","Panama","Peru","French Polynesia",
-	"Papua New Guinea","Philippines","Pakistan","Poland","Saint Pierre and Miquelon","Pitcairn Islands","Puerto Rico","Palestinian Territory","Portugal","Palau",
-	"Paraguay","Qatar","Reunion","Romania","Russian Federation","Rwanda","Saudi Arabia","Solomon Islands","Seychelles","Sudan",
-	"Sweden","Singapore","Saint Helena","Slovenia","Svalbard and Jan Mayen","Slovakia","Sierra Leone","San Marino","Senegal","Somalia","Suriname",
-	"Sao Tome and Principe","El Salvador","Syrian Arab Republic","Swaziland","Turks and Caicos Islands","Chad","French Southern Territories","Togo","Thailand",
-	"Tajikistan","Tokelau","Turkmenistan","Tunisia","Tonga","Timor-Leste","Turkey","Trinidad and Tobago","Tuvalu","Taiwan",
-	"Tanzania, United Republic of","Ukraine","Uganda","United States Minor Outlying Islands","United States","Uruguay","Uzbekistan","Holy See (Vatican City State)","Saint Vincent and the Grenadines","Venezuela",
-	"Virgin Islands, British","Virgin Islands, U.S.","Vietnam","Vanuatu","Wallis and Futuna","Samoa","Yemen","Mayotte","Serbia","South Africa",
-	"Zambia","Montenegro","Zimbabwe","Anonymous Proxy","Satellite Provider","Other","Aland Islands","Guernsey","Isle of Man","Jersey",
-  "Saint Barthelemy","Saint Martin", "Bonaire, Saint Eustatius and Saba"};
-
 /* Possible continent codes are AF, AS, EU, NA, OC, SA for Africa, Asia, Europe, North America, Oceania
 and South America. */
 
@@ -1910,18 +1913,16 @@
        /* return NULL also even for index 0 for backward compatibility */
        if (id <= 0 || id >= (int) num_GeoIP_countries)
                return NULL;
-       return ((gi->charset == GEOIP_CHARSET_UTF8)
-         ? GeoIP_utf8_country_name[id]
-         : GeoIP_country_name[id]);
+       return GeoIP_utf8_country_name[id];
 }
 
-/** return full name of country in iso-8859-1 */
+/** return full name of country in utf-8 */
 const char* GeoIP_name_by_id(int id)
 {
        if (id < 0 || id >= (int) num_GeoIP_countries)
                return NULL;
 
-       return GeoIP_country_name[id];
+       return GeoIP_utf8_country_name[id];
 }
 
 /** return continent of country */
@@ -1933,6 +1934,17 @@
        return GeoIP_country_continent[id];
 }
 
+#ifdef _WIN32
+/** return a Windows GEOID */
+int GeoIP_Win_GEOID_by_id(int id)
+{
+       if (id < 0 || id >= (int) num_GeoIP_countries)
+               return 0;
+
+       return GeoIP_Win_GEOID[id];
+}
+#endif
+
 /** return id by country code **/
 int GeoIP_id_by_code(const char *country)
 {

=== modified file 'geoip/GeoIP.h'
--- geoip/GeoIP.h	2011-09-23 11:33:15 +0000
+++ geoip/GeoIP.h	2011-10-06 18:58:07 +0000
@@ -146,7 +146,6 @@
  * program with newer GeoIP versions */
 extern const char GeoIP_country_code[254][3];
 extern const char GeoIP_country_code3[254][4];
-extern const char * GeoIP_country_name[254];
 extern const char * GeoIP_utf8_country_name[254];
 extern const char GeoIP_country_continent[254][3];
 
@@ -244,6 +243,11 @@
 /** return continent of country */
 GEOIP_API const char* GeoIP_continent_by_id(int id);
 
+#ifdef _WIN32
+/** return a Windows GEOID */
+GEOIP_API int GeoIP_Win_GEOID_by_id(int id);
+#endif
+
 /** return id by country code **/
 GEOIP_API int GeoIP_id_by_code(const char *country);
 

=== modified file 'geoip/SConscript'
--- geoip/SConscript	2011-09-23 11:33:15 +0000
+++ geoip/SConscript	2011-10-06 18:58:07 +0000
@@ -10,9 +10,4 @@
 
 ret = env.StaticLibrary(target, sources)
 
-# copy the DB to the build dir.
-import os
-for file in Glob('db/*.gz'):
-	env.Command(dev.get_build_path('bin/') + os.path.basename(str(file)), file, Copy('$TARGET', '$SOURCE'))
-
 Return('ret')

=== removed directory 'geoip/db'
=== removed file 'geoip/db/GeoIP.dat.gz'
Binary files geoip/db/GeoIP.dat.gz	2011-09-23 11:33:15 +0000 and geoip/db/GeoIP.dat.gz	1970-01-01 00:00:00 +0000 differ
=== removed file 'geoip/db/GeoIPv6.dat.gz'
Binary files geoip/db/GeoIPv6.dat.gz	2011-09-23 11:33:15 +0000 and geoip/db/GeoIPv6.dat.gz	1970-01-01 00:00:00 +0000 differ
=== removed file 'geoip/db/Links.txt'
--- geoip/db/Links.txt	2011-09-23 11:33:15 +0000
+++ geoip/db/Links.txt	1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
-IPv6 database: <http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz>
-IPv4 database: <http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz>

=== modified file 'geoip/readme.txt'
--- geoip/readme.txt	2011-09-23 11:33:15 +0000
+++ geoip/readme.txt	2011-10-06 18:58:07 +0000
@@ -1,5 +1,12 @@
 This folder contains useful parts of MaxMind's GeoIP C API <http://www.maxmind.com/app/c>.
 
 Header includes have been slightly changed.
+
+The non-UTF-8 country name list has been removed.
+
+A list of Windows GEOID and a conversion function (GeoIP_Win_GEOID_by_id) have been added.
+
+An implementation of the pread function has been added for Windows.
+
 The inet_pton implementation for Windows has been rewritten to use WSAStringToAddressA (the
 getaddrinfo variant in the original file was causing crashes).

=== modified file 'help/settings_appearance.html'
--- help/settings_appearance.html	2011-10-01 14:59:18 +0000
+++ help/settings_appearance.html	2011-10-06 18:58:07 +0000
@@ -77,8 +77,13 @@
 <ul>
 	<li><b>%[2code]</b> gets replaced by a 2-letters country code (eg DE, FR).</li>
 	<li><b>%[3code]</b> gets replaced by a 3-letters country code (eg DEU, FRA).</li>
-	<li><b>%[name]</b> gets replaced by the full country name (eg Germany, France).</li>
-	<li><b>%[continent]</b> gets replaced by a continent code (AF, AS, EU, NA, OC, SA for Africa, Asia, Europe, North America, Oceania and South America).</li>
+	<li><b>%[continent]</b> gets replaced by a continent code (AF, AS, EU, NA, OC, SA for Africa,
+	Asia, Europe, North America, Oceania and South America).</li>
+	<li><b>%[engname]</b> gets replaced by the English country friendly name (eg Germany, France).</li>
+	<li><b>%[name]</b> gets replaced by the localized country friendly name (eg Germany, France on
+	an English operating system).</li>
+	<li><b>%[officialname]</b> gets replaced by the localized country official name (eg Federal
+	Republic of Germany, French Republic on an English operating system).</li>
 </ul>
 </dd>
 <dt id="messagelines">Height of the message editing box</dt>

=== modified file 'installer/DCPlusPlus.nsi'
--- installer/DCPlusPlus.nsi	2011-09-23 11:47:15 +0000
+++ installer/DCPlusPlus.nsi	2011-10-06 18:58:07 +0000
@@ -124,12 +124,6 @@
   WriteUninstaller "uninstall.exe"
 SectionEnd
 
-Section $(SECTION_IP_COUNTRY)
-  SetOutPath "$LOCALAPPDATA\DC++"
-  File "GeoIPv6.dat.gz"
-  File "GeoIP.dat.gz"
-SectionEnd
-
 Section $(SECTION_START_MENU)
   CreateDirectory "$SMPROGRAMS\DC++"
   CreateShortCut "$SMPROGRAMS\DC++\DC++.lnk" "$INSTDIR\DCPlusPlus.exe" "" "$INSTDIR\DCPlusPlus.exe" 0 "" "" "$(SM_DCPP_DESCR)"

=== modified file 'installer/Strings.xml'
--- installer/Strings.xml	2011-06-01 15:46:26 +0000
+++ installer/Strings.xml	2011-10-06 18:58:07 +0000
@@ -2,7 +2,6 @@
 <Strings>
 	<SECTION_DCPP>DC++ (required)</SECTION_DCPP>
 	<BACKUP_QUESTION>A previous installation of DC++ has been found; backup settings and queue to '$R0'?</BACKUP_QUESTION>
-	<SECTION_IP_COUNTRY>IP -&gt; country mappings</SECTION_IP_COUNTRY>
 	<SECTION_START_MENU>Start menu shortcuts</SECTION_START_MENU>
 	<SECTION_LOCAL>Store settings in the user profile directory</SECTION_LOCAL>
 	<LOCAL_WARNING>Unchecking this box will make DC++ store its settings in the program directory. This is strongly discouraged on Windows Vista and later; settings or downloads might get lost.</LOCAL_WARNING>

=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp	2011-10-05 16:58:42 +0000
+++ win32/MainWindow.cpp	2011-10-06 18:58:07 +0000
@@ -1316,8 +1316,8 @@
 	if(!conn->buf.empty()) {
 		try {
 			File(Util::getGeoPath(v6) + ".gz", File::WRITE, File::CREATE | File::TRUNCATE).write(conn->buf);
-			File f(Util::getGeoPath(v6), File::WRITE, File::CREATE | File::TRUNCATE); // clear the previous db
-			LogManager::getInstance()->message(str(F_("The %1% GeoIP database has been successfully updated; restart DC++ to apply") % (v6 ? "IPv6" : "IPv4")));
+			Util::updateCountryDb(v6);
+			LogManager::getInstance()->message(str(F_("The %1% GeoIP database has been successfully updated") % (v6 ? "IPv6" : "IPv4")));
 			return;
 		} catch(const FileException&) { }
 	}