Index: Example.xml =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/Example.xml,v retrieving revision 1.92 diff -u -r1.92 Example.xml --- Example.xml 5 Oct 2004 16:46:35 -0000 1.92 +++ Example.xml 14 Oct 2004 20:44:11 -0000 @@ -66,6 +66,7 @@ Disk full(?) Document Done + Don't download files already in share The temporary download directory cannot be shared Download Download failed: @@ -446,6 +447,7 @@ Timestamps enabled More data was sent than was expected Total: + A file with the same hash already exists in your share TTH inconsistency TTH Root Type Index: client/QueueManager.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/client/QueueManager.cpp,v retrieving revision 1.106 diff -u -r1.106 QueueManager.cpp --- client/QueueManager.cpp 3 Oct 2004 20:49:44 -0000 1.106 +++ client/QueueManager.cpp 14 Oct 2004 20:44:27 -0000 @@ -406,6 +406,14 @@ throw QueueException(STRING(NO_DOWNLOADS_FROM_SELF)); } + // Check if we're not downloading something already in our share + if (BOOLSETTING(DONT_DL_ALREADY_SHARED) && root != NULL){ + TTHValue* r = const_cast(root); + if (ShareManager::getInstance()->isTTHShared(r)){ + throw QueueException(STRING(TTH_ALREADY_SHARED)); + } + } + bool utf8 = (aFlags & QueueItem::FLAG_SOURCE_UTF8) > 0; aFlags &= ~QueueItem::FLAG_SOURCE_UTF8; Index: client/SettingsManager.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/client/SettingsManager.cpp,v retrieving revision 1.89 diff -u -r1.89 SettingsManager.cpp --- client/SettingsManager.cpp 26 Sep 2004 18:54:08 -0000 1.89 +++ client/SettingsManager.cpp 14 Oct 2004 20:44:28 -0000 @@ -55,7 +55,7 @@ "LogFilelistTransfers", "SendUnknownCommands", "MaxHashSpeed", "GetUserCountry", "FavShowJoins", "LogStatusMessages", "ShowStatusbar", "ShowToolbar", "ShowTransferview", "PopunderPm", "PopunderFilelist", "MagnetAsk", "MagnetAction", "MagnetRegister", - "AddFinishedInstantly", "UseUPnP", + "AddFinishedInstantly", "UseUPnP", "DontDLAlreadyShared", "SENTRY", // Int64 "TotalUpload", "TotalDownload", @@ -167,6 +167,7 @@ setDefault(MAGNET_ACTION, MAGNET_AUTO_SEARCH); setDefault(ADD_FINISHED_INSTANTLY, false); setDefault(SETTINGS_USE_UPNP, false); + setDefault(DONT_DL_ALREADY_SHARED, false); #ifdef _WIN32 setDefault(MAIN_WINDOW_STATE, SW_SHOWNORMAL); Index: client/SettingsManager.h =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/client/SettingsManager.h,v retrieving revision 1.71 diff -u -r1.71 SettingsManager.h --- client/SettingsManager.h 24 Sep 2004 20:48:27 -0000 1.71 +++ client/SettingsManager.h 14 Oct 2004 20:44:29 -0000 @@ -70,7 +70,7 @@ LOG_FILELIST_TRANSFERS, SEND_UNKNOWN_COMMANDS, MAX_HASH_SPEED, GET_USER_COUNTRY, FAV_SHOW_JOINS, LOG_STATUS_MESSAGES, SHOW_STATUSBAR, SHOW_TOOLBAR, SHOW_TRANSFERVIEW, POPUNDER_PM, POPUNDER_FILELIST, MAGNET_ASK, MAGNET_ACTION, MAGNET_REGISTER, - ADD_FINISHED_INSTANTLY, SETTINGS_USE_UPNP, + ADD_FINISHED_INSTANTLY, SETTINGS_USE_UPNP, DONT_DL_ALREADY_SHARED, INT_LAST }; enum Int64Setting { INT64_FIRST = INT_LAST + 1, Index: client/ShareManager.h =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/client/ShareManager.h,v retrieving revision 1.58 diff -u -r1.58 ShareManager.h --- client/ShareManager.h 1 Oct 2004 22:45:03 -0000 1.58 +++ client/ShareManager.h 14 Oct 2004 20:44:29 -0000 @@ -80,7 +80,12 @@ void addHits(u_int32_t aHits) { hits += aHits; } - + + BOOLEAN isTTHShared(TTHValue* tth){ + HashFileIter i = tthIndex.find(tth); + return (i != tthIndex.end()); + } + GETSET(u_int32_t, hits, Hits); GETSET(string, listFile, ListFile); GETSET(string, bzXmlFile, BZXmlFile); Index: client/StringDefs.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/client/StringDefs.cpp,v retrieving revision 1.98 diff -u -r1.98 StringDefs.cpp --- client/StringDefs.cpp 5 Oct 2004 16:46:42 -0000 1.98 +++ client/StringDefs.cpp 14 Oct 2004 20:44:32 -0000 @@ -67,6 +67,7 @@ "Disk full(?)", "Document", "Done", +"Don't download files already in share", "The temporary download directory cannot be shared", "Download", "Download failed: ", @@ -447,6 +448,7 @@ "Timestamps enabled", "More data was sent than was expected", "Total: ", +"A file with the same hash already exists in your share", "TTH inconsistency", "TTH Root", "Type", @@ -547,6 +549,7 @@ "DiscFull", "Document", "Done", +"DontDlAlreadyShared", "DontShareTempDirectory", "Download", "DownloadFailed", @@ -927,6 +930,7 @@ "TimestampsEnabled", "TooMuchData", "Total", +"TthAlreadyShared", "TthInconsistency", "TthRoot", "Type", Index: client/StringDefs.h =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/client/StringDefs.h,v retrieving revision 1.96 diff -u -r1.96 StringDefs.h --- client/StringDefs.h 5 Oct 2004 16:46:42 -0000 1.96 +++ client/StringDefs.h 14 Oct 2004 20:44:34 -0000 @@ -70,6 +70,7 @@ DISC_FULL, // "Disk full(?)" DOCUMENT, // "Document" DONE, // "Done" + DONT_DL_ALREADY_SHARED, // "Don't download files already in share" DONT_SHARE_TEMP_DIRECTORY, // "The temporary download directory cannot be shared" DOWNLOAD, // "Download" DOWNLOAD_FAILED, // "Download failed: " @@ -450,6 +451,7 @@ TIMESTAMPS_ENABLED, // "Timestamps enabled" TOO_MUCH_DATA, // "More data was sent than was expected" TOTAL, // "Total: " + TTH_ALREADY_SHARED, // "A file with the same hash already exists in your share" TTH_INCONSISTENCY, // "TTH inconsistency" TTH_ROOT, // "TTH Root" TYPE, // "Type" Index: windows/AdvancedPage.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/windows/AdvancedPage.cpp,v retrieving revision 1.38 diff -u -r1.38 AdvancedPage.cpp --- windows/AdvancedPage.cpp 27 Sep 2004 12:02:42 -0000 1.38 +++ windows/AdvancedPage.cpp 14 Oct 2004 20:44:36 -0000 @@ -82,6 +82,7 @@ { SettingsManager::SEND_UNKNOWN_COMMANDS, ResourceManager::SETTINGS_SEND_UNKNOWN_COMMANDS }, { SettingsManager::ADD_FINISHED_INSTANTLY, ResourceManager::ADD_FINISHED_INSTANTLY }, { SettingsManager::SETTINGS_USE_UPNP, ResourceManager::SETTINGS_USE_UPNP }, + { SettingsManager::DONT_DL_ALREADY_SHARED, ResourceManager::DONT_DL_ALREADY_SHARED }, { 0, ResourceManager::SETTINGS_AUTO_AWAY } };