From: <arn...@us...> - 2006-12-07 22:43:19
|
Revision: 685 http://svn.sourceforge.net/dcplusplus/?rev=685&view=rev Author: arnetheduck Date: 2006-12-07 14:43:16 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Cleanup and patches Modified Paths: -------------- dcplusplus/trunk/DCPlusPlus.vcproj dcplusplus/trunk/Example.xml dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/ClientManager.h dcplusplus/trunk/client/CryptoManager.cpp dcplusplus/trunk/client/DirectoryListing.h dcplusplus/trunk/client/File.cpp dcplusplus/trunk/client/File.h dcplusplus/trunk/client/QueueManager.cpp dcplusplus/trunk/client/SSLSocket.cpp dcplusplus/trunk/client/SSLSocket.h dcplusplus/trunk/client/SettingsManager.cpp dcplusplus/trunk/client/SettingsManager.h dcplusplus/trunk/client/Socket.cpp dcplusplus/trunk/client/StringDefs.cpp dcplusplus/trunk/client/StringDefs.h dcplusplus/trunk/client/Thread.h dcplusplus/trunk/client/UploadManager.cpp dcplusplus/trunk/client/Util.cpp dcplusplus/trunk/help/help.vcproj dcplusplus/trunk/windows/AboutDlg.h dcplusplus/trunk/windows/AdvancedPage.cpp dcplusplus/trunk/windows/AppearancePage.cpp dcplusplus/trunk/windows/FinishedFrameBase.h dcplusplus/trunk/windows/HubFrame.cpp dcplusplus/trunk/windows/HubFrame.h dcplusplus/trunk/windows/MainFrm.cpp dcplusplus/trunk/windows/SearchFrm.cpp dcplusplus/trunk/windows/resource.h Added Paths: ----------- dcplusplus/trunk/help/public_hubs.html Modified: dcplusplus/trunk/DCPlusPlus.vcproj =================================================================== --- dcplusplus/trunk/DCPlusPlus.vcproj 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/DCPlusPlus.vcproj 2006-12-07 22:43:16 UTC (rev 685) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" - Version="8.00" + Version="8,00" Name="DCPlusPlus" ProjectGUID="{E82610AA-B6FD-4813-B5B9-E717CBD0F23B}" RootNamespace="DCPlusPlus" @@ -477,6 +477,10 @@ > </File> <File + RelativePath=".\windows\ShellContextMenu.cpp" + > + </File> + <File RelativePath=".\windows\SpyFrame.cpp" > </File> @@ -718,6 +722,10 @@ > </File> <File + RelativePath=".\windows\ShellContextMenu.h" + > + </File> + <File RelativePath="windows\SingleInstance.h" > </File> Modified: dcplusplus/trunk/Example.xml =================================================================== --- dcplusplus/trunk/Example.xml 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/Example.xml 2006-12-07 22:43:16 UTC (rev 685) @@ -501,6 +501,7 @@ <String Name="SettingsSharedDirectories">Shared directories</String> <String Name="SettingsShowJoins">Show joins / parts in chat by default</String> <String Name="SettingsShowProgressBars">Show progress bars for transfers</String> + <String Name="SettingsShowShellMenu">Show shell menu in finished transfers</String> <String Name="SettingsSkipZeroByte">Skip zero-byte files</String> <String Name="SettingsSmallSendBuffer">Use small send buffer (enable if uploads slow downloads a lot)</String> <String Name="SettingsSocks5">SOCKS5</String> @@ -508,6 +509,7 @@ <String Name="SettingsSocks5Port">Port</String> <String Name="SettingsSocks5Resolve">Use SOCKS5 server to resolve host names</String> <String Name="SettingsSocks5Username">Login</String> + <String Name="SettingsSortFavusersFirst">Sort favorite users first</String> <String Name="SettingsSounds">Sounds</String> <String Name="SettingsSpeedsNotAccurate">Note; because of changing download speeds, this is not 100% accurate...</String> <String Name="SettingsStatusInChat">View status messages in main chat</String> Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/changelog.txt 2006-12-07 22:43:16 UTC (rev 685) @@ -12,6 +12,13 @@ * Linux checks for invalid file types (thanks steven sheehy) * Fixed potential crash when search began with space * [bug 1085] Better sound playing settings (thanks cologic / ullner) +* [bug 1111] OpenSSL compatibility and some unix fixes (thanks steven sheehy) +* [bug 1056] Added option to sort fav users above other users in hub frame (thanks poy) +* [bug 1063] Added option to show shell context menu in finished frame (thanks poy) +* [bug 1092] Fixed TTH tree being redownloaded (thanks stephan hohe) +* [bug 1097] Fixed waiting users being removed (thanks stephan hohe) +* [bug 1110] Added new adc hub list (thanks mafa_45) +* [bug 1091] Added new nmdc hub lists (thanks poy) -- 0.698 2006-10-10 -- * [bug 1065] Code cleanup (thanks steven sheehy) Modified: dcplusplus/trunk/client/ClientManager.h =================================================================== --- dcplusplus/trunk/client/ClientManager.h 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/client/ClientManager.h 2006-12-07 22:43:16 UTC (rev 685) @@ -137,7 +137,7 @@ void updateCachedIp(); // SettingsManagerListener - virtual void on(Load, SimpleXML&); + virtual void on(Load, SimpleXML&) throw(); // ClientListener virtual void on(Connected, Client* c) throw() { fire(ClientManagerListener::ClientConnected(), c); } Modified: dcplusplus/trunk/client/CryptoManager.cpp =================================================================== --- dcplusplus/trunk/client/CryptoManager.cpp 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/client/CryptoManager.cpp 2006-12-07 22:43:16 UTC (rev 685) @@ -27,8 +27,6 @@ #include "LogManager.h" #include "ClientManager.h" -#include <openssl/ssl.h> - #ifdef _WIN32 #include "../bzip2/bzlib.h" #else @@ -37,15 +35,19 @@ CryptoManager::CryptoManager() : - clientContext(SSL_CTX_new(TLSv1_client_method())), - serverContext(SSL_CTX_new(TLSv1_server_method())), - clientVerContext(SSL_CTX_new(TLSv1_client_method())), - serverVerContext(SSL_CTX_new(TLSv1_server_method())), dh(DH_new()), certsLoaded(false), lock("EXTENDEDPROTOCOLABCABCABCABCABCABC"), pk("DCPLUSPLUS" VERSIONSTRING "ABCABC") { + SSL_library_init(); + + // Probably should check the return value of these. + clientContext = SSL_CTX_new(TLSv1_client_method()); + clientVerContext = SSL_CTX_new(TLSv1_client_method()); + serverContext = SSL_CTX_new(TLSv1_server_method()); + serverVerContext = SSL_CTX_new(TLSv1_server_method()); + static unsigned char dh512_p[] = { 0xDA,0x58,0x3C,0x16,0xD9,0x85,0x22,0x89,0xD0,0xE4,0xAF,0x75, @@ -93,7 +95,6 @@ } void CryptoManager::generateCertificate() throw(CryptoException) { -#ifdef _WIN32 // Generate certificate using OpenSSL if(SETTING(TLS_PRIVATE_KEY_FILE).empty()) { throw CryptoException("No private key file chosen"); @@ -101,6 +102,8 @@ if(SETTING(TLS_CERTIFICATE_FILE).empty()) { throw CryptoException("No certificate file chosen"); } + +#ifdef _WIN32 wstring cmd = L"openssl.exe genrsa -out \"" + Text::utf8ToWide(SETTING(TLS_PRIVATE_KEY_FILE)) + L"\" 2048"; PROCESS_INFORMATION pi = { 0 }; STARTUPINFO si = { 0 }; @@ -124,6 +127,18 @@ WaitForSingleObject(pi.hProcess, INFINITE); CloseHandle(pi.hThread); CloseHandle(pi.hProcess); +#else + string cmd = "openssl genrsa -out \"" + Text::utf8ToAcp(SETTING(TLS_PRIVATE_KEY_FILE)) + "\" 2048"; + if (system(cmd.c_str()) == -1) { + throw CryptoException("Failed to spawn process: openssl"); + } + + cmd = "openssl req -x509 -new -batch -days 3650 -key \"" + Text::utf8ToAcp(SETTING(TLS_PRIVATE_KEY_FILE)) + + "\" -out \"" + Text::utf8ToAcp(SETTING(TLS_CERTIFICATE_FILE)) + "\" -subj \"/CN=" + + Text::utf8ToAcp(ClientManager::getInstance()->getMyCID().toBase32()) + "\""; + if (system(cmd.c_str()) == -1) { + throw CryptoException("Failed to spawn process: openssl"); + } #endif } Modified: dcplusplus/trunk/client/DirectoryListing.h =================================================================== --- dcplusplus/trunk/client/DirectoryListing.h 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/client/DirectoryListing.h 2006-12-07 22:43:16 UTC (rev 685) @@ -27,11 +27,10 @@ #include "FastAlloc.h" #include "MerkleTree.h" +#include "SimpleXML.h" +#include "Streams.h" class ListLoader; -class SimpleXML; -class SimpleXMLException; -class FileException; class DirectoryListing { Modified: dcplusplus/trunk/client/File.cpp =================================================================== --- dcplusplus/trunk/client/File.cpp 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/client/File.cpp 2006-12-07 22:43:16 UTC (rev 685) @@ -383,7 +383,7 @@ } bool File::isAbsolute(const string& path) throw() { - return path.size() > 1 && path[0] = '/'; + return path.size() > 1 && path[0] == '/'; } #endif // !_WIN32 Modified: dcplusplus/trunk/client/File.h =================================================================== --- dcplusplus/trunk/client/File.h 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/client/File.h 2006-12-07 22:43:16 UTC (rev 685) @@ -33,6 +33,8 @@ #include <sys/stat.h> #include <fcntl.h> #include <errno.h> +#include <dirent.h> +#include <fnmatch.h> #endif #ifdef _WIN32 Modified: dcplusplus/trunk/client/QueueManager.cpp =================================================================== --- dcplusplus/trunk/client/QueueManager.cpp 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/client/QueueManager.cpp 2006-12-07 22:43:16 UTC (rev 685) @@ -729,7 +729,7 @@ if(d->getSize() != -1) { if(HashManager::getInstance()->getTree(d->getTTH(), d->getTigerTree())) { d->setTreeValid(true); - } else if(supportsTrees && !q->getCurrent()->isSet(QueueItem::Source::FLAG_NO_TREE) && d->getSize() > HashManager::MIN_BLOCK_SIZE) { + } else if(supportsTrees && !q->getSource(aUser)->isSet(QueueItem::Source::FLAG_NO_TREE) && d->getSize() > HashManager::MIN_BLOCK_SIZE) { // Get the tree unless the file is small (for small files, we'd probably only get the root anyway) d->setFlag(Download::FLAG_TREE_DOWNLOAD); d->getTigerTree().setFileSize(d->getSize()); Modified: dcplusplus/trunk/client/SSLSocket.cpp =================================================================== --- dcplusplus/trunk/client/SSLSocket.cpp 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/client/SSLSocket.cpp 2006-12-07 22:43:16 UTC (rev 685) @@ -23,7 +23,7 @@ #include "LogManager.h" #include "SettingsManager.h" -#include <openssl/ssl.h> +#include <openssl/err.h> SSLSocket::SSLSocket(SSL_CTX* context) throw(SocketException) : ctx(context), ssl(0) { Modified: dcplusplus/trunk/client/SSLSocket.h =================================================================== --- dcplusplus/trunk/client/SSLSocket.h 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/client/SSLSocket.h 2006-12-07 22:43:16 UTC (rev 685) @@ -22,15 +22,15 @@ #include "Socket.h" #include "Singleton.h" -class SSLSocket; +#include <openssl/ssl.h> -namespace yaSSL { - class SSL; - class SSL_CTX; - struct DH; -} +#ifndef SSL_SUCCESS +#define SSL_SUCCESS 1 +#endif +#ifdef YASSL_VERSION using namespace yaSSL; +#endif class CryptoManager; Modified: dcplusplus/trunk/client/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/client/SettingsManager.cpp 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/client/SettingsManager.cpp 2006-12-07 22:43:16 UTC (rev 685) @@ -75,7 +75,7 @@ "OpenWaitingUsers", "BoldWaitingUsers", "OpenSystemLog", "BoldSystemLog", "AutoRefreshTime", "UseTLS", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", "PromptPassword", "SpyFrameIgnoreTthSearches", "DontDlAlreadyQueued", "MaxCommandLength", "AllowUntrustedHubs", "AllowUntrustedClients", - "TLSPort", "FastHash", + "TLSPort", "FastHash", "SortFavUsersFirst", "ShowShellMenu", "SENTRY", // Int64 "TotalUpload", "TotalDownload", @@ -135,7 +135,7 @@ setDefault(IGNORE_BOT_PMS, false); setDefault(LIST_DUPES, true); setDefault(BUFFER_SIZE, 64); - setDefault(HUBLIST_SERVERS, "http://home.bandicoot.nl/adchublist.xml.bz2;http://www.hublist.org/PublicHubList.xml.bz2"); + setDefault(HUBLIST_SERVERS, "http://home.bandicoot.nl/adchublist.xml.bz2;http://adchublist.com/hublist.xml.bz2;http://www.hublist.org/PublicHubList.xml.bz2;http://dchublist.com/hublist.xml.bz2"); setDefault(DOWNLOAD_SLOTS, 3); setDefault(MAX_DOWNLOAD_SPEED, 0); setDefault(LOG_DIRECTORY, Util::getConfigPath() + "Logs" PATH_SEPARATOR_STR); @@ -269,6 +269,8 @@ setDefault(ALLOW_UNTRUSTED_HUBS, true); setDefault(ALLOW_UNTRUSTED_CLIENTS, true); setDefault(FAST_HASH, true); + setDefault(SORT_FAVUSERS_FIRST, false); + setDefault(SHOW_SHELL_MENU, false); #ifdef _WIN32 setDefault(MAIN_WINDOW_STATE, SW_SHOWNORMAL); Modified: dcplusplus/trunk/client/SettingsManager.h =================================================================== --- dcplusplus/trunk/client/SettingsManager.h 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/client/SettingsManager.h 2006-12-07 22:43:16 UTC (rev 685) @@ -91,7 +91,7 @@ OPEN_WAITING_USERS, BOLD_WAITING_USERS, OPEN_SYSTEM_LOG, BOLD_SYSTEM_LOG, AUTO_REFRESH_TIME, USE_TLS, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, PROMPT_PASSWORD, SPY_FRAME_IGNORE_TTH_SEARCHES, DONT_DL_ALREADY_QUEUED, MAX_COMMAND_LENGTH, ALLOW_UNTRUSTED_HUBS, ALLOW_UNTRUSTED_CLIENTS, - TLS_PORT, FAST_HASH, + TLS_PORT, FAST_HASH, SORT_FAVUSERS_FIRST, SHOW_SHELL_MENU, INT_LAST }; enum Int64Setting { INT64_FIRST = INT_LAST + 1, Modified: dcplusplus/trunk/client/Socket.cpp =================================================================== --- dcplusplus/trunk/client/Socket.cpp 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/client/Socket.cpp 2006-12-07 22:43:16 UTC (rev 685) @@ -109,7 +109,7 @@ check(::bind(sock, (sockaddr *)&sock_addr, sizeof(sock_addr))); } int size = sizeof(sock_addr); - getsockname(sock, (sockaddr*)&sock_addr, &size); + getsockname(sock, (sockaddr*)&sock_addr, (socklen_t*)&size); return ntohs(sock_addr.sin_port); } Modified: dcplusplus/trunk/client/StringDefs.cpp =================================================================== --- dcplusplus/trunk/client/StringDefs.cpp 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/client/StringDefs.cpp 2006-12-07 22:43:16 UTC (rev 685) @@ -502,6 +502,7 @@ "Shared directories", "Show joins / parts in chat by default", "Show progress bars for transfers", +"Show shell menu in finished transfers", "Skip zero-byte files", "Use small send buffer (enable if uploads slow downloads a lot)", "SOCKS5", @@ -509,6 +510,7 @@ "Port", "Use SOCKS5 server to resolve host names", "Login", +"Sort favorite users first", "Sounds", "Note; because of changing download speeds, this is not 100% accurate...", "View status messages in main chat", @@ -1132,6 +1134,7 @@ "SettingsSharedDirectories", "SettingsShowJoins", "SettingsShowProgressBars", +"SettingsShowShellMenu", "SettingsSkipZeroByte", "SettingsSmallSendBuffer", "SettingsSocks5", @@ -1139,6 +1142,7 @@ "SettingsSocks5Port", "SettingsSocks5Resolve", "SettingsSocks5Username", +"SettingsSortFavusersFirst", "SettingsSounds", "SettingsSpeedsNotAccurate", "SettingsStatusInChat", Modified: dcplusplus/trunk/client/StringDefs.h =================================================================== --- dcplusplus/trunk/client/StringDefs.h 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/client/StringDefs.h 2006-12-07 22:43:16 UTC (rev 685) @@ -505,6 +505,7 @@ SETTINGS_SHARED_DIRECTORIES, // "Shared directories" SETTINGS_SHOW_JOINS, // "Show joins / parts in chat by default" SETTINGS_SHOW_PROGRESS_BARS, // "Show progress bars for transfers" + SETTINGS_SHOW_SHELL_MENU, // "Show shell menu in finished transfers" SETTINGS_SKIP_ZERO_BYTE, // "Skip zero-byte files" SETTINGS_SMALL_SEND_BUFFER, // "Use small send buffer (enable if uploads slow downloads a lot)" SETTINGS_SOCKS5, // "SOCKS5" @@ -512,6 +513,7 @@ SETTINGS_SOCKS5_PORT, // "Port" SETTINGS_SOCKS5_RESOLVE, // "Use SOCKS5 server to resolve host names" SETTINGS_SOCKS5_USERNAME, // "Login" + SETTINGS_SORT_FAVUSERS_FIRST, // "Sort favorite users first" SETTINGS_SOUNDS, // "Sounds" SETTINGS_SPEEDS_NOT_ACCURATE, // "Note; because of changing download speeds, this is not 100% accurate..." SETTINGS_STATUS_IN_CHAT, // "View status messages in main chat" Modified: dcplusplus/trunk/client/Thread.h =================================================================== --- dcplusplus/trunk/client/Thread.h 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/client/Thread.h 2006-12-07 22:43:16 UTC (rev 685) @@ -105,6 +105,13 @@ pthread_mutex_unlock(&mtx); return ret; } + static long safeExchange(volatile long& target, long value) { + pthread_mutex_lock(&mtx); + long ret = target; + target = value; + pthread_mutex_unlock(&mtx); + return ret; + } #endif protected: Modified: dcplusplus/trunk/client/UploadManager.cpp =================================================================== --- dcplusplus/trunk/client/UploadManager.cpp 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/client/UploadManager.cpp 2006-12-07 22:43:16 UTC (rev 685) @@ -371,8 +371,12 @@ void UploadManager::addFailedUpload(const UserConnection& source, string filename) { { Lock l(cs); - if (!count_if(waitingUsers.begin(), waitingUsers.end(), CompareFirst<User::Ptr, uint32_t>(source.getUser()))) + UserList::iterator it = find_if(waitingUsers.begin(), waitingUsers.end(), CompareFirst<User::Ptr, uint32_t>(source.getUser())); + if (it==waitingUsers.end()) { waitingUsers.push_back(WaitingUser(source.getUser(), GET_TICK())); + } else { + it->second = GET_TICK(); + } waitingFiles[source.getUser()].insert(filename); //files for which user's asked } Modified: dcplusplus/trunk/client/Util.cpp =================================================================== --- dcplusplus/trunk/client/Util.cpp 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/client/Util.cpp 2006-12-07 22:43:16 UTC (rev 685) @@ -95,7 +95,7 @@ systemPath = "/etc/"; char* home = getenv("HOME"); configPath = home ? home + string("/.dc++/") : "/tmp/"; -#error dataPath = wherever linux should fetch data + dataPath = configPath; // dataPath in linux is usually prefix + /share/app_name, so we can't represent it here #endif // Load boot settings @@ -112,8 +112,6 @@ params["APPDATA"] = Text::fromT((::SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, path), path)); params["PERSONAL"] = Text::fromT((::SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, path), path)); configPath = Util::formatParams(boot.getChildData(), params, false); -#else -#error TODO - make env vars available perhaps? #endif } } catch(const Exception& ) { @@ -378,7 +376,7 @@ return Text::fromT(buf); #else char buf[64]; - snprintf(buf, sizeof(buf), "%'lld", aBytes); + snprintf(buf, sizeof(buf), "%'lld", (long long int)aBytes); return string(buf) + STRING(B); #endif } Modified: dcplusplus/trunk/help/help.vcproj =================================================================== --- dcplusplus/trunk/help/help.vcproj 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/help/help.vcproj 2006-12-07 22:43:16 UTC (rev 685) @@ -153,10 +153,6 @@ > </File> <File - RelativePath=".\public_hubs.html" - > - </File> - <File RelativePath=".\favorite_hubs.html" > </File> @@ -197,6 +193,10 @@ > </File> <File + RelativePath=".\public_hubs.html" + > + </File> + <File RelativePath=".\settings_advanced.html" > </File> @@ -251,9 +251,6 @@ <File RelativePath=".\settings_windows.html" > - <File - RelativePath=".\settings_tabs.html" - > </File> <File RelativePath=".\template.html" Added: dcplusplus/trunk/help/public_hubs.html =================================================================== --- dcplusplus/trunk/help/public_hubs.html (rev 0) +++ dcplusplus/trunk/help/public_hubs.html 2006-12-07 22:43:16 UTC (rev 685) @@ -0,0 +1,46 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> + <title>Public hubs</title> + <meta content="text/html; charset=us-ascii" http-equiv="content-type"> + <link type="text/css" rel="stylesheet" href="office11.css"> +</head> +<body> +<h1>Public hubs</h1> +<h2>Columns</h2> +<dl style="margin-left: 40px;"> + <dt>Name</dt> + <dd>The name of the hub</dd> + <dt>Description</dt> + <dd>The hub's description</dd> + <dt>Users</dt> + <dd>Amount of users in the hub when the hub was checked by a hublist bot</dd> + <dt>Address</dt> + <dd>The hub's address</dd> + <dt>Country</dt> + <dd>Which country the hub resides in</dd> + <dt>Shared</dt> + <dd>Amount of bytes shared in the hub when the hub was checked by a hublist bot</dd> + <dt>Min share</dt> + <dd>A restriction in the hub, where Min Share in the minimum amount of bytes you have to share to be let in</dd> + <dt>Min Slots</dt> + <dd>A restriction in the hub, where Min Slots in the minimum amount of slots you have to have open to be let in</dd> + <dt>Max hubs</dt> + <dd>A restriction in the hub, where Max Hubs in the maximum amount of hubs you are allowed to be in to be let in</dd> + <dt>Max Users</dt> + <dd>A restriction in the hub, where Max Users in the maximum amount of users the hub will let in</dd> + <dt>Reliability</dt> + <dd>How often the hub has been online, in per centage</dd> + <dt>Rating</dt> + <dd>If the hublist allowed users to vote on a hub, this will appear as the hub's rating. The more stars, the better.</dd> +</dl> +<h2>Filter</h2> +Here, you can filter the hublist so you will only see specific hubs in the hublist. Eg, selecting 'address' in the drop down, and writing "foo" in the filter, will only display hubs that have "foo" in their address. +<h2>Configured Public Hub lists</h2> +In the dropdown, you may select different hublists you want to see. Press the 'Refresh' button to download a fresh version of the hublist. +<br> +If you click on 'Configure', you will be able to change, add and remove hublists. The order in 'Configured Public Hub lists' determine the order hublists are displayed in the dropdown mentioned above. +<a href="http://dcpp.net/hublist" target="_blank" class="external">List of alternative hublists.</a> +<img title="External Link" src="external.png" border="0" height="10" width="10" alt="External Link"> +</body> +</html> Modified: dcplusplus/trunk/windows/AboutDlg.h =================================================================== --- dcplusplus/trunk/windows/AboutDlg.h 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/windows/AboutDlg.h 2006-12-07 22:43:16 UTC (rev 685) @@ -42,7 +42,7 @@ _T("defr, ullner, fleetcommand, liny, xan, olle svensson, mark gillespie, jeremy huddleston, ") _T("bsod, sulan, jonathan stone, tim burton, izzzo, guitarm, paka, nils maier, jens oknelid, yoji, ") _T("krzysztof tyszecki, poison, pothead, pur, bigmuscle, martin, jove, bart vullings, ") -_T("steven sheehy, tobias nygren, poy, dorian. ") +_T("steven sheehy, tobias nygren, poy, dorian, stephan hohe, mafa_45. ") _T("Keep it coming!"); class AboutDlg : public CDialogImpl<AboutDlg>, private HttpConnectionListener Modified: dcplusplus/trunk/windows/AdvancedPage.cpp =================================================================== --- dcplusplus/trunk/windows/AdvancedPage.cpp 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/windows/AdvancedPage.cpp 2006-12-07 22:43:16 UTC (rev 685) @@ -48,6 +48,7 @@ { SettingsManager::ADD_FINISHED_INSTANTLY, ResourceManager::SETTINGS_ADD_FINISHED_INSTANTLY }, { SettingsManager::USE_CTRL_FOR_LINE_HISTORY, ResourceManager::SETTINGS_USE_CTRL_FOR_LINE_HISTORY }, { SettingsManager::AUTO_KICK_NO_FAVS, ResourceManager::SETTINGS_AUTO_KICK_NO_FAVS }, + { SettingsManager::SHOW_SHELL_MENU, ResourceManager::SETTINGS_SHOW_SHELL_MENU }, { 0, ResourceManager::SETTINGS_AUTO_AWAY } }; Modified: dcplusplus/trunk/windows/AppearancePage.cpp =================================================================== --- dcplusplus/trunk/windows/AppearancePage.cpp 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/windows/AppearancePage.cpp 2006-12-07 22:43:16 UTC (rev 685) @@ -52,6 +52,7 @@ { SettingsManager::STATUS_IN_CHAT, ResourceManager::SETTINGS_STATUS_IN_CHAT }, { SettingsManager::SHOW_JOINS, ResourceManager::SETTINGS_SHOW_JOINS }, { SettingsManager::FAV_SHOW_JOINS, ResourceManager::SETTINGS_FAV_SHOW_JOINS }, + { SettingsManager::SORT_FAVUSERS_FIRST, ResourceManager::SETTINGS_SORT_FAVUSERS_FIRST }, { SettingsManager::USE_SYSTEM_ICONS, ResourceManager::SETTINGS_USE_SYSTEM_ICONS }, { SettingsManager::USE_OEM_MONOFONT, ResourceManager::SETTINGS_USE_OEM_MONOFONT }, { SettingsManager::GET_USER_COUNTRY, ResourceManager::SETTINGS_GET_USER_COUNTRY }, Modified: dcplusplus/trunk/windows/FinishedFrameBase.h =================================================================== --- dcplusplus/trunk/windows/FinishedFrameBase.h 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/windows/FinishedFrameBase.h 2006-12-07 22:43:16 UTC (rev 685) @@ -28,6 +28,7 @@ #include "FlatTabCtrl.h" #include "ExListViewCtrl.h" +#include "ShellContextMenu.h" #include "WinUtil.h" #include "TextFrame.h" @@ -200,7 +201,32 @@ WinUtil::getContextMenuPos(ctrlList, pt); } - ctxMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, m_hWnd); + bool bShellMenuShown = false; + if(BOOLSETTING(SHOW_SHELL_MENU) && (ctrlList.GetSelectedCount() == 1)) { + tstring path = Text::toT(((FinishedItem*)ctrlList.GetItemData(ctrlList.GetSelectedIndex()))->getTarget()); + if(GetFileAttributes(path.c_str()) != 0xFFFFFFFF) { // Check that the file still exists + CShellContextMenu shellMenu; + shellMenu.SetPath(path); + + CMenu* pShellMenu = shellMenu.GetMenu(); + pShellMenu->AppendMenu(MF_STRING, IDC_VIEW_AS_TEXT, CTSTRING(VIEW_AS_TEXT)); + pShellMenu->AppendMenu(MF_STRING, IDC_OPEN_FOLDER, CTSTRING(OPEN_FOLDER)); + pShellMenu->AppendMenu(MF_SEPARATOR); + pShellMenu->AppendMenu(MF_STRING, IDC_REMOVE, CTSTRING(REMOVE)); + pShellMenu->AppendMenu(MF_STRING, IDC_TOTAL, CTSTRING(REMOVE_ALL)); + pShellMenu->AppendMenu(MF_SEPARATOR); + + UINT idCommand = shellMenu.ShowContextMenu(m_hWnd, pt); + if(idCommand != 0) + PostMessage(WM_COMMAND, idCommand); + + bShellMenuShown = true; + } + } + + if(!bShellMenuShown) + ctxMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, m_hWnd); + return TRUE; } bHandled = FALSE; Modified: dcplusplus/trunk/windows/HubFrame.cpp =================================================================== --- dcplusplus/trunk/windows/HubFrame.cpp 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/windows/HubFrame.cpp 2006-12-07 22:43:16 UTC (rev 685) @@ -143,6 +143,7 @@ MoveWindow(rc, TRUE); } + FavoriteManager::getInstance()->addListener(this); TimerManager::getInstance()->addListener(this); return 1; @@ -653,6 +654,7 @@ LRESULT HubFrame::onClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { if(!closed) { TimerManager::getInstance()->removeListener(this); + FavoriteManager::getInstance()->removeListener(this); client->removeListener(this); client->disconnect(true); @@ -1232,6 +1234,11 @@ } } +void HubFrame::resortUsers() { + for(FrameIter i = frames.begin(); i != frames.end(); ++i) + i->second->resortForFavsFirst(true); +} + void HubFrame::closeDisconnected() { for(FrameIter i=frames.begin(); i!= frames.end(); ++i) { if (!(i->second->client->isConnected())) { @@ -1240,6 +1247,20 @@ } } +void HubFrame::on(FavoriteManagerListener::UserAdded, const FavoriteUser& /*aUser*/) throw() { + resortForFavsFirst(); +} +void HubFrame::on(FavoriteManagerListener::UserRemoved, const FavoriteUser& /*aUser*/) throw() { + resortForFavsFirst(); +} + +void HubFrame::resortForFavsFirst(bool justDoIt /* = false */) { + if(justDoIt || BOOLSETTING(SORT_FAVUSERS_FIRST)) { + resort = true; + PostMessage(WM_SPEAKER); + } +} + void HubFrame::on(Second, uint32_t /*aTick*/) throw() { updateStatusBar(); if(updateUsers) { @@ -1265,7 +1286,7 @@ updateUsers = true; } -void HubFrame::on(UserRemoved, Client*, const OnlineUser& user) throw() { +void HubFrame::on(ClientListener::UserRemoved, Client*, const OnlineUser& user) throw() { speak(REMOVE_USER, user); } Modified: dcplusplus/trunk/windows/HubFrame.h =================================================================== --- dcplusplus/trunk/windows/HubFrame.h 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/windows/HubFrame.h 2006-12-07 22:43:16 UTC (rev 685) @@ -41,8 +41,8 @@ struct CompareItems; class HubFrame : public MDITabChildWindowImpl<HubFrame>, private ClientListener, - public CSplitterImpl<HubFrame>, private TimerManagerListener, public UCHandler<HubFrame>, - public UserInfoBaseHandler<HubFrame> + public CSplitterImpl<HubFrame>, private FavoriteManagerListener, private TimerManagerListener, + public UCHandler<HubFrame>, public UserInfoBaseHandler<HubFrame> { public: DECLARE_FRAME_WND_CLASS_EX(_T("HubFrame"), IDR_HUB, 0, COLOR_3DFACE); @@ -122,6 +122,7 @@ void runUserCommand(::UserCommand& uc); static void openWindow(const tstring& server); + static void resortUsers(); static void closeDisconnected(); LRESULT onSetFocus(UINT /* uMsg */, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { @@ -226,10 +227,19 @@ static int compareItems(const UserInfo* a, const UserInfo* b, int col) { if(col == COLUMN_NICK) { - if(a->getIdentity().isOp() && !b->getIdentity().isOp()) { + bool a_isOp = a->getIdentity().isOp(), + b_isOp = b->getIdentity().isOp(); + if(a_isOp && !b_isOp) return -1; - } else if(!a->getIdentity().isOp() && b->getIdentity().isOp()) { + if(!a_isOp && b_isOp) return 1; + if(BOOLSETTING(SORT_FAVUSERS_FIRST)) { + bool a_isFav = FavoriteManager::getInstance()->isFavoriteUser(a->getIdentity().getUser()), + b_isFav = FavoriteManager::getInstance()->isFavoriteUser(b->getIdentity().getUser()); + if(a_isFav && !b_isFav) + return -1; + if(!a_isFav && b_isFav) + return 1; } } if(col == COLUMN_SHARED) { @@ -384,6 +394,11 @@ void updateStatusBar() { if(m_hWnd) speak(STATS); } + // FavoriteManagerListener + virtual void on(FavoriteManagerListener::UserAdded, const FavoriteUser& /*aUser*/) throw(); + virtual void on(FavoriteManagerListener::UserRemoved, const FavoriteUser& /*aUser*/) throw(); + void resortForFavsFirst(bool justDoIt = false); + // TimerManagerListener virtual void on(TimerManagerListener::Second, uint32_t /*aTick*/) throw(); @@ -392,7 +407,7 @@ virtual void on(Connected, Client*) throw(); virtual void on(UserUpdated, Client*, const OnlineUser&) throw(); virtual void on(UsersUpdated, Client*, const OnlineUser::List&) throw(); - virtual void on(UserRemoved, Client*, const OnlineUser&) throw(); + virtual void on(ClientListener::UserRemoved, Client*, const OnlineUser&) throw(); virtual void on(Redirect, Client*, const string&) throw(); virtual void on(Failed, Client*, const string&) throw(); virtual void on(GetPassword, Client*) throw(); Modified: dcplusplus/trunk/windows/MainFrm.cpp =================================================================== --- dcplusplus/trunk/windows/MainFrm.cpp 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/windows/MainFrm.cpp 2006-12-07 22:43:16 UTC (rev 685) @@ -597,6 +597,8 @@ int lastConn = SETTING(INCOMING_CONNECTIONS); + bool lastSortFavUsersFirst = BOOLSETTING(SORT_FAVUSERS_FIRST); + if(dlg.DoModal(m_hWnd) == IDOK) { SettingsManager::getInstance()->save(); @@ -608,6 +610,9 @@ } ClientManager::getInstance()->infoUpdated(); + if(BOOLSETTING(SORT_FAVUSERS_FIRST) != lastSortFavUsersFirst) + HubFrame::resortUsers(); + if(BOOLSETTING(URL_HANDLER)) { WinUtil::registerDchubHandler(); WinUtil::registerADChubHandler(); Modified: dcplusplus/trunk/windows/SearchFrm.cpp =================================================================== --- dcplusplus/trunk/windows/SearchFrm.cpp 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/windows/SearchFrm.cpp 2006-12-07 22:43:16 UTC (rev 685) @@ -278,13 +278,20 @@ { Lock l(cs); search = StringTokenizer<tstring>(s, ' ').getTokens(); + s.clear(); + //strip out terms beginning with - + for(TStringList::iterator si = search.begin(); si != search.end(); ) { + if(si->empty()) { + si = search.erase(si); + continue; + } + if ((*si)[0] != _T('-')) + s += *si + _T(' '); + } + + s = s.substr(0, max(s.size(), static_cast<tstring::size_type>(1)) - 1); } - //strip out terms beginning with - - s.clear(); - for (TStringList::const_iterator si = search.begin(); si != search.end(); ++si) - if ((*si)[0] != _T('-')) s += *si + _T(' '); //Shouldn't get 0-length tokens, so safely assume at least a first char. - s = s.substr(0, max(s.size(), static_cast<tstring::size_type>(1)) - 1); SearchManager::SizeModes mode((SearchManager::SizeModes)ctrlMode.GetCurSel()); if(llsize == 0) Modified: dcplusplus/trunk/windows/resource.h =================================================================== --- dcplusplus/trunk/windows/resource.h 2006-11-02 21:44:12 UTC (rev 684) +++ dcplusplus/trunk/windows/resource.h 2006-12-07 22:43:16 UTC (rev 685) @@ -454,6 +454,8 @@ #define IDC_REMOVE_SOURCES 8000 #define IDC_DOWNLOAD_FAVORITE_DIRS 8500 #define IDC_DOWNLOAD_WHOLE_FAVORITE_DIRS 9000 +#define ID_SHELLCONTEXTMENU_MIN 10000 +#define ID_SHELLCONTEXTMENU_MAX 12000 #define ID_FILE_CONNECT 32772 #define ID_FILE_SETTINGS 32774 #define ID_FILE_RECONNECT 32775 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |