You can subscribe to this list here.
2006 |
Jan
|
Feb
(24) |
Mar
(9) |
Apr
(4) |
May
(7) |
Jun
(13) |
Jul
(19) |
Aug
(1) |
Sep
(12) |
Oct
(20) |
Nov
(1) |
Dec
(15) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(6) |
Mar
(24) |
Apr
(1) |
May
(10) |
Jun
(30) |
Jul
(46) |
Aug
(20) |
Sep
(12) |
Oct
(27) |
Nov
(51) |
Dec
(58) |
2008 |
Jan
(40) |
Feb
(40) |
Mar
(78) |
Apr
(138) |
May
(4) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
(2) |
Jul
(10) |
Aug
(1) |
Sep
(11) |
Oct
(31) |
Nov
(7) |
Dec
(1) |
2011 |
Jan
(1) |
Feb
|
Mar
(3) |
Apr
|
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
|
Nov
(2) |
Dec
(2) |
2013 |
Jan
(3) |
Feb
(5) |
Mar
(1) |
Apr
|
May
|
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
2014 |
Jan
(2) |
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <arn...@us...> - 2006-07-08 17:22:19
|
Revision: 626 Author: arnetheduck Date: 2006-07-08 10:21:56 -0700 (Sat, 08 Jul 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=626&view=rev Log Message: ----------- More minor fixes Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/BufferedSocket.cpp dcplusplus/trunk/client/BufferedSocket.h dcplusplus/trunk/client/CryptoManager.cpp dcplusplus/trunk/client/config.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-07-08 17:01:15 UTC (rev 625) +++ dcplusplus/trunk/changelog.txt 2006-07-08 17:21:56 UTC (rev 626) @@ -33,6 +33,7 @@ * Added a few TLS options; [U] in transfer status means untrusted TLS (encrypted but certificate not validated) * Added certificate generation, OpenSSL must be installed and in PATH for this to work * [bug 996] Fixed an issue where directories that are hard to delete were created +* [bug 1000] Fixed linux compile issue (thanks steven sheehy) -- 0.691 2006-06-03 -- * Links to bugzilla in html changelog Modified: dcplusplus/trunk/client/BufferedSocket.cpp =================================================================== --- dcplusplus/trunk/client/BufferedSocket.cpp 2006-07-08 17:01:15 UTC (rev 625) +++ dcplusplus/trunk/client/BufferedSocket.cpp 2006-07-08 17:21:56 UTC (rev 626) @@ -36,15 +36,15 @@ separator(aSeparator), mode(MODE_LINE), dataBytes(0), rollback(0), failed(false), sock(0), disconnecting(false), filterIn(NULL) { - sockets++; + Thread::safeInc(sockets); } -size_t BufferedSocket::sockets = 0; +volatile long BufferedSocket::sockets = 0; BufferedSocket::~BufferedSocket() throw() { delete sock; delete filterIn; - sockets--; + Thread::safeDec(sockets); } void BufferedSocket::setMode (Modes aMode, size_t aRollback) { @@ -74,22 +74,21 @@ void BufferedSocket::accept(const Socket& srv, bool secure, bool allowUntrusted) throw(SocketException, ThreadException) { dcassert(!sock); - - dcdebug("BufferedSocket::accept() %p\n", (void*)this); - sock = secure ? CryptoManager::getInstance()->getServerSocket(allowUntrusted) : new Socket; + try { + dcdebug("BufferedSocket::accept() %p\n", (void*)this); + sock = secure ? CryptoManager::getInstance()->getServerSocket(allowUntrusted) : new Socket; - sock->accept(srv); - if(SETTING(SOCKET_IN_BUFFER) > 0) - sock->setSocketOpt(SO_RCVBUF, SETTING(SOCKET_IN_BUFFER)); - if(SETTING(SOCKET_OUT_BUFFER) > 0) - sock->setSocketOpt(SO_SNDBUF, SETTING(SOCKET_OUT_BUFFER)); - sock->setBlocking(false); + sock->accept(srv); + if(SETTING(SOCKET_IN_BUFFER) > 0) + sock->setSocketOpt(SO_RCVBUF, SETTING(SOCKET_IN_BUFFER)); + if(SETTING(SOCKET_OUT_BUFFER) > 0) + sock->setSocketOpt(SO_SNDBUF, SETTING(SOCKET_OUT_BUFFER)); + sock->setBlocking(false); - inbuf.resize(sock->getSocketOptInt(SO_RCVBUF)); + inbuf.resize(sock->getSocketOptInt(SO_RCVBUF)); - // This lock prevents the shutdown task from being added and executed before we're done initializing the socket - Lock l(cs); - try { + // This lock prevents the shutdown task from being added and executed before we're done initializing the socket + Lock l(cs); start(); } catch(...) { delete sock; @@ -103,20 +102,20 @@ void BufferedSocket::connect(const string& aAddress, short aPort, bool secure, bool allowUntrusted, bool proxy) throw(SocketException, ThreadException) { dcassert(!sock); - dcdebug("BufferedSocket::connect() %p\n", (void*)this); - sock = secure ? CryptoManager::getInstance()->getClientSocket(allowUntrusted) : new Socket; + try { + dcdebug("BufferedSocket::connect() %p\n", (void*)this); + sock = secure ? CryptoManager::getInstance()->getClientSocket(allowUntrusted) : new Socket; - sock->create(); - if(SETTING(SOCKET_IN_BUFFER) >= 1024) - sock->setSocketOpt(SO_RCVBUF, SETTING(SOCKET_IN_BUFFER)); - if(SETTING(SOCKET_OUT_BUFFER) >= 1024) - sock->setSocketOpt(SO_SNDBUF, SETTING(SOCKET_OUT_BUFFER)); - sock->setBlocking(false); + sock->create(); + if(SETTING(SOCKET_IN_BUFFER) >= 1024) + sock->setSocketOpt(SO_RCVBUF, SETTING(SOCKET_IN_BUFFER)); + if(SETTING(SOCKET_OUT_BUFFER) >= 1024) + sock->setSocketOpt(SO_SNDBUF, SETTING(SOCKET_OUT_BUFFER)); + sock->setBlocking(false); - inbuf.resize(sock->getSocketOptInt(SO_RCVBUF)); + inbuf.resize(sock->getSocketOptInt(SO_RCVBUF)); - Lock l(cs); - try { + Lock l(cs); start(); } catch(...) { delete sock; Modified: dcplusplus/trunk/client/BufferedSocket.h =================================================================== --- dcplusplus/trunk/client/BufferedSocket.h 2006-07-08 17:01:15 UTC (rev 625) +++ dcplusplus/trunk/client/BufferedSocket.h 2006-07-08 17:21:56 UTC (rev 626) @@ -174,7 +174,7 @@ void threadDisconnect(); void fail(const string& aError); - static size_t sockets; + static volatile long sockets; bool checkEvents(); void checkSocket(); Modified: dcplusplus/trunk/client/CryptoManager.cpp =================================================================== --- dcplusplus/trunk/client/CryptoManager.cpp 2006-07-08 17:01:15 UTC (rev 625) +++ dcplusplus/trunk/client/CryptoManager.cpp 2006-07-08 17:21:56 UTC (rev 626) @@ -70,6 +70,7 @@ dh = 0; } else { SSL_CTX_set_tmp_dh(serverContext, dh); + SSL_CTX_set_tmp_dh(serverVerContext, dh); } } } @@ -79,6 +80,10 @@ SSL_CTX_free(serverContext); if(clientContext) SSL_CTX_free(clientContext); + if(serverVerContext) + SSL_CTX_free(serverVerContext); + if(clientVerContext) + SSL_CTX_free(clientVerContext); if(dh) DH_free(dh); } @@ -194,6 +199,15 @@ if(SSL_CTX_load_verify_locations(clientContext, (SETTING(TLS_TRUSTED_CERTIFICATES_PATH) + Text::fromT(data.cFileName)).c_str(), NULL) != SSL_SUCCESS) { LogManager::getInstance()->message("Failed to load trusted certificate from " + Text::fromT(data.cFileName)); } + if(SSL_CTX_load_verify_locations(clientVerContext, (SETTING(TLS_TRUSTED_CERTIFICATES_PATH) + Text::fromT(data.cFileName)).c_str(), NULL) != SSL_SUCCESS) { + LogManager::getInstance()->message("Failed to load trusted certificate from " + Text::fromT(data.cFileName)); + } + if(SSL_CTX_load_verify_locations(serverContext, (SETTING(TLS_TRUSTED_CERTIFICATES_PATH) + Text::fromT(data.cFileName)).c_str(), NULL) != SSL_SUCCESS) { + LogManager::getInstance()->message("Failed to load trusted certificate from " + Text::fromT(data.cFileName)); + } + if(SSL_CTX_load_verify_locations(serverVerContext, (SETTING(TLS_TRUSTED_CERTIFICATES_PATH) + Text::fromT(data.cFileName)).c_str(), NULL) != SSL_SUCCESS) { + LogManager::getInstance()->message("Failed to load trusted certificate from " + Text::fromT(data.cFileName)); + } } while(FindNextFile(hFind, &data)); FindClose(hFind); Modified: dcplusplus/trunk/client/config.h =================================================================== --- dcplusplus/trunk/client/config.h 2006-07-08 17:01:15 UTC (rev 625) +++ dcplusplus/trunk/client/config.h 2006-07-08 17:21:56 UTC (rev 626) @@ -27,10 +27,6 @@ #include "autoconf.h" #endif -// Changing this number will change the maximum number of simultaneous users -// we can handle (when using select)... -#define FD_SETSIZE 4096 - // Remove this line if hashes are not available in your stl #define HAVE_HASH 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-07-08 17:02:20
|
Revision: 625 Author: arnetheduck Date: 2006-07-08 10:01:15 -0700 (Sat, 08 Jul 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=625&view=rev Log Message: ----------- SSL fixes Modified Paths: -------------- dcplusplus/trunk/DCPlusPlus.rc dcplusplus/trunk/Example.xml dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/BufferedSocket.cpp dcplusplus/trunk/client/BufferedSocket.h dcplusplus/trunk/client/Client.cpp dcplusplus/trunk/client/CryptoManager.cpp dcplusplus/trunk/client/CryptoManager.h dcplusplus/trunk/client/HttpConnection.cpp dcplusplus/trunk/client/SSLSocket.cpp dcplusplus/trunk/client/SettingsManager.cpp dcplusplus/trunk/client/ShareManager.cpp dcplusplus/trunk/client/StringDefs.cpp dcplusplus/trunk/client/StringDefs.h dcplusplus/trunk/client/UserConnection.cpp dcplusplus/trunk/client/Util.cpp dcplusplus/trunk/windows/CertificatesPage.cpp dcplusplus/trunk/windows/CertificatesPage.h dcplusplus/trunk/windows/resource.h dcplusplus/trunk/yassl/src/ssl.cpp Modified: dcplusplus/trunk/DCPlusPlus.rc =================================================================== --- dcplusplus/trunk/DCPlusPlus.rc 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/DCPlusPlus.rc 2006-07-08 17:01:15 UTC (rev 625) @@ -681,9 +681,9 @@ CAPTION "Security Certificates" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - EDITTEXT IDC_TLS_PRIVATE_KEY_FILE,102,7,166,14,ES_AUTOHSCROLL - EDITTEXT IDC_TLS_CERTIFICATE_FILE,102,24,166,14,ES_AUTOHSCROLL - EDITTEXT IDC_TLS_TRUSTED_CERTIFICATES_PATH,102,42,166,14, + EDITTEXT IDC_TLS_PRIVATE_KEY_FILE,102,7,141,14,ES_AUTOHSCROLL + EDITTEXT IDC_TLS_CERTIFICATE_FILE,102,24,141,14,ES_AUTOHSCROLL + EDITTEXT IDC_TLS_TRUSTED_CERTIFICATES_PATH,102,42,141,14, ES_AUTOHSCROLL LTEXT "Private key file",IDC_STATIC,50,10,48,8 LTEXT "Own certificate file",IDC_STATIC,37,27,61,8 @@ -694,7 +694,11 @@ IDC_STATIC,7,201,200,8 CONTROL "",IDC_TLS_OPTIONS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | - LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,15,72,243,90 + LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,89,261,90 + PUSHBUTTON "Generate certificates",IDC_GENERATE_CERTS,184,62,84,14 + PUSHBUTTON "...",IDC_BROWSE_PRIVATE_KEY,247,7,21,14 + PUSHBUTTON "...",IDC_BROWSE_CERTIFICATE,247,24,21,14 + PUSHBUTTON "...",IDC_BROWSE_TRUSTED_PATH,248,42,20,14 END Modified: dcplusplus/trunk/Example.xml =================================================================== --- dcplusplus/trunk/Example.xml 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/Example.xml 2006-07-08 17:01:15 UTC (rev 625) @@ -41,6 +41,7 @@ <String Name="BrowseAccel">&Browse...</String> <String Name="BrowseFileList">Browse file list</String> <String Name="CertificateNotTrusted">Certificate not trusted, unable to connect</String> + <String Name="CertificateGenerationFailed">TLS disabled, failed to generate certificate: </String> <String Name="ChooseFolder">Choose folder</String> <String Name="Cid">CID</String> <String Name="Close">Close</String> @@ -117,6 +118,8 @@ <String Name="ErrorSavingHash">Error saving hash data: </String> <String Name="ExactSize">Exact size</String> <String Name="Executable">Executable</String> + <String Name="FailedToLoadCertificate">Failed to load certificate file</String> + <String Name="FailedToLoadPrivateKey">Failed to load private key</String> <String Name="FavJoinShowingOff">Join/part of favorite users showing off</String> <String Name="FavJoinShowingOn">Join/part of favorite users showing on</String> <String Name="FavoriteDirName">Favorite name</String> @@ -288,14 +291,15 @@ <String Name="Nick">Nick</String> <String Name="NickTaken">Your nick was already taken, please change to something else!</String> <String Name="NickUnknown"> (Nick unknown)</String> + <String Name="NoCertificateFileSet">TLS disabled, no certificate file set</String> <String Name="NoCrc32Match"> not shared; calculated CRC32 does not match the one found in SFV file.</String> - <String Name="NoStr">No</String> <String Name="NoDirectorySpecified">No directory specified</String> <String Name="NoDownloadsFromSelf">You're trying to download from yourself!</String> <String Name="NoDownloadsFromPassive">Can't download from passive users when you're passive</String> <String Name="NoErrors">No errors</String> <String Name="NoMatches">No matches</String> <String Name="NoSlotsAvailable">No slots available</String> + <String Name="NoStr">No</String> <String Name="NoUsers">No users</String> <String Name="NoUsersToDownloadFrom">No users to download from</String> <String Name="Normal">Normal</String> @@ -372,7 +376,7 @@ <String Name="SettingsAdvanced3">Advanced\Experts only</String> <String Name="SettingsAdvancedResume">Advanced resume using TTH</String> <String Name="SettingsAdvancedSettings">Advanced settings</String> - <String Name="SettingsAllowUntrustedClients">Allow TLS connections to hubs without trusted certificate</String> + <String Name="SettingsAllowUntrustedClients">Allow TLS connections to clients without trusted certificate</String> <String Name="SettingsAllowUntrustedHubs">Allow TLS connections to hubs without trusted certificate</String> <String Name="SettingsAntiFrag">Use antifragmentation method for downloads</String> <String Name="SettingsAppearance">Appearance</String> Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/changelog.txt 2006-07-08 17:01:15 UTC (rev 625) @@ -31,6 +31,8 @@ * Added protection from hubs/clients sending junk data resulting in high memory usage / crash * Updated to yaSSL 1.3.7 * Added a few TLS options; [U] in transfer status means untrusted TLS (encrypted but certificate not validated) +* Added certificate generation, OpenSSL must be installed and in PATH for this to work +* [bug 996] Fixed an issue where directories that are hard to delete were created -- 0.691 2006-06-03 -- * Links to bugzilla in html changelog Modified: dcplusplus/trunk/client/BufferedSocket.cpp =================================================================== --- dcplusplus/trunk/client/BufferedSocket.cpp 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/client/BufferedSocket.cpp 2006-07-08 17:01:15 UTC (rev 625) @@ -72,11 +72,11 @@ } } -void BufferedSocket::accept(const Socket& srv, bool secure) throw(SocketException, ThreadException) { +void BufferedSocket::accept(const Socket& srv, bool secure, bool allowUntrusted) throw(SocketException, ThreadException) { dcassert(!sock); dcdebug("BufferedSocket::accept() %p\n", (void*)this); - sock = secure ? CryptoManager::getInstance()->getClientSocket() : new Socket; + sock = secure ? CryptoManager::getInstance()->getServerSocket(allowUntrusted) : new Socket; sock->accept(srv); if(SETTING(SOCKET_IN_BUFFER) > 0) @@ -100,11 +100,11 @@ addTask(ACCEPTED, 0); } -void BufferedSocket::connect(const string& aAddress, short aPort, bool secure, bool proxy) throw(SocketException, ThreadException) { +void BufferedSocket::connect(const string& aAddress, short aPort, bool secure, bool allowUntrusted, bool proxy) throw(SocketException, ThreadException) { dcassert(!sock); dcdebug("BufferedSocket::connect() %p\n", (void*)this); - sock = secure ? CryptoManager::getInstance()->getClientSocket() : new Socket; + sock = secure ? CryptoManager::getInstance()->getClientSocket(allowUntrusted) : new Socket; sock->create(); if(SETTING(SOCKET_IN_BUFFER) >= 1024) Modified: dcplusplus/trunk/client/BufferedSocket.h =================================================================== --- dcplusplus/trunk/client/BufferedSocket.h 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/client/BufferedSocket.h 2006-07-08 17:01:15 UTC (rev 625) @@ -86,8 +86,8 @@ Thread::sleep(100); } - void accept(const Socket& srv, bool secure) throw(SocketException, ThreadException); - void connect(const string& aAddress, short aPort, bool secure, bool proxy) throw(SocketException, ThreadException); + void accept(const Socket& srv, bool secure, bool allowUntrusted) throw(SocketException, ThreadException); + void connect(const string& aAddress, short aPort, bool secure, bool allowUntrusted, bool proxy) throw(SocketException, ThreadException); /** Sets data mode for aBytes bytes. Must be called within onLine. */ void setDataMode(int64_t aBytes = -1) { mode = MODE_DATA; dataBytes = aBytes; } Modified: dcplusplus/trunk/client/Client.cpp =================================================================== --- dcplusplus/trunk/client/Client.cpp 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/client/Client.cpp 2006-07-08 17:01:15 UTC (rev 625) @@ -97,7 +97,7 @@ try { socket = BufferedSocket::getSocket(separator); socket->addListener(this); - socket->connect(address, port, secure, true); + socket->connect(address, port, secure, BOOLSETTING(ALLOW_UNTRUSTED_HUBS), true); } catch(const Exception& e) { if(socket) { BufferedSocket::putSocket(socket); @@ -109,12 +109,6 @@ } void Client::on(Connected) throw() { - if(socket->isSecure() && !socket->isTrusted() && !BOOLSETTING(ALLOW_UNTRUSTED_HUBS)) { - fire(ClientListener::StatusMessage(), this, STRING(CERTIFICATE_NOT_TRUSTED)); - disconnect(true); - return; - } - updateActivity(); ip = socket->getIp(); fire(ClientListener::Connected(), this); Modified: dcplusplus/trunk/client/CryptoManager.cpp =================================================================== --- dcplusplus/trunk/client/CryptoManager.cpp 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/client/CryptoManager.cpp 2006-07-08 17:01:15 UTC (rev 625) @@ -25,6 +25,7 @@ #include "BitOutputStream.h" #include "ResourceManager.h" #include "LogManager.h" +#include "ClientManager.h" #include <openssl/ssl.h> @@ -38,6 +39,8 @@ : 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"), @@ -84,64 +87,103 @@ return BOOLSETTING(USE_TLS) && certsLoaded; } -bool CryptoManager::generateCertificate() throw() { +void CryptoManager::generateCertificate() throw(CryptoException) { #ifdef _WIN32 // Generate certificate using OpenSSL if(SETTING(TLS_PRIVATE_KEY_FILE).empty()) { - return false; + throw CryptoException("No private key file chosen"); } - wstring cmd = L"openssl.exe -out \"" + Text::utf8ToWide(SETTING(TLS_PRIVATE_KEY_FILE)) + L"\" 2048"; + if(SETTING(TLS_CERTIFICATE_FILE).empty()) { + throw CryptoException("No certificate file chosen"); + } + wstring cmd = L"openssl.exe genrsa -out \"" + Text::utf8ToWide(SETTING(TLS_PRIVATE_KEY_FILE)) + L"\" 2048"; PROCESS_INFORMATION pi = { 0 }; STARTUPINFO si = { 0 }; si.cb = sizeof(si); - if(!CreateProcess(L"openssl.exe", const_cast<wchar_t*>(cmd.c_str()), 0, 0, FALSE, 0, 0, 0, 0, &pi)) { - return false; + if(!CreateProcess(0, const_cast<wchar_t*>(cmd.c_str()), 0, 0, FALSE, 0, 0, 0, &si, &pi)) { + throw CryptoException(Util::translateError(::GetLastError())); } WaitForSingleObject(pi.hProcess, INFINITE); CloseHandle(pi.hThread); CloseHandle(pi.hProcess); - cmd = L"openssl.exe x509 -x509 -new -batch -key \"" + Text::utf8ToWide(SETTING(TLS_PRIVATE_KEY_FILE)) + - L"\" -out \"" + Text::utf8ToWide(SETTING(TLS_CERTIFICATE_FILE)) + L"\""; + cmd = L"openssl.exe req -x509 -new -batch -days 3650 -key \"" + Text::utf8ToWide(SETTING(TLS_PRIVATE_KEY_FILE)) + + L"\" -out \"" + Text::utf8ToWide(SETTING(TLS_CERTIFICATE_FILE)) + L"\" -subj \"/CN=" + + Text::utf8ToWide(ClientManager::getInstance()->getMyCID().toBase32()) + L"\""; - if(!CreateProcess(L"openssl.exe", const_cast<wchar_t*>(cmd.c_str()), 0, 0, FALSE, 0, 0, 0, 0, &pi)) { - return false; + if(!CreateProcess(0, const_cast<wchar_t*>(cmd.c_str()), 0, 0, FALSE, 0, 0, 0, &si, &pi)) { + throw CryptoException(Util::translateError(::GetLastError())); } WaitForSingleObject(pi.hProcess, INFINITE); CloseHandle(pi.hThread); CloseHandle(pi.hProcess); #endif - return true; } void CryptoManager::loadCertificates() throw() { + if(!BOOLSETTING(USE_TLS)) + return; + SSL_CTX_set_verify(serverContext, SSL_VERIFY_NONE, 0); SSL_CTX_set_verify(clientContext, SSL_VERIFY_NONE, 0); + SSL_CTX_set_verify(clientVerContext, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, 0); + SSL_CTX_set_verify(serverVerContext, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, 0); - if(!SETTING(TLS_CERTIFICATE_FILE).empty()) { - if(SSL_CTX_use_certificate_file(serverContext, SETTING(TLS_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { - LogManager::getInstance()->message("Failed to load certificate file"); - return; - } - if(SSL_CTX_use_certificate_file(clientContext, SETTING(TLS_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { - LogManager::getInstance()->message("Failed to load certificate file"); - return; - } + const string& cert = SETTING(TLS_CERTIFICATE_FILE); + const string& key = SETTING(TLS_PRIVATE_KEY_FILE); + + if(cert.empty() || key.empty()) { + LogManager::getInstance()->message(STRING(NO_CERTIFICATE_FILE_SET)); + return; } - if(!SETTING(TLS_PRIVATE_KEY_FILE).empty()) { - if(SSL_CTX_use_PrivateKey_file(serverContext, SETTING(TLS_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { - LogManager::getInstance()->message("Failed to load private key"); - return; + if(File::getSize(cert) == -1 || File::getSize(key) == -1) { + // Try to generate them... + try { + generateCertificate(); + } catch(const CryptoException& e) { + LogManager::getInstance()->message(STRING(CERTIFICATE_GENERATION_FAILED) + e.getError()); } - if(SSL_CTX_use_PrivateKey_file(clientContext, SETTING(TLS_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { - LogManager::getInstance()->message("Failed to load private key"); - return; - } } + if(SSL_CTX_use_certificate_file(serverContext, SETTING(TLS_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { + LogManager::getInstance()->message(STRING(FAILED_TO_LOAD_CERTIFICATE)); + return; + } + if(SSL_CTX_use_certificate_file(clientContext, SETTING(TLS_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { + LogManager::getInstance()->message(STRING(FAILED_TO_LOAD_CERTIFICATE)); + return; + } + + if(SSL_CTX_use_certificate_file(serverVerContext, SETTING(TLS_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { + LogManager::getInstance()->message(STRING(FAILED_TO_LOAD_CERTIFICATE)); + return; + } + if(SSL_CTX_use_certificate_file(clientVerContext, SETTING(TLS_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { + LogManager::getInstance()->message(STRING(FAILED_TO_LOAD_CERTIFICATE)); + return; + } + + if(SSL_CTX_use_PrivateKey_file(serverContext, SETTING(TLS_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { + LogManager::getInstance()->message(STRING(FAILED_TO_LOAD_PRIVATE_KEY)); + return; + } + if(SSL_CTX_use_PrivateKey_file(clientContext, SETTING(TLS_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { + LogManager::getInstance()->message(STRING(FAILED_TO_LOAD_PRIVATE_KEY)); + return; + } + + if(SSL_CTX_use_PrivateKey_file(serverVerContext, SETTING(TLS_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { + LogManager::getInstance()->message(STRING(FAILED_TO_LOAD_PRIVATE_KEY)); + return; + } + if(SSL_CTX_use_PrivateKey_file(clientVerContext, SETTING(TLS_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { + LogManager::getInstance()->message(STRING(FAILED_TO_LOAD_PRIVATE_KEY)); + return; + } + #ifdef _WIN32 WIN32_FIND_DATA data; HANDLE hFind; @@ -163,11 +205,11 @@ } -SSLSocket* CryptoManager::getClientSocket() throw(SocketException) { - return new SSLSocket(clientContext); +SSLSocket* CryptoManager::getClientSocket(bool allowUntrusted) throw(SocketException) { + return new SSLSocket(allowUntrusted ? clientContext : clientVerContext); } -SSLSocket* CryptoManager::getServerSocket() throw(SocketException) { - return new SSLSocket(serverContext); +SSLSocket* CryptoManager::getServerSocket(bool allowUntrusted) throw(SocketException) { + return new SSLSocket(allowUntrusted ? serverContext : serverVerContext); } Modified: dcplusplus/trunk/client/CryptoManager.h =================================================================== --- dcplusplus/trunk/client/CryptoManager.h 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/client/CryptoManager.h 2006-07-08 17:01:15 UTC (rev 625) @@ -81,11 +81,11 @@ void decodeHuffman(const u_int8_t* /*is*/, string& /*os*/, const size_t /*len*/) throw(CryptoException); void decodeBZ2(const u_int8_t* is, size_t sz, string& os) throw(CryptoException); - SSLSocket* getClientSocket() throw(SocketException); - SSLSocket* getServerSocket() throw(SocketException); + SSLSocket* getClientSocket(bool allowUntrusted) throw(SocketException); + SSLSocket* getServerSocket(bool allowUntrusted) throw(SocketException); void loadCertificates() throw(); - bool generateCertificate() throw(); + void generateCertificate() throw(CryptoException); bool TLSOk() const throw(); private: @@ -118,7 +118,10 @@ }; SSL_CTX* clientContext; + SSL_CTX* clientVerContext; SSL_CTX* serverContext; + SSL_CTX* serverVerContext; + DH* dh; bool certsLoaded; Modified: dcplusplus/trunk/client/HttpConnection.cpp =================================================================== --- dcplusplus/trunk/client/HttpConnection.cpp 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/client/HttpConnection.cpp 2006-07-08 17:01:15 UTC (rev 625) @@ -68,7 +68,7 @@ } socket->addListener(this); try { - socket->connect(server, port, false, false); + socket->connect(server, port, false, false, false); } catch(const Exception& e) { fire(HttpConnectionListener::Failed(), this, e.getError() + " (" + currentUrl + ")"); } Modified: dcplusplus/trunk/client/SSLSocket.cpp =================================================================== --- dcplusplus/trunk/client/SSLSocket.cpp 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/client/SSLSocket.cpp 2006-07-08 17:01:15 UTC (rev 625) @@ -114,9 +114,9 @@ int SSLSocket::wait(u_int32_t millis, int waitFor) throw(SocketException) { if(ssl && (waitFor & Socket::WAIT_READ)) { /** @todo Take writing into account as well if reading is possible? */ -// if(SSL_pending(ssl) > 0) -// return WAIT_READ; - // doesn't work in yassl...sigh... + char c; + if(SSL_peek(ssl, &c, 1) > 0) + return WAIT_READ; } return Socket::wait(millis, waitFor); } Modified: dcplusplus/trunk/client/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/client/SettingsManager.cpp 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/client/SettingsManager.cpp 2006-07-08 17:01:15 UTC (rev 625) @@ -44,7 +44,7 @@ "FinishedULWidths", "FinishedULOrder", "CID", "SpyFrameWidths", "SpyFrameOrder", "LogFileMainChat", "LogFilePrivateChat", "LogFileStatus", "LogFileUpload", "LogFileDownload", "LogFileSystem", "LogFormatSystem", "LogFormatStatus", "DirectoryListingFrameOrder", "DirectoryListingFrameWidths", - "SslPrivateKeyFile", "SslCertificateFile", "SslTrustedCertificatesPath", + "TLSPrivateKeyFile", "TLSCertificateFile", "TLSTrustedCertificatesPath", "SENTRY", // Ints "IncomingConnections", "InPort", "Slots", "Rollback", "AutoFollow", "ClearSearch", @@ -73,8 +73,9 @@ "NoIpOverride", "SearchOnlyFreeSlots", "LastSearchType", "BoldFinishedDownloads", "BoldFinishedUploads", "BoldQueue", "BoldHub", "BoldPm", "BoldSearch", "SocketInBuffer", "SocketOutBuffer", "OnlyDlTthFiles", "OpenWaitingUsers", "BoldWaitingUsers", "OpenSystemLog", "BoldSystemLog", "AutoRefreshTime", - "UseSsl", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", "PromptPassword", "SpyFrameIgnoreTthSearches", + "UseTLS", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", "PromptPassword", "SpyFrameIgnoreTthSearches", "DontDlAlreadyQueued", "MaxCommandLength", "AllowUntrustedHubs", "AllowUntrustedClients", + "TLSPort", "SENTRY", // Int64 "TotalUpload", "TotalDownload", @@ -244,6 +245,8 @@ setDefault(OPEN_WAITING_USERS, false); setDefault(OPEN_SYSTEM_LOG, true); setDefault(TLS_TRUSTED_CERTIFICATES_PATH, Util::getConfigPath() + "Certificates" PATH_SEPARATOR_STR); + setDefault(TLS_PRIVATE_KEY_FILE, Util::getConfigPath() + "Certificates" PATH_SEPARATOR_STR "client.key"); + setDefault(TLS_CERTIFICATE_FILE, Util::getConfigPath() + "Certificates" PATH_SEPARATOR_STR "client.crt"); setDefault(BOLD_FINISHED_DOWNLOADS, true); setDefault(BOLD_FINISHED_UPLOADS, true); setDefault(BOLD_QUEUE, true); @@ -361,6 +364,8 @@ set(PRIVATE_ID, CID::generate().toBase32()); #endif setDefault(UDP_PORT, SETTING(TCP_PORT)); + + File::ensureDirectory(SETTING(TLS_TRUSTED_CERTIFICATES_PATH)); fire(SettingsManagerListener::Load(), &xml); Modified: dcplusplus/trunk/client/ShareManager.cpp =================================================================== --- dcplusplus/trunk/client/ShareManager.cpp 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/client/ShareManager.cpp 2006-07-08 17:01:15 UTC (rev 625) @@ -695,6 +695,9 @@ int64_t size = i->getSize(); string fileName = aName + name; + if(Util::stricmp(fileName, SETTING(TLS_PRIVATE_KEY_FILE)) == 0) { + continue; + } try { if(HashManager::getInstance()->checkTTH(fileName, size, i->getLastWriteTime())) lastFileIter = dir->files.insert(lastFileIter, Directory::File(name, size, dir, HashManager::getInstance()->getTTH(fileName, size))); Modified: dcplusplus/trunk/client/StringDefs.cpp =================================================================== --- dcplusplus/trunk/client/StringDefs.cpp 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/client/StringDefs.cpp 2006-07-08 17:01:15 UTC (rev 625) @@ -42,6 +42,7 @@ "&Browse...", "Browse file list", "Certificate not trusted, unable to connect", +"TLS disabled, failed to generate certificate: ", "Choose folder", "CID", "Close", @@ -118,6 +119,8 @@ "Error saving hash data: ", "Exact size", "Executable", +"Failed to load certificate file", +"Failed to load private key", "Join/part of favorite users showing off", "Join/part of favorite users showing on", "Favorite name", @@ -289,14 +292,15 @@ "Nick", "Your nick was already taken, please change to something else!", " (Nick unknown)", +"TLS disabled, no certificate file set", " not shared; calculated CRC32 does not match the one found in SFV file.", -"No", "No directory specified", "You're trying to download from yourself!", "Can't download from passive users when you're passive", "No errors", "No matches", "No slots available", +"No", "No users", "No users to download from", "Normal", @@ -373,8 +377,8 @@ "Advanced\\Experts only", "Advanced resume using TTH", "Advanced settings", +"Allow TLS connections to clients without trusted certificate", "Allow TLS connections to hubs without trusted certificate", -"Allow TLS connections to hubs without trusted certificate", "Use antifragmentation method for downloads", "Appearance", "Appearance\\Colors and sounds", @@ -659,6 +663,7 @@ "BrowseAccel", "BrowseFileList", "CertificateNotTrusted", +"CertificateGenerationFailed", "ChooseFolder", "Cid", "Close", @@ -735,6 +740,8 @@ "ErrorSavingHash", "ExactSize", "Executable", +"FailedToLoadCertificate", +"FailedToLoadPrivateKey", "FavJoinShowingOff", "FavJoinShowingOn", "FavoriteDirName", @@ -906,14 +913,15 @@ "Nick", "NickTaken", "NickUnknown", +"NoCertificateFileSet", "NoCrc32Match", -"NoStr", "NoDirectorySpecified", "NoDownloadsFromSelf", "NoDownloadsFromPassive", "NoErrors", "NoMatches", "NoSlotsAvailable", +"NoStr", "NoUsers", "NoUsersToDownloadFrom", "Normal", Modified: dcplusplus/trunk/client/StringDefs.h =================================================================== --- dcplusplus/trunk/client/StringDefs.h 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/client/StringDefs.h 2006-07-08 17:01:15 UTC (rev 625) @@ -45,6 +45,7 @@ BROWSE_ACCEL, // "&Browse..." BROWSE_FILE_LIST, // "Browse file list" CERTIFICATE_NOT_TRUSTED, // "Certificate not trusted, unable to connect" + CERTIFICATE_GENERATION_FAILED, // "TLS disabled, failed to generate certificate: " CHOOSE_FOLDER, // "Choose folder" CID, // "CID" CLOSE, // "Close" @@ -121,6 +122,8 @@ ERROR_SAVING_HASH, // "Error saving hash data: " EXACT_SIZE, // "Exact size" EXECUTABLE, // "Executable" + FAILED_TO_LOAD_CERTIFICATE, // "Failed to load certificate file" + FAILED_TO_LOAD_PRIVATE_KEY, // "Failed to load private key" FAV_JOIN_SHOWING_OFF, // "Join/part of favorite users showing off" FAV_JOIN_SHOWING_ON, // "Join/part of favorite users showing on" FAVORITE_DIR_NAME, // "Favorite name" @@ -292,14 +295,15 @@ NICK, // "Nick" NICK_TAKEN, // "Your nick was already taken, please change to something else!" NICK_UNKNOWN, // " (Nick unknown)" + NO_CERTIFICATE_FILE_SET, // "TLS disabled, no certificate file set" NO_CRC32_MATCH, // " not shared; calculated CRC32 does not match the one found in SFV file." - NO_STR, // "No" NO_DIRECTORY_SPECIFIED, // "No directory specified" NO_DOWNLOADS_FROM_SELF, // "You're trying to download from yourself!" NO_DOWNLOADS_FROM_PASSIVE, // "Can't download from passive users when you're passive" NO_ERRORS, // "No errors" NO_MATCHES, // "No matches" NO_SLOTS_AVAILABLE, // "No slots available" + NO_STR, // "No" NO_USERS, // "No users" NO_USERS_TO_DOWNLOAD_FROM, // "No users to download from" NORMAL, // "Normal" @@ -376,7 +380,7 @@ SETTINGS_ADVANCED3, // "Advanced\\Experts only" SETTINGS_ADVANCED_RESUME, // "Advanced resume using TTH" SETTINGS_ADVANCED_SETTINGS, // "Advanced settings" - SETTINGS_ALLOW_UNTRUSTED_CLIENTS, // "Allow TLS connections to hubs without trusted certificate" + SETTINGS_ALLOW_UNTRUSTED_CLIENTS, // "Allow TLS connections to clients without trusted certificate" SETTINGS_ALLOW_UNTRUSTED_HUBS, // "Allow TLS connections to hubs without trusted certificate" SETTINGS_ANTI_FRAG, // "Use antifragmentation method for downloads" SETTINGS_APPEARANCE, // "Appearance" Modified: dcplusplus/trunk/client/UserConnection.cpp =================================================================== --- dcplusplus/trunk/client/UserConnection.cpp 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/client/UserConnection.cpp 2006-07-08 17:01:15 UTC (rev 625) @@ -181,14 +181,14 @@ socket = BufferedSocket::getSocket(0); socket->addListener(this); - socket->connect(aServer, aPort, secure, true); + socket->connect(aServer, aPort, secure, BOOLSETTING(ALLOW_UNTRUSTED_CLIENTS), true); } void UserConnection::accept(const Socket& aServer) throw(SocketException, ThreadException) { dcassert(!socket); socket = BufferedSocket::getSocket(0); socket->addListener(this); - socket->accept(aServer, secure); + socket->accept(aServer, secure, BOOLSETTING(ALLOW_UNTRUSTED_CLIENTS)); } void UserConnection::inf(bool withToken) { Modified: dcplusplus/trunk/client/Util.cpp =================================================================== --- dcplusplus/trunk/client/Util.cpp 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/client/Util.cpp 2006-07-08 17:01:15 UTC (rev 625) @@ -248,6 +248,19 @@ i += 2; } + // Dots at the end of path names aren't popular + i = 0; + while( ((i = tmp.find(".\\", i)) != string::npos) ) { + tmp[i] = '_'; + i += 1; + } + i = 0; + while( ((i = tmp.find("./", i)) != string::npos) ) { + tmp[i] = '_'; + i += 1; + } + + return tmp; } Modified: dcplusplus/trunk/windows/CertificatesPage.cpp =================================================================== --- dcplusplus/trunk/windows/CertificatesPage.cpp 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/windows/CertificatesPage.cpp 2006-07-08 17:01:15 UTC (rev 625) @@ -25,6 +25,7 @@ #include "../client/SettingsManager.h" #include "../client/FavoriteManager.h" +#include "../client/CryptoManager.h" #include "WinUtil.h" @@ -67,3 +68,42 @@ HtmlHelp(m_hWnd, WinUtil::getHelpFile().c_str(), HH_HELP_CONTEXT, IDD_CERTIFICATESPAGE); return 0; } + +LRESULT CertificatesPage::onBrowsePrivateKey(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { + tstring target = Text::toT(SETTING(TLS_PRIVATE_KEY_FILE)); + CEdit edt(GetDlgItem(IDC_TLS_PRIVATE_KEY_FILE)); + + if(WinUtil::browseFile(target, m_hWnd, false, target)) { + edt.SetWindowText(&target[0]); + } + return 0; +} + +LRESULT CertificatesPage::onBrowseCertificate(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { + tstring target = Text::toT(SETTING(TLS_CERTIFICATE_FILE)); + CEdit edt(GetDlgItem(IDC_TLS_CERTIFICATE_FILE)); + + if(WinUtil::browseFile(target, m_hWnd, false, target)) { + edt.SetWindowText(&target[0]); + } + return 0; +} + +LRESULT CertificatesPage::onBrowseTrustedPath(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { + tstring target = Text::toT(SETTING(TLS_TRUSTED_CERTIFICATES_PATH)); + CEdit edt(GetDlgItem(IDC_TLS_TRUSTED_CERTIFICATES_PATH)); + + if(WinUtil::browseDirectory(target, m_hWnd)) { + edt.SetWindowText(&target[0]); + } + return 0; +} + +LRESULT CertificatesPage::onGenerateCerts(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { + try { + CryptoManager::getInstance()->generateCertificate(); + } catch(const CryptoException& e) { + MessageBox(Text::toT(e.getError()).c_str(), L"Error generating certificate"); + } + return 0; +} Modified: dcplusplus/trunk/windows/CertificatesPage.h =================================================================== --- dcplusplus/trunk/windows/CertificatesPage.h 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/windows/CertificatesPage.h 2006-07-08 17:01:15 UTC (rev 625) @@ -39,10 +39,18 @@ BEGIN_MSG_MAP(CertificatesPage) MESSAGE_HANDLER(WM_INITDIALOG, onInitDialog) + COMMAND_ID_HANDLER(IDC_BROWSE_PRIVATE_KEY, onBrowsePrivateKey) + COMMAND_ID_HANDLER(IDC_BROWSE_CERTIFICATE, onBrowseCertificate) + COMMAND_ID_HANDLER(IDC_BROWSE_TRUSTED_PATH, onBrowseTrustedPath) + COMMAND_ID_HANDLER(IDC_GENERATE_CERTS, onGenerateCerts) NOTIFY_CODE_HANDLER_EX(PSN_HELP, onHelpInfo) MESSAGE_HANDLER(WM_HELP, onHelp) END_MSG_MAP() + LRESULT onBrowsePrivateKey(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); + LRESULT onBrowseCertificate(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); + LRESULT onBrowseTrustedPath(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); + LRESULT onGenerateCerts(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); LRESULT onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); LRESULT onHelp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); LRESULT onHelpInfo(LPNMHDR /*pnmh*/); Modified: dcplusplus/trunk/windows/resource.h =================================================================== --- dcplusplus/trunk/windows/resource.h 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/windows/resource.h 2006-07-08 17:01:15 UTC (rev 625) @@ -417,12 +417,16 @@ #define IDC_AUTO_REFRESH_TIME 1419 #define IDC_SETTINGS_AUTO_REFRESH_TIME 1420 #define IDC_AUTO_SEARCH_LIMIT 1421 -#define IDC_SSL_OPTIONS 1421 #define IDC_TLS_OPTIONS 1421 #define IDC_SETTINGS_AUTO_SEARCH_LIMIT 1422 +#define IDC_GENERATE_CERTS 1422 #define IDC_CLOSE_ALL_PM 1423 +#define IDC_BROWSE_PRIVATE_KEY 1423 #define IDC_CLOSE_ALL_OFFLINE_PM 1424 +#define IDC_BROWSE_OWN_CERTIFICATE 1424 +#define IDC_BROWSE_CERTIFICATE 1424 #define IDC_CLOSE_ALL_DIR_LIST 1425 +#define IDC_BROWSE_TRUSTED_PATH 1425 #define IDC_CLOSE_ALL_SEARCH_FRAME 1426 #define IDC_BROWSELIST 3000 #define IDC_REMOVE_SOURCE 3500 @@ -465,7 +469,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 246 #define _APS_NEXT_COMMAND_VALUE 32789 -#define _APS_NEXT_CONTROL_VALUE 1422 +#define _APS_NEXT_CONTROL_VALUE 1426 #define _APS_NEXT_SYMED_VALUE 105 #endif #endif Modified: dcplusplus/trunk/yassl/src/ssl.cpp =================================================================== --- dcplusplus/trunk/yassl/src/ssl.cpp 2006-07-02 20:59:53 UTC (rev 624) +++ dcplusplus/trunk/yassl/src/ssl.cpp 2006-07-08 17:01:15 UTC (rev 625) @@ -1370,9 +1370,12 @@ } - int SSL_pending(SSL*) + int SSL_pending(SSL* ssl) { - return SSL_SUCCESS; // TODO: + // Just in case there's pending data that hasn't been processed yet... + char c; + SSL_peek(ssl, &c, 1); + return ssl->bufferedData(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-07-02 21:00:38
|
Revision: 624 Author: arnetheduck Date: 2006-07-02 13:59:53 -0700 (Sun, 02 Jul 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=624&view=rev Log Message: ----------- Playing with ssl options Modified Paths: -------------- dcplusplus/trunk/Compile.txt dcplusplus/trunk/DCPlusPlus.rc dcplusplus/trunk/Example.xml dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/AdcHub.cpp dcplusplus/trunk/client/BufferedSocket.cpp dcplusplus/trunk/client/BufferedSocket.h dcplusplus/trunk/client/Client.cpp dcplusplus/trunk/client/Client.h dcplusplus/trunk/client/ConnectionManager.cpp dcplusplus/trunk/client/CryptoManager.cpp dcplusplus/trunk/client/CryptoManager.h dcplusplus/trunk/client/SSLSocket.cpp dcplusplus/trunk/client/SSLSocket.h dcplusplus/trunk/client/SettingsManager.cpp dcplusplus/trunk/client/SettingsManager.h dcplusplus/trunk/client/Socket.h dcplusplus/trunk/client/StringDefs.cpp dcplusplus/trunk/client/StringDefs.h dcplusplus/trunk/client/User.h dcplusplus/trunk/client/UserConnection.h dcplusplus/trunk/windows/AdvancedPage.cpp dcplusplus/trunk/windows/CertificatesPage.cpp dcplusplus/trunk/windows/CertificatesPage.h dcplusplus/trunk/windows/TransferView.cpp dcplusplus/trunk/windows/resource.h dcplusplus/trunk/yassl/include/yassl_int.hpp dcplusplus/trunk/yassl/src/yassl.cpp dcplusplus/trunk/yassl/taocrypt/taocrypt.vcproj dcplusplus/trunk/yassl/yassl.vcproj Modified: dcplusplus/trunk/Compile.txt =================================================================== --- dcplusplus/trunk/Compile.txt 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/Compile.txt 2006-07-02 20:59:53 UTC (rev 624) @@ -4,7 +4,6 @@ 1) Download the source and STLPort from the DC++ download site. Unpack the DC++ source. Unpack the STLport source into the stlport directory. Download WTL from http://sf.net/projects/wtl. Unpack it to the wtl folder. - Download YaSSL from http://yassl.com/. Unpack it to the yassl folder. 2) You most probably have to update your Platform SDK, http://msdn.microsoft.com will tell you how. You have to do this if you get an error that "natupnp.h" is missing. Since all you need is this Modified: dcplusplus/trunk/DCPlusPlus.rc =================================================================== --- dcplusplus/trunk/DCPlusPlus.rc 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/DCPlusPlus.rc 2006-07-02 20:59:53 UTC (rev 624) @@ -681,17 +681,20 @@ CAPTION "Security Certificates" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - EDITTEXT IDC_SSL_PRIVATE_KEY_FILE,102,7,166,14,ES_AUTOHSCROLL - EDITTEXT IDC_SSL_CERTIFICATE_FILE,102,24,166,14,ES_AUTOHSCROLL - EDITTEXT IDC_SSL_TRUSTED_CERTIFICATES_PATH,102,42,166,14, + EDITTEXT IDC_TLS_PRIVATE_KEY_FILE,102,7,166,14,ES_AUTOHSCROLL + EDITTEXT IDC_TLS_CERTIFICATE_FILE,102,24,166,14,ES_AUTOHSCROLL + EDITTEXT IDC_TLS_TRUSTED_CERTIFICATES_PATH,102,42,166,14, ES_AUTOHSCROLL LTEXT "Private key file",IDC_STATIC,50,10,48,8 LTEXT "Own certificate file",IDC_STATIC,37,27,61,8 LTEXT "Trusted certificates path",IDC_STATIC,18,45,80,8 LTEXT "Under construction, restart dc++ to see effects...", - IDC_STATIC,7,90,163,8 + IDC_STATIC,7,186,163,8 LTEXT "Experimental feature, don't consider DC++ secure in any way", - IDC_STATIC,7,106,200,8 + IDC_STATIC,7,201,200,8 + CONTROL "",IDC_TLS_OPTIONS,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | + LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,15,72,243,90 END Modified: dcplusplus/trunk/Example.xml =================================================================== --- dcplusplus/trunk/Example.xml 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/Example.xml 2006-07-02 20:59:53 UTC (rev 624) @@ -40,6 +40,7 @@ <String Name="Browse">Browse...</String> <String Name="BrowseAccel">&Browse...</String> <String Name="BrowseFileList">Browse file list</String> + <String Name="CertificateNotTrusted">Certificate not trusted, unable to connect</String> <String Name="ChooseFolder">Choose folder</String> <String Name="Cid">CID</String> <String Name="Close">Close</String> @@ -47,6 +48,7 @@ <String Name="ClosingConnection">Closing connection...</String> <String Name="Compressed">Compressed</String> <String Name="CompressionError">Error during compression</String> + <String Name="CommandTooLong">Maximum command length exceeded</String> <String Name="Configure">&Configure</String> <String Name="Connect">&Connect</String> <String Name="ConnectFavuserHub">Connect to hub</String> @@ -301,6 +303,7 @@ <String Name="Offline">Offline</String> <String Name="Online">Online</String> <String Name="OnlyFreeSlots">Only users with free slots</String> + <String Name="OnlyTlsAllowed">Only TLS connections allowed</String> <String Name="OnlyTth">Only results with TTH root</String> <String Name="OnlyWhereOp">Only where I'm op</String> <String Name="Open">Open</String> @@ -369,6 +372,8 @@ <String Name="SettingsAdvanced3">Advanced\Experts only</String> <String Name="SettingsAdvancedResume">Advanced resume using TTH</String> <String Name="SettingsAdvancedSettings">Advanced settings</String> + <String Name="SettingsAllowUntrustedClients">Allow TLS connections to hubs without trusted certificate</String> + <String Name="SettingsAllowUntrustedHubs">Allow TLS connections to hubs without trusted certificate</String> <String Name="SettingsAntiFrag">Use antifragmentation method for downloads</String> <String Name="SettingsAppearance">Appearance</String> <String Name="SettingsAppearance2">Appearance\Colors and sounds</String> @@ -415,7 +420,7 @@ <String Name="SettingsDownloads">Downloads</String> <String Name="SettingsDownloadsMax">Maximum simultaneous downloads (0 = infinite)</String> <String Name="SettingsDownloadsSpeedPause">No new downloads if speed exceeds (KiB/s, 0 = disable)</String> - <String Name="SettingsExampleText">Donate €€€:s! (ok, dirty dollars are fine as well =) (see help menu)</String> + <String Name="SettingsExampleText">Donate €€€:s! (ok, dirty dollars are fine as well =) (see help menu)</String> <String Name="SettingsExternalIp">External / WAN IP</String> <String Name="SettingsFavShowJoins">Only show joins / parts for favorite users</String> <String Name="SettingsFavoriteDirsPage">Downloads\Favorites</String> @@ -524,7 +529,7 @@ <String Name="SettingsWindowsOptions">Window options</String> <String Name="SettingsWriteBuffer">Write buffer size</String> <String Name="SettingsAltSortOrder">Sort all downloads first</String> - <String Name="SettingsUseSsl">Use SSL when remote client supports it</String> + <String Name="SettingsUseTls">Use TLS when remote client supports it</String> <String Name="SfvInconsistency">CRC32 inconsistency (SFV-Check)</String> <String Name="Shared">Shared</String> <String Name="SharedFiles">Shared Files</String> Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/changelog.txt 2006-07-02 20:59:53 UTC (rev 624) @@ -30,6 +30,7 @@ * [bug 988] Only unique nicks diplayed in title bar * Added protection from hubs/clients sending junk data resulting in high memory usage / crash * Updated to yaSSL 1.3.7 +* Added a few TLS options; [U] in transfer status means untrusted TLS (encrypted but certificate not validated) -- 0.691 2006-06-03 -- * Links to bugzilla in html changelog Modified: dcplusplus/trunk/client/AdcHub.cpp =================================================================== --- dcplusplus/trunk/client/AdcHub.cpp 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/client/AdcHub.cpp 2006-07-02 20:59:53 UTC (rev 624) @@ -130,7 +130,7 @@ } if(u->getIdentity().supports(ADCS_FEATURE)) { - u->getUser()->setFlag(User::SSL); + u->getUser()->setFlag(User::TLS); } if(u->getUser() == getMyIdentity().getUser()) { @@ -218,13 +218,26 @@ if(c.getParameters().size() < 3) return; + const string& protocol = c.getParam(0); + const string& port = c.getParam(1); + + string token; + bool hasToken = c.getParam("TO", 2, token); + bool secure; - if(c.getParam(0) == CLIENT_PROTOCOL) { + if(protocol == CLIENT_PROTOCOL) { secure = false; - } else if(c.getParam(0) == SECURE_CLIENT_PROTOCOL) { + } else if(protocol == SECURE_CLIENT_PROTOCOL && CryptoManager::getInstance()->TLSOk()) { secure = true; } else { - send(AdcCommand(AdcCommand::SEV_FATAL, AdcCommand::ERROR_PROTOCOL_UNSUPPORTED, "Protocol unknown", AdcCommand::TYPE_DIRECT).setTo(c.getFrom())); + AdcCommand cmd(AdcCommand::SEV_FATAL, AdcCommand::ERROR_PROTOCOL_UNSUPPORTED, "Protocol unknown"); + cmd.setTo(c.getFrom()); + cmd.addParam("PR", protocol); + + if(hasToken) + cmd.addParam("TO", token); + + send(cmd); return; } @@ -233,22 +246,40 @@ return; } - string token; - c.getParam("TO", 2, token); - ConnectionManager::getInstance()->adcConnect(*u, (short)Util::toInt(c.getParameters()[1]), token, secure); + ConnectionManager::getInstance()->adcConnect(*u, (short)Util::toInt(port), token, secure); } void AdcHub::handle(AdcCommand::RCM, AdcCommand& c) throw() { + if(c.getParameters().empty()) { + return; + } if(!ClientManager::getInstance()->isActive()) return; OnlineUser* u = findUser(c.getFrom()); if(!u || u->getUser() == ClientManager::getInstance()->getMe()) return; - if(c.getParameters().empty() || (c.getParameters()[0] != CLIENT_PROTOCOL && c.getParameters()[0] != SECURE_CLIENT_PROTOCOL)) + + const string& protocol = c.getParam(0); + string token; + bool hasToken = c.getParam("TO", 1, token); + + bool secure; + if(protocol == CLIENT_PROTOCOL) { + secure = false; + } else if(protocol == SECURE_CLIENT_PROTOCOL && CryptoManager::getInstance()->TLSOk()) { + secure = true; + } else { + AdcCommand cmd(AdcCommand::SEV_FATAL, AdcCommand::ERROR_PROTOCOL_UNSUPPORTED, "Protocol unknown"); + cmd.setTo(c.getFrom()); + cmd.addParam("PR", protocol); + + if(hasToken) + cmd.addParam("TO", token); + + send(cmd); return; - string token; - c.getParam("TO", 1, token); - connect(*u, token, c.getParameters()[0] == SECURE_CLIENT_PROTOCOL); + } + connect(*u, token, secure); } void AdcHub::handle(AdcCommand::CMD, AdcCommand& c) throw() { @@ -312,7 +343,7 @@ if(!u) return; - // @todo Check for invalid protocol and unset SSL if necessary + // @todo Check for invalid protocol and unset TLS if necessary fire(ClientListener::Message(), this, *u, c.getParam(1)); } @@ -337,7 +368,7 @@ void AdcHub::connect(const OnlineUser& user) { u_int32_t r = Util::rand(); - connect(user, Util::toString(r), BOOLSETTING(USE_SSL) && user.getUser()->isSet(User::SSL)); + connect(user, Util::toString(r), CryptoManager::getInstance()->TLSOk() && user.getUser()->isSet(User::TLS)); } void AdcHub::connect(const OnlineUser& user, string const& token, bool secure) { @@ -472,7 +503,7 @@ } string su; - if(CryptoManager::getInstance()->hasCerts()) { + if(CryptoManager::getInstance()->TLSOk()) { su += ADCS_FEATURE + ","; } Modified: dcplusplus/trunk/client/BufferedSocket.cpp =================================================================== --- dcplusplus/trunk/client/BufferedSocket.cpp 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/client/BufferedSocket.cpp 2006-07-02 20:59:53 UTC (rev 624) @@ -255,7 +255,7 @@ } } - if(mode == MODE_LINE && line.size() > SETTING(MAX_COMMAND_LENGTH)) { + if(mode == MODE_LINE && line.size() > static_cast<size_t>(SETTING(MAX_COMMAND_LENGTH))) { throw SocketException(STRING(COMMAND_TOO_LONG)); } } Modified: dcplusplus/trunk/client/BufferedSocket.h =================================================================== --- dcplusplus/trunk/client/BufferedSocket.h 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/client/BufferedSocket.h 2006-07-02 20:59:53 UTC (rev 624) @@ -99,8 +99,11 @@ void setLineMode(size_t aRollback) { setMode (MODE_LINE, aRollback);} void setMode(Modes mode, size_t aRollback = 0); Modes getMode() const { return mode; } - const string& getIp() { return sock ? sock->getIp() : Util::emptyString; } - bool isConnected() { return sock && sock->isConnected(); } + const string& getIp() const { return sock ? sock->getIp() : Util::emptyString; } + bool isConnected() const { return sock && sock->isConnected(); } + + bool isSecure() const { return sock && sock->isSecure(); } + bool isTrusted() const { return sock && sock->isTrusted(); } void write(const string& aData) throw() { write(aData.data(), aData.length()); } void write(const char* aBuf, size_t aLen) throw(); Modified: dcplusplus/trunk/client/Client.cpp =================================================================== --- dcplusplus/trunk/client/Client.cpp 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/client/Client.cpp 2006-07-02 20:59:53 UTC (rev 624) @@ -25,6 +25,7 @@ #include "FavoriteManager.h" #include "TimerManager.h" +#include "ResourceManager.h" Client::Counts Client::counts; @@ -100,13 +101,25 @@ } catch(const Exception& e) { if(socket) { BufferedSocket::putSocket(socket); - socket = NULL; + socket = 0; } fire(ClientListener::Failed(), this, e.getError()); } updateActivity(); } +void Client::on(Connected) throw() { + if(socket->isSecure() && !socket->isTrusted() && !BOOLSETTING(ALLOW_UNTRUSTED_HUBS)) { + fire(ClientListener::StatusMessage(), this, STRING(CERTIFICATE_NOT_TRUSTED)); + disconnect(true); + return; + } + + updateActivity(); + ip = socket->getIp(); + fire(ClientListener::Connected(), this); +} + void Client::disconnect(bool graceLess) { if(!socket) return; Modified: dcplusplus/trunk/client/Client.h =================================================================== --- dcplusplus/trunk/client/Client.h 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/client/Client.h 2006-07-02 20:59:53 UTC (rev 624) @@ -208,7 +208,7 @@ // BufferedSocketListener virtual void on(Connecting) throw() { fire(ClientListener::Connecting(), this); } - virtual void on(Connected) throw() { updateActivity(); ip = socket->getIp(); fire(ClientListener::Connected(), this); } + virtual void on(Connected) throw(); }; Modified: dcplusplus/trunk/client/ConnectionManager.cpp =================================================================== --- dcplusplus/trunk/client/ConnectionManager.cpp 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/client/ConnectionManager.cpp 2006-07-02 20:59:53 UTC (rev 624) @@ -27,6 +27,7 @@ #include "CryptoManager.h" #include "ClientManager.h" #include "QueueManager.h" +#include "LogManager.h" #include "UserConnection.h" @@ -295,6 +296,10 @@ uc->setLastActivity(GET_TICK()); try { uc->accept(sock); + if(uc->isSecure() && !uc->isTrusted() && !BOOLSETTING(ALLOW_UNTRUSTED_CLIENTS)) { + putConnection(uc); + LogManager::getInstance()->message(STRING(CERTIFICATE_NOT_TRUSTED)); + } } catch(const Exception&) { putConnection(uc); delete uc; @@ -379,6 +384,12 @@ } void ConnectionManager::on(UserConnectionListener::Connected, UserConnection* aSource) throw() { + if(aSource->isSecure() && !aSource->isTrusted() && !BOOLSETTING(ALLOW_UNTRUSTED_CLIENTS)) { + putConnection(aSource); + LogManager::getInstance()->message(STRING(CERTIFICATE_NOT_TRUSTED)); + return; + } + dcassert(aSource->getState() == UserConnection::STATE_CONNECT); if(aSource->isSet(UserConnection::FLAG_NMDC)) { aSource->myNick(aSource->getToken()); Modified: dcplusplus/trunk/client/CryptoManager.cpp =================================================================== --- dcplusplus/trunk/client/CryptoManager.cpp 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/client/CryptoManager.cpp 2006-07-02 20:59:53 UTC (rev 624) @@ -80,28 +80,63 @@ DH_free(dh); } +bool CryptoManager::TLSOk() const throw() { + return BOOLSETTING(USE_TLS) && certsLoaded; +} +bool CryptoManager::generateCertificate() throw() { +#ifdef _WIN32 + // Generate certificate using OpenSSL + if(SETTING(TLS_PRIVATE_KEY_FILE).empty()) { + return false; + } + wstring cmd = L"openssl.exe -out \"" + Text::utf8ToWide(SETTING(TLS_PRIVATE_KEY_FILE)) + L"\" 2048"; + PROCESS_INFORMATION pi = { 0 }; + STARTUPINFO si = { 0 }; + si.cb = sizeof(si); + + if(!CreateProcess(L"openssl.exe", const_cast<wchar_t*>(cmd.c_str()), 0, 0, FALSE, 0, 0, 0, 0, &pi)) { + return false; + } + WaitForSingleObject(pi.hProcess, INFINITE); + CloseHandle(pi.hThread); + CloseHandle(pi.hProcess); + + cmd = L"openssl.exe x509 -x509 -new -batch -key \"" + Text::utf8ToWide(SETTING(TLS_PRIVATE_KEY_FILE)) + + L"\" -out \"" + Text::utf8ToWide(SETTING(TLS_CERTIFICATE_FILE)) + L"\""; + + if(!CreateProcess(L"openssl.exe", const_cast<wchar_t*>(cmd.c_str()), 0, 0, FALSE, 0, 0, 0, 0, &pi)) { + return false; + } + + WaitForSingleObject(pi.hProcess, INFINITE); + CloseHandle(pi.hThread); + CloseHandle(pi.hProcess); +#endif + return true; +} + void CryptoManager::loadCertificates() throw() { SSL_CTX_set_verify(serverContext, SSL_VERIFY_NONE, 0); SSL_CTX_set_verify(clientContext, SSL_VERIFY_NONE, 0); - if(!SETTING(SSL_CERTIFICATE_FILE).empty()) { - if(SSL_CTX_use_certificate_file(serverContext, SETTING(SSL_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { + if(!SETTING(TLS_CERTIFICATE_FILE).empty()) { + if(SSL_CTX_use_certificate_file(serverContext, SETTING(TLS_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { LogManager::getInstance()->message("Failed to load certificate file"); return; } - if(SSL_CTX_use_certificate_file(clientContext, SETTING(SSL_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { + if(SSL_CTX_use_certificate_file(clientContext, SETTING(TLS_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { LogManager::getInstance()->message("Failed to load certificate file"); return; } } - if(!SETTING(SSL_PRIVATE_KEY_FILE).empty()) { - if(SSL_CTX_use_PrivateKey_file(serverContext, SETTING(SSL_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { + if(!SETTING(TLS_PRIVATE_KEY_FILE).empty()) { + if(SSL_CTX_use_PrivateKey_file(serverContext, SETTING(TLS_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { LogManager::getInstance()->message("Failed to load private key"); return; } - if(SSL_CTX_use_PrivateKey_file(clientContext, SETTING(SSL_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { + if(SSL_CTX_use_PrivateKey_file(clientContext, SETTING(TLS_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { LogManager::getInstance()->message("Failed to load private key"); return; } @@ -111,10 +146,10 @@ WIN32_FIND_DATA data; HANDLE hFind; - hFind = FindFirstFile(Text::toT(SETTING(SSL_TRUSTED_CERTIFICATES_PATH) + "*.pem").c_str(), &data); + hFind = FindFirstFile(Text::toT(SETTING(TLS_TRUSTED_CERTIFICATES_PATH) + "*.pem").c_str(), &data); if(hFind != INVALID_HANDLE_VALUE) { do { - if(SSL_CTX_load_verify_locations(clientContext, (SETTING(SSL_TRUSTED_CERTIFICATES_PATH) + Text::fromT(data.cFileName)).c_str(), NULL) != SSL_SUCCESS) { + if(SSL_CTX_load_verify_locations(clientContext, (SETTING(TLS_TRUSTED_CERTIFICATES_PATH) + Text::fromT(data.cFileName)).c_str(), NULL) != SSL_SUCCESS) { LogManager::getInstance()->message("Failed to load trusted certificate from " + Text::fromT(data.cFileName)); } } while(FindNextFile(hFind, &data)); Modified: dcplusplus/trunk/client/CryptoManager.h =================================================================== --- dcplusplus/trunk/client/CryptoManager.h 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/client/CryptoManager.h 2006-07-02 20:59:53 UTC (rev 624) @@ -85,7 +85,9 @@ SSLSocket* getServerSocket() throw(SocketException); void loadCertificates() throw(); - bool hasCerts() const { return certsLoaded; } + bool generateCertificate() throw(); + + bool TLSOk() const throw(); private: friend class Singleton<CryptoManager>; Modified: dcplusplus/trunk/client/SSLSocket.cpp =================================================================== --- dcplusplus/trunk/client/SSLSocket.cpp 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/client/SSLSocket.cpp 2006-07-02 20:59:53 UTC (rev 624) @@ -27,6 +27,7 @@ SSLSocket::SSLSocket(SSL_CTX* context) throw(SocketException) : ctx(context), ssl(0) { + } void SSLSocket::connect(const string& aIp, short aPort) throw(SocketException) { @@ -120,6 +121,22 @@ return Socket::wait(millis, waitFor); } +bool SSLSocket::isTrusted() const throw() { + if(!ssl) { + return false; + } + + if(SSL_get_verify_result(ssl) != SSL_ERROR_NONE) { + return false; + } + + if(!SSL_get_peer_certificate(ssl)) { + return false; + } + + return true; +} + void SSLSocket::shutdown() throw() { if(ssl) SSL_shutdown(ssl); Modified: dcplusplus/trunk/client/SSLSocket.h =================================================================== --- dcplusplus/trunk/client/SSLSocket.h 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/client/SSLSocket.h 2006-07-02 20:59:53 UTC (rev 624) @@ -45,6 +45,10 @@ virtual int wait(u_int32_t millis, int waitFor) throw(SocketException); virtual void shutdown() throw(); virtual void close() throw(); + + virtual bool isSecure() const throw() { return true; } + virtual bool isTrusted() const throw(); + private: friend class CryptoManager; Modified: dcplusplus/trunk/client/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/client/SettingsManager.cpp 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/client/SettingsManager.cpp 2006-07-02 20:59:53 UTC (rev 624) @@ -74,7 +74,7 @@ "BoldHub", "BoldPm", "BoldSearch", "SocketInBuffer", "SocketOutBuffer", "OnlyDlTthFiles", "OpenWaitingUsers", "BoldWaitingUsers", "OpenSystemLog", "BoldSystemLog", "AutoRefreshTime", "UseSsl", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", "PromptPassword", "SpyFrameIgnoreTthSearches", - "DontDlAlreadyQueued", "MaxCommandLength", + "DontDlAlreadyQueued", "MaxCommandLength", "AllowUntrustedHubs", "AllowUntrustedClients", "SENTRY", // Int64 "TotalUpload", "TotalDownload", @@ -243,7 +243,7 @@ setDefault(ONLY_DL_TTH_FILES, false); setDefault(OPEN_WAITING_USERS, false); setDefault(OPEN_SYSTEM_LOG, true); - setDefault(SSL_TRUSTED_CERTIFICATES_PATH, Util::getConfigPath() + "Certificates" PATH_SEPARATOR_STR); + setDefault(TLS_TRUSTED_CERTIFICATES_PATH, Util::getConfigPath() + "Certificates" PATH_SEPARATOR_STR); setDefault(BOLD_FINISHED_DOWNLOADS, true); setDefault(BOLD_FINISHED_UPLOADS, true); setDefault(BOLD_QUEUE, true); @@ -253,7 +253,7 @@ setDefault(BOLD_WAITING_USERS, true); setDefault(BOLD_SYSTEM_LOG, true); setDefault(AUTO_REFRESH_TIME, 60); - setDefault(USE_SSL, false); + setDefault(USE_TLS, true); setDefault(AUTO_SEARCH_LIMIT, 5); setDefault(ALT_SORT_ORDER, false); setDefault(AUTO_KICK_NO_FAVS, false); @@ -261,6 +261,8 @@ setDefault(SPY_FRAME_IGNORE_TTH_SEARCHES, false); setDefault(DONT_DL_ALREADY_QUEUED, false); setDefault(MAX_COMMAND_LENGTH, 16*1024*1024); + setDefault(ALLOW_UNTRUSTED_HUBS, true); + setDefault(ALLOW_UNTRUSTED_CLIENTS, true); #ifdef _WIN32 setDefault(MAIN_WINDOW_STATE, SW_SHOWNORMAL); Modified: dcplusplus/trunk/client/SettingsManager.h =================================================================== --- dcplusplus/trunk/client/SettingsManager.h 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/client/SettingsManager.h 2006-07-02 20:59:53 UTC (rev 624) @@ -59,7 +59,7 @@ FINISHED_UL_WIDTHS, FINISHED_UL_ORDER, PRIVATE_ID, SPYFRAME_WIDTHS, SPYFRAME_ORDER, LOG_FILE_MAIN_CHAT, LOG_FILE_PRIVATE_CHAT, LOG_FILE_STATUS, LOG_FILE_UPLOAD, LOG_FILE_DOWNLOAD, LOG_FILE_SYSTEM, LOG_FORMAT_SYSTEM, LOG_FORMAT_STATUS, DIRECTORLISTINGFRAME_ORDER, DIRECTORLISTINGFRAME_WIDTHS, - SSL_PRIVATE_KEY_FILE, SSL_CERTIFICATE_FILE, SSL_TRUSTED_CERTIFICATES_PATH, + TLS_PRIVATE_KEY_FILE, TLS_CERTIFICATE_FILE, TLS_TRUSTED_CERTIFICATES_PATH, STR_LAST }; enum IntSetting { INT_FIRST = STR_LAST + 1, @@ -89,8 +89,9 @@ NO_IP_OVERRIDE, SEARCH_ONLY_FREE_SLOTS, LAST_SEARCH_TYPE, BOLD_FINISHED_DOWNLOADS, BOLD_FINISHED_UPLOADS, BOLD_QUEUE, BOLD_HUB, BOLD_PM, BOLD_SEARCH, SOCKET_IN_BUFFER, SOCKET_OUT_BUFFER, ONLY_DL_TTH_FILES, OPEN_WAITING_USERS, BOLD_WAITING_USERS, OPEN_SYSTEM_LOG, BOLD_SYSTEM_LOG, AUTO_REFRESH_TIME, - USE_SSL, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, PROMPT_PASSWORD, SPY_FRAME_IGNORE_TTH_SEARCHES, - DONT_DL_ALREADY_QUEUED, MAX_COMMAND_LENGTH, + 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, INT_LAST }; enum Int64Setting { INT64_FIRST = INT_LAST + 1, Modified: dcplusplus/trunk/client/Socket.h =================================================================== --- dcplusplus/trunk/client/Socket.h 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/client/Socket.h 2006-07-02 20:59:53 UTC (rev 624) @@ -176,6 +176,9 @@ int getSocketOptInt(int option) throw(SocketException); void setSocketOpt(int option, int value) throw(SocketException); + virtual bool isSecure() const throw() { return false; } + virtual bool isTrusted() const throw() { return false; } + /** When socks settings are updated, this has to be called... */ static void socksUpdated(); Modified: dcplusplus/trunk/client/StringDefs.cpp =================================================================== --- dcplusplus/trunk/client/StringDefs.cpp 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/client/StringDefs.cpp 2006-07-02 20:59:53 UTC (rev 624) @@ -41,6 +41,7 @@ "Browse...", "&Browse...", "Browse file list", +"Certificate not trusted, unable to connect", "Choose folder", "CID", "Close", @@ -48,6 +49,7 @@ "Closing connection...", "Compressed", "Error during compression", +"Maximum command length exceeded", "&Configure", "&Connect", "Connect to hub", @@ -302,6 +304,7 @@ "Offline", "Online", "Only users with free slots", +"Only TLS connections allowed", "Only results with TTH root", "Only where I'm op", "Open", @@ -370,6 +373,8 @@ "Advanced\\Experts only", "Advanced resume using TTH", "Advanced settings", +"Allow TLS connections to hubs without trusted certificate", +"Allow TLS connections to hubs without trusted certificate", "Use antifragmentation method for downloads", "Appearance", "Appearance\\Colors and sounds", @@ -416,7 +421,7 @@ "Downloads", "Maximum simultaneous downloads (0 = infinite)", "No new downloads if speed exceeds (KiB/s, 0 = disable)", -"Donate €€€:s! (ok, dirty dollars are fine as well =) (see help menu)", +"Donate :s! (ok, dirty dollars are fine as well =) (see help menu)", "External / WAN IP", "Only show joins / parts for favorite users", "Downloads\\Favorites", @@ -525,7 +530,7 @@ "Window options", "Write buffer size", "Sort all downloads first", -"Use SSL when remote client supports it", +"Use TLS when remote client supports it", "CRC32 inconsistency (SFV-Check)", "Shared", "Shared Files", @@ -653,6 +658,7 @@ "Browse", "BrowseAccel", "BrowseFileList", +"CertificateNotTrusted", "ChooseFolder", "Cid", "Close", @@ -660,6 +666,7 @@ "ClosingConnection", "Compressed", "CompressionError", +"CommandTooLong", "Configure", "Connect", "ConnectFavuserHub", @@ -914,6 +921,7 @@ "Offline", "Online", "OnlyFreeSlots", +"OnlyTlsAllowed", "OnlyTth", "OnlyWhereOp", "Open", @@ -982,6 +990,8 @@ "SettingsAdvanced3", "SettingsAdvancedResume", "SettingsAdvancedSettings", +"SettingsAllowUntrustedClients", +"SettingsAllowUntrustedHubs", "SettingsAntiFrag", "SettingsAppearance", "SettingsAppearance2", @@ -1137,7 +1147,7 @@ "SettingsWindowsOptions", "SettingsWriteBuffer", "SettingsAltSortOrder", -"SettingsUseSsl", +"SettingsUseTls", "SfvInconsistency", "Shared", "SharedFiles", Modified: dcplusplus/trunk/client/StringDefs.h =================================================================== --- dcplusplus/trunk/client/StringDefs.h 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/client/StringDefs.h 2006-07-02 20:59:53 UTC (rev 624) @@ -44,6 +44,7 @@ BROWSE, // "Browse..." BROWSE_ACCEL, // "&Browse..." BROWSE_FILE_LIST, // "Browse file list" + CERTIFICATE_NOT_TRUSTED, // "Certificate not trusted, unable to connect" CHOOSE_FOLDER, // "Choose folder" CID, // "CID" CLOSE, // "Close" @@ -306,6 +307,7 @@ OFFLINE, // "Offline" ONLINE, // "Online" ONLY_FREE_SLOTS, // "Only users with free slots" + ONLY_TLS_ALLOWED, // "Only TLS connections allowed" ONLY_TTH, // "Only results with TTH root" ONLY_WHERE_OP, // "Only where I'm op" OPEN, // "Open" @@ -374,6 +376,8 @@ SETTINGS_ADVANCED3, // "Advanced\\Experts only" SETTINGS_ADVANCED_RESUME, // "Advanced resume using TTH" SETTINGS_ADVANCED_SETTINGS, // "Advanced settings" + SETTINGS_ALLOW_UNTRUSTED_CLIENTS, // "Allow TLS connections to hubs without trusted certificate" + SETTINGS_ALLOW_UNTRUSTED_HUBS, // "Allow TLS connections to hubs without trusted certificate" SETTINGS_ANTI_FRAG, // "Use antifragmentation method for downloads" SETTINGS_APPEARANCE, // "Appearance" SETTINGS_APPEARANCE2, // "Appearance\\Colors and sounds" @@ -420,7 +424,7 @@ SETTINGS_DOWNLOADS, // "Downloads" SETTINGS_DOWNLOADS_MAX, // "Maximum simultaneous downloads (0 = infinite)" SETTINGS_DOWNLOADS_SPEED_PAUSE, // "No new downloads if speed exceeds (KiB/s, 0 = disable)" - SETTINGS_EXAMPLE_TEXT, // "Donate €€€:s! (ok, dirty dollars are fine as well =) (see help menu)" + SETTINGS_EXAMPLE_TEXT, // "Donate :s! (ok, dirty dollars are fine as well =) (see help menu)" SETTINGS_EXTERNAL_IP, // "External / WAN IP" SETTINGS_FAV_SHOW_JOINS, // "Only show joins / parts for favorite users" SETTINGS_FAVORITE_DIRS_PAGE, // "Downloads\\Favorites" @@ -529,7 +533,7 @@ SETTINGS_WINDOWS_OPTIONS, // "Window options" SETTINGS_WRITE_BUFFER, // "Write buffer size" SETTINGS_ALT_SORT_ORDER, // "Sort all downloads first" - SETTINGS_USE_SSL, // "Use SSL when remote client supports it" + SETTINGS_USE_TLS, // "Use TLS when remote client supports it" SFV_INCONSISTENCY, // "CRC32 inconsistency (SFV-Check)" SHARED, // "Shared" SHARED_FILES, // "Shared Files" Modified: dcplusplus/trunk/client/User.h =================================================================== --- dcplusplus/trunk/client/User.h 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/client/User.h 2006-07-02 20:59:53 UTC (rev 624) @@ -41,7 +41,7 @@ HUB_BIT, TTH_GET_BIT, SAVE_NICK_BIT, - SSL_BIT + TLS_BIT }; /** Each flag is set if it's true in at least one hub */ @@ -54,7 +54,7 @@ HUB = 1<<HUB_BIT, TTH_GET = 1<<TTH_GET_BIT, //< User supports getting files by tth -> don't have path in queue... SAVE_NICK = 1<<SAVE_NICK_BIT, //< Save cid->nick association - SSL = 1<<SSL_BIT //< Client supports SSL + TLS = 1<<TLS_BIT //< Client supports SSL }; typedef Pointer<User> Ptr; Modified: dcplusplus/trunk/client/UserConnection.h =================================================================== --- dcplusplus/trunk/client/UserConnection.h 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/client/UserConnection.h 2006-07-02 20:59:53 UTC (rev 624) @@ -279,7 +279,8 @@ } User::Ptr& getUser() { return user; } - bool isSecure() const { return secure; } + bool isSecure() const { return socket && socket->isSecure(); } + bool isTrusted() const { return socket && socket->isTrusted(); } string getRemoteIp() const { return socket->getIp(); } Download* getDownload() { dcassert(isSet(FLAG_DOWNLOAD)); return download; } @@ -305,8 +306,8 @@ GETSET(u_int32_t, lastActivity, LastActivity); private: BufferedSocket* socket; + bool secure; User::Ptr user; - bool secure; static const string UPLOAD, DOWNLOAD; @@ -316,7 +317,7 @@ }; // We only want ConnectionManager to create this... - UserConnection(bool secure_) throw() : /*cqi(NULL),*/ state(STATE_UNCONNECTED), lastActivity(0), + UserConnection(bool secure_) throw() : state(STATE_UNCONNECTED), lastActivity(0), socket(0), secure(secure_), download(NULL) { } Modified: dcplusplus/trunk/windows/AdvancedPage.cpp =================================================================== --- dcplusplus/trunk/windows/AdvancedPage.cpp 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/windows/AdvancedPage.cpp 2006-07-02 20:59:53 UTC (rev 624) @@ -47,7 +47,6 @@ { SettingsManager::SEND_UNKNOWN_COMMANDS, ResourceManager::SETTINGS_SEND_UNKNOWN_COMMANDS }, { SettingsManager::ADD_FINISHED_INSTANTLY, ResourceManager::SETTINGS_ADD_FINISHED_INSTANTLY }, { SettingsManager::USE_CTRL_FOR_LINE_HISTORY, ResourceManager::SETTINGS_USE_CTRL_FOR_LINE_HISTORY }, - { SettingsManager::USE_SSL, ResourceManager::SETTINGS_USE_SSL }, { SettingsManager::AUTO_KICK_NO_FAVS, ResourceManager::SETTINGS_AUTO_KICK_NO_FAVS }, { 0, ResourceManager::SETTINGS_AUTO_AWAY } }; Modified: dcplusplus/trunk/windows/CertificatesPage.cpp =================================================================== --- dcplusplus/trunk/windows/CertificatesPage.cpp 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/windows/CertificatesPage.cpp 2006-07-02 20:59:53 UTC (rev 624) @@ -33,23 +33,29 @@ }; PropPage::Item CertificatesPage::items[] = { - { IDC_SSL_CERTIFICATE_FILE, SettingsManager::SSL_CERTIFICATE_FILE, PropPage::T_STR }, - { IDC_SSL_PRIVATE_KEY_FILE, SettingsManager::SSL_PRIVATE_KEY_FILE, PropPage::T_STR }, - { IDC_SSL_TRUSTED_CERTIFICATES_PATH, SettingsManager::SSL_TRUSTED_CERTIFICATES_PATH, PropPage::T_STR }, + { IDC_TLS_CERTIFICATE_FILE, SettingsManager::TLS_CERTIFICATE_FILE, PropPage::T_STR }, + { IDC_TLS_PRIVATE_KEY_FILE, SettingsManager::TLS_PRIVATE_KEY_FILE, PropPage::T_STR }, + { IDC_TLS_TRUSTED_CERTIFICATES_PATH, SettingsManager::TLS_TRUSTED_CERTIFICATES_PATH, PropPage::T_STR }, { 0, 0, PropPage::T_END } }; +PropPage::ListItem CertificatesPage::listItems[] = { + { SettingsManager::USE_TLS, ResourceManager::SETTINGS_USE_TLS }, + { SettingsManager::ALLOW_UNTRUSTED_HUBS, ResourceManager::SETTINGS_ALLOW_UNTRUSTED_HUBS }, + { SettingsManager::ALLOW_UNTRUSTED_CLIENTS, ResourceManager::SETTINGS_ALLOW_UNTRUSTED_CLIENTS, } +}; + LRESULT CertificatesPage::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { PropPage::translate((HWND)(*this), texts); - PropPage::read((HWND)*this, items, 0, 0); + PropPage::read((HWND)*this, items, listItems, GetDlgItem(IDC_TLS_OPTIONS)); // Do specialized reading here return TRUE; } void CertificatesPage::write() { - PropPage::write((HWND)*this, items, 0, 0); + PropPage::write((HWND)*this, items, listItems, GetDlgItem(IDC_TLS_OPTIONS)); } LRESULT CertificatesPage::onHelpInfo(LPNMHDR /*pnmh*/) { Modified: dcplusplus/trunk/windows/CertificatesPage.h =================================================================== --- dcplusplus/trunk/windows/CertificatesPage.h 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/windows/CertificatesPage.h 2006-07-02 20:59:53 UTC (rev 624) @@ -55,6 +55,7 @@ static Item items[]; static TextItem texts[]; + static ListItem listItems[]; }; #endif // !defined(CERTIFICATES_PAGE_H) Modified: dcplusplus/trunk/windows/TransferView.cpp =================================================================== --- dcplusplus/trunk/windows/TransferView.cpp 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/windows/TransferView.cpp 2006-07-02 20:59:53 UTC (rev 624) @@ -499,7 +499,11 @@ tstring statusString; if(d->getUserConnection()->isSecure()) { - statusString += _T("[S]"); + if(d->getUserConnection()->isTrusted()) { + statusString += _T("[S]"); + } else { + statusString += _T("[U]"); + } } if(d->isSet(Download::FLAG_TTH_CHECK)) { statusString += _T("[T]"); Modified: dcplusplus/trunk/windows/resource.h =================================================================== --- dcplusplus/trunk/windows/resource.h 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/windows/resource.h 2006-07-02 20:59:53 UTC (rev 624) @@ -372,6 +372,7 @@ #define IDC_EDIT2 1318 #define IDC_SOCKET_OUT_BUFFER 1318 #define IDC_SSL_CERTIFICATE_FILE 1318 +#define IDC_TLS_CERTIFICATE_FILE 1318 #define IDC_SETTINGS_SOCKET_OUT_BUFFER 1319 #define IDC_SETTINGS_SOCKET_IN_BUFFER 1320 #define IDC_CHECK1 1321 @@ -408,12 +409,16 @@ #define IDC_SETTINGS_MB 1411 #define IDC_SYSTEM_LOG 1412 #define IDC_SSL_PRIVATE_KEY_FILE 1414 +#define IDC_TLS_PRIVATE_KEY_FILE 1414 #define IDC_SSL_TRUSTED_CERTIFICATES_PATH 1415 +#define IDC_TLS_TRUSTED_CERTIFICATES_PATH 1415 #define IDC_CLIENT_ID 1416 #define IDC_PRIVATE_ID 1416 #define IDC_AUTO_REFRESH_TIME 1419 #define IDC_SETTINGS_AUTO_REFRESH_TIME 1420 #define IDC_AUTO_SEARCH_LIMIT 1421 +#define IDC_SSL_OPTIONS 1421 +#define IDC_TLS_OPTIONS 1421 #define IDC_SETTINGS_AUTO_SEARCH_LIMIT 1422 #define IDC_CLOSE_ALL_PM 1423 #define IDC_CLOSE_ALL_OFFLINE_PM 1424 @@ -460,7 +465,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 246 #define _APS_NEXT_COMMAND_VALUE 32789 -#define _APS_NEXT_CONTROL_VALUE 1421 +#define _APS_NEXT_CONTROL_VALUE 1422 #define _APS_NEXT_SYMED_VALUE 105 #endif #endif Modified: dcplusplus/trunk/yassl/include/yassl_int.hpp =================================================================== --- dcplusplus/trunk/yassl/include/yassl_int.hpp 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/yassl/include/yassl_int.hpp 2006-07-02 20:59:53 UTC (rev 624) @@ -429,16 +429,14 @@ // holds input and output buffers class Buffers { - typedef mySTL::list<input_buffer*> inputList; - typedef mySTL::list<output_buffer*> outputList; - - inputList dataList_; // list of users app data / handshake - outputList handShakeList_; // buffered handshake msgs public: Buffers() {} ~Buffers(); - const inputList& getData() const; + typedef mySTL::list<input_buffer*> inputList; + typedef mySTL::list<output_buffer*> outputList; + + const inputList& getData() const; const outputList& getHandShake() const; inputList& useData(); @@ -446,6 +444,9 @@ private: Buffers(const Buffers&); // hide copy Buffers& operator=(const Buffers&); // and assign + + inputList dataList_; // list of users app data / handshake + outputList handShakeList_; // buffered handshake msgs }; Modified: dcplusplus/trunk/yassl/src/yassl.cpp =================================================================== --- dcplusplus/trunk/yassl/src/yassl.cpp 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/yassl/src/yassl.cpp 2006-07-02 20:59:53 UTC (rev 624) @@ -31,7 +31,7 @@ #include "openssl/ssl.h" // get rid of this - +/* // yaSSL overloads hide these void* operator new[](size_t sz) { @@ -43,7 +43,7 @@ ::operator delete(ptr); } - +*/ namespace yaSSL { using mySTL::min; Modified: dcplusplus/trunk/yassl/taocrypt/taocrypt.vcproj =================================================================== --- dcplusplus/trunk/yassl/taocrypt/taocrypt.vcproj 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/yassl/taocrypt/taocrypt.vcproj 2006-07-02 20:59:53 UTC (rev 624) @@ -438,6 +438,9 @@ </FileConfiguration> </File> <File + RelativePath=".\src\md4.cpp"> + </File> + <File RelativePath="src\md5.cpp"> <FileConfiguration Name="Debug|Win32"> @@ -564,6 +567,9 @@ </FileConfiguration> </File> <File + RelativePath=".\src\template_instnt.cpp"> + </File> + <File RelativePath="src\tftables.cpp"> <FileConfiguration Name="Debug|Win32"> @@ -655,9 +661,15 @@ RelativePath="include\integer.hpp"> </File> <File + RelativePath=".\include\kernelc.hpp"> + </File> + <File RelativePath="include\md2.hpp"> </File> <File + RelativePath=".\include\md4.hpp"> + </File> + <File RelativePath="include\md5.hpp"> </File> <File @@ -682,6 +694,9 @@ RelativePath="include\rsa.hpp"> </File> <File + RelativePath=".\include\runtime.hpp"> + </File> + <File RelativePath="include\sha.hpp"> </File> <File Modified: dcplusplus/trunk/yassl/yassl.vcproj =================================================================== --- dcplusplus/trunk/yassl/yassl.vcproj 2006-07-02 16:52:24 UTC (rev 623) +++ dcplusplus/trunk/yassl/yassl.vcproj 2006-07-02 20:59:53 UTC (rev 624) @@ -291,6 +291,9 @@ </FileConfiguration> </File> <File + RelativePath=".\src\template_instnt.cpp"> + </File> + <File RelativePath="src\timer.cpp"> <FileConfiguration Name="Debug|Win32"> @@ -388,21 +391,57 @@ RelativePath="include\cert_wrapper.hpp"> </File> <File + RelativePath=".\include\openssl\crypto.h"> + </File> + <File RelativePath="include\crypto_wrapper.hpp"> </File> <File + RelativePath=".\include\openssl\des.h"> + </File> + <File + RelativePath=".\include\openssl\engine.h"> + </File> + <File + RelativePath=".\include\openssl\err.h"> + </File> + <File RelativePath="include\factory.hpp"> </File> <File RelativePath="include\handshake.hpp"> </File> <File + RelativePath=".\include\openssl\lhash.h"> + </File> + <File RelativePath="include\lock.hpp"> </File> <File RelativePath="include\log.hpp"> </File> <File + RelativePath=".\include\openssl\md4.h"> + </File> + <File + RelativePath=".\include\openssl\md5.h"> + </File> + <File + RelativePath=".\include\openssl\opensslv.h"> + </File> + <File + RelativePath=".\include\openssl\pem.h"> + </File> + <File + RelativePath=".\include\openssl\pkcs12.h"> + </File> + <File + RelativePath=".\include\openssl\rand.h"> + </File> + <File + RelativePath=".\include\openssl\rsa.h"> + </File> + <File RelativePath="include\socket_wrapper.hpp"> </File> <File @@ -412,6 +451,12 @@ RelativePath="include\timer.hpp"> </File> <File + RelativePath=".\include\openssl\x509.h"> + </File> + <File + RelativePath=".\include\openssl\x509v3.h"> + </File> + <File RelativePath=".\include\yassl.hpp"> </File> <File This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-07-02 16:56:33
|
Revision: 623 Author: arnetheduck Date: 2006-07-02 09:52:24 -0700 (Sun, 02 Jul 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=623&view=rev Log Message: ----------- Patches, new yassl, some small fixes Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/AdcHub.cpp dcplusplus/trunk/client/BufferedSocket.cpp dcplusplus/trunk/client/Client.cpp dcplusplus/trunk/client/Client.h dcplusplus/trunk/client/ClientManager.cpp dcplusplus/trunk/client/DCPlusPlus.h dcplusplus/trunk/client/HashManager.cpp dcplusplus/trunk/client/NmdcHub.cpp dcplusplus/trunk/client/SettingsManager.cpp dcplusplus/trunk/client/SettingsManager.h dcplusplus/trunk/client/StringDefs.h dcplusplus/trunk/yassl/README dcplusplus/trunk/yassl/include/handshake.hpp dcplusplus/trunk/yassl/include/openssl/crypto.h dcplusplus/trunk/yassl/include/openssl/err.h dcplusplus/trunk/yassl/include/openssl/md5.h dcplusplus/trunk/yassl/include/openssl/rsa.h dcplusplus/trunk/yassl/include/openssl/ssl.h dcplusplus/trunk/yassl/include/socket_wrapper.hpp dcplusplus/trunk/yassl/include/yassl_error.hpp dcplusplus/trunk/yassl/include/yassl_int.hpp dcplusplus/trunk/yassl/include/yassl_types.hpp dcplusplus/trunk/yassl/mySTL/helpers.hpp dcplusplus/trunk/yassl/mySTL/list.hpp dcplusplus/trunk/yassl/mySTL/vector.hpp dcplusplus/trunk/yassl/src/cert_wrapper.cpp dcplusplus/trunk/yassl/src/handshake.cpp dcplusplus/trunk/yassl/src/socket_wrapper.cpp dcplusplus/trunk/yassl/src/ssl.cpp dcplusplus/trunk/yassl/src/template_instnt.cpp dcplusplus/trunk/yassl/src/timer.cpp dcplusplus/trunk/yassl/src/yassl.cpp dcplusplus/trunk/yassl/src/yassl_error.cpp dcplusplus/trunk/yassl/src/yassl_imp.cpp dcplusplus/trunk/yassl/src/yassl_int.cpp dcplusplus/trunk/yassl/taocrypt/include/asn.hpp dcplusplus/trunk/yassl/taocrypt/include/block.hpp dcplusplus/trunk/yassl/taocrypt/include/integer.hpp dcplusplus/trunk/yassl/taocrypt/include/misc.hpp dcplusplus/trunk/yassl/taocrypt/include/runtime.hpp dcplusplus/trunk/yassl/taocrypt/include/types.hpp dcplusplus/trunk/yassl/taocrypt/src/algebra.cpp dcplusplus/trunk/yassl/taocrypt/src/asn.cpp dcplusplus/trunk/yassl/taocrypt/src/integer.cpp dcplusplus/trunk/yassl/taocrypt/src/misc.cpp dcplusplus/trunk/yassl/taocrypt/src/random.cpp dcplusplus/trunk/yassl/taocrypt/src/template_instnt.cpp Added Paths: ----------- dcplusplus/trunk/yassl/include/openssl/engine.h dcplusplus/trunk/yassl/include/openssl/md4.h dcplusplus/trunk/yassl/include/openssl/pem.h dcplusplus/trunk/yassl/include/openssl/pkcs12.h dcplusplus/trunk/yassl/include/openssl/x509.h dcplusplus/trunk/yassl/include/openssl/x509v3.h dcplusplus/trunk/yassl/taocrypt/include/md4.hpp dcplusplus/trunk/yassl/taocrypt/src/md4.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/changelog.txt 2006-07-02 16:52:24 UTC (rev 623) @@ -26,8 +26,11 @@ * Added warning when someone tries to spam hublist.org or dcpp.net with your client * [bug 968] Fixed unix compile issue (thanks pothead) * [bug 975] Fixed silly warning (thanks pothead) +* [bug 978] Fixed 64-bit compiler issue (thanks steven sheehy) +* [bug 988] Only unique nicks diplayed in title bar +* Added protection from hubs/clients sending junk data resulting in high memory usage / crash +* Updated to yaSSL 1.3.7 - -- 0.691 2006-06-03 -- * Links to bugzilla in html changelog * [bug 122] Added userlist filter (thanks trem) Modified: dcplusplus/trunk/client/AdcHub.cpp =================================================================== --- dcplusplus/trunk/client/AdcHub.cpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/client/AdcHub.cpp 2006-07-02 16:52:24 UTC (rev 623) @@ -540,7 +540,6 @@ void AdcHub::on(Failed, const string& aLine) throw() { clearUsers(); socket->removeListener(this); - state = STATE_PROTOCOL; fire(ClientListener::Failed(), this, aLine); } @@ -555,7 +554,7 @@ } void AdcHub::on(Second, u_int32_t aTick) throw() { - if(getAutoReconnect() && state == STATE_PROTOCOL && (getLastActivity() + getReconnDelay() * 1000) < aTick) { + if(getAutoReconnect() && state == STATE_PROTOCOL && (getReconnecting() || ((getLastActivity() + getReconnDelay() * 1000) < aTick)) ) { // Try to reconnect... connect(); } Modified: dcplusplus/trunk/client/BufferedSocket.cpp =================================================================== --- dcplusplus/trunk/client/BufferedSocket.cpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/client/BufferedSocket.cpp 2006-07-02 16:52:24 UTC (rev 623) @@ -254,6 +254,10 @@ break; } } + + if(mode == MODE_LINE && line.size() > SETTING(MAX_COMMAND_LENGTH)) { + throw SocketException(STRING(COMMAND_TOO_LONG)); + } } void BufferedSocket::threadSendFile(InputStream* file) throw(Exception) { Modified: dcplusplus/trunk/client/Client.cpp =================================================================== --- dcplusplus/trunk/client/Client.cpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/client/Client.cpp 2006-07-02 16:52:24 UTC (rev 623) @@ -30,7 +30,7 @@ Client::Client(const string& hubURL, char separator_, bool secure_) : myIdentity(ClientManager::getInstance()->getMe(), 0), - reconnDelay(120), lastActivity(GET_TICK()), registered(false), autoReconnect(true), socket(0), + reconnDelay(120), lastActivity(GET_TICK()), registered(false), autoReconnect(true), reconnecting(false), socket(0), hubUrl(hubURL), port(0), separator(separator_), secure(secure_), countType(COUNT_UNCOUNTED) { @@ -49,7 +49,7 @@ void Client::reconnect() { disconnect(true); setAutoReconnect(true); - resetActivtiy(); + setReconnecting(true); } void Client::shutdown() { @@ -86,6 +86,7 @@ BufferedSocket::putSocket(socket); setAutoReconnect(true); + setReconnecting(false); setReconnDelay(120 + Util::rand(0, 60)); reloadSettings(true); setRegistered(false); Modified: dcplusplus/trunk/client/Client.h =================================================================== --- dcplusplus/trunk/client/Client.h 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/client/Client.h 2006-07-02 16:52:24 UTC (rev 623) @@ -127,7 +127,6 @@ } void reconnect(); - void shutdown(); void send(const string& aMessage) { send(aMessage.c_str(), aMessage.length()); } @@ -155,6 +154,7 @@ GETSET(u_int32_t, lastActivity, LastActivity); GETSET(bool, registered, Registered); GETSET(bool, autoReconnect, AutoReconnect); + GETSET(bool, reconnecting, Reconnecting); GETSET(string, currentNick, CurrentNick); GETSET(string, currentDescription, CurrentDescription); @@ -177,7 +177,6 @@ void updateCounts(bool aRemove); void updateActivity() { lastActivity = GET_TICK(); } - void resetActivtiy() { lastActivity = 0; } /** Reload details from favmanager or settings */ void reloadSettings(bool updateNick); Modified: dcplusplus/trunk/client/ClientManager.cpp =================================================================== --- dcplusplus/trunk/client/ClientManager.cpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/client/ClientManager.cpp 2006-07-02 16:52:24 UTC (rev 623) @@ -94,21 +94,21 @@ StringList ClientManager::getNicks(const CID& cid) { Lock l(cs); - StringList lst; + StringSet nicks; OnlinePair op = onlineUsers.equal_range(cid); for(OnlineIter i = op.first; i != op.second; ++i) { - lst.push_back(i->second->getIdentity().getNick()); + nicks.insert(i->second->getIdentity().getNick()); } - if(lst.empty()) { + if(nicks.empty()) { // Offline perhaps? UserIter i = users.find(cid); if(i != users.end() && !i->second->getFirstNick().empty()) { - lst.push_back(i->second->getFirstNick()); + nicks.insert(i->second->getFirstNick()); } else { - lst.push_back('{' + cid.toBase32() + '}'); + nicks.insert('{' + cid.toBase32() + '}'); } } - return lst; + return StringList(nicks.begin(), nicks.end()); } string ClientManager::getConnection(const CID& cid) { Modified: dcplusplus/trunk/client/DCPlusPlus.h =================================================================== --- dcplusplus/trunk/client/DCPlusPlus.h 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/client/DCPlusPlus.h 2006-07-02 16:52:24 UTC (rev 623) @@ -85,6 +85,9 @@ typedef HASH_MAP<string, string> StringMap; typedef StringMap::iterator StringMapIter; +typedef HASH_SET<string> StringSet; +typedef StringSet::iterator StringSetIter; + typedef vector<wstring> WStringList; typedef WStringList::iterator WStringIter; typedef WStringList::const_iterator WStringIterC; Modified: dcplusplus/trunk/client/HashManager.cpp =================================================================== --- dcplusplus/trunk/client/HashManager.cpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/client/HashManager.cpp 2006-07-02 16:52:24 UTC (rev 623) @@ -409,7 +409,7 @@ HashManager::HashStore::HashStore() : dirty(false) { - if(File::getSize(getDataFile()) <= sizeof(int64_t)) { + if(File::getSize(getDataFile()) <= static_cast<int64_t>(sizeof(int64_t))) { try { createDataFile(getDataFile()); } catch(const FileException&) { Modified: dcplusplus/trunk/client/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/client/NmdcHub.cpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/client/NmdcHub.cpp 2006-07-02 16:52:24 UTC (rev 623) @@ -848,7 +848,7 @@ // Try to send something for the fun of it... dcdebug("Testing writing...\n"); send("|", 1); - } else if(getAutoReconnect() && state == STATE_CONNECT && (getLastActivity() + getReconnDelay() * 1000) < aTick) { + } else if(getAutoReconnect() && state == STATE_CONNECT && (getReconnecting() || ((getLastActivity() + getReconnDelay() * 1000) < aTick))) { // Try to reconnect... connect(); } @@ -871,11 +871,7 @@ // BufferedSocketListener void NmdcHub::on(BufferedSocketListener::Failed, const string& aLine) throw() { clearUsers(); - socket->removeListener(this); - - if(state == STATE_CONNECTED) - state = STATE_CONNECT; - - fire(ClientListener::Failed(), this, aLine); + state = STATE_CONNECT; + fire(ClientListener::Failed(), this, aLine); } Modified: dcplusplus/trunk/client/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/client/SettingsManager.cpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/client/SettingsManager.cpp 2006-07-02 16:52:24 UTC (rev 623) @@ -74,7 +74,7 @@ "BoldHub", "BoldPm", "BoldSearch", "SocketInBuffer", "SocketOutBuffer", "OnlyDlTthFiles", "OpenWaitingUsers", "BoldWaitingUsers", "OpenSystemLog", "BoldSystemLog", "AutoRefreshTime", "UseSsl", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", "PromptPassword", "SpyFrameIgnoreTthSearches", - "DontDlAlreadyQueued", + "DontDlAlreadyQueued", "MaxCommandLength", "SENTRY", // Int64 "TotalUpload", "TotalDownload", @@ -260,6 +260,7 @@ setDefault(PROMPT_PASSWORD, false); setDefault(SPY_FRAME_IGNORE_TTH_SEARCHES, false); setDefault(DONT_DL_ALREADY_QUEUED, false); + setDefault(MAX_COMMAND_LENGTH, 16*1024*1024); #ifdef _WIN32 setDefault(MAIN_WINDOW_STATE, SW_SHOWNORMAL); Modified: dcplusplus/trunk/client/SettingsManager.h =================================================================== --- dcplusplus/trunk/client/SettingsManager.h 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/client/SettingsManager.h 2006-07-02 16:52:24 UTC (rev 623) @@ -90,7 +90,7 @@ BOLD_HUB, BOLD_PM, BOLD_SEARCH, SOCKET_IN_BUFFER, SOCKET_OUT_BUFFER, ONLY_DL_TTH_FILES, OPEN_WAITING_USERS, BOLD_WAITING_USERS, OPEN_SYSTEM_LOG, BOLD_SYSTEM_LOG, AUTO_REFRESH_TIME, USE_SSL, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, PROMPT_PASSWORD, SPY_FRAME_IGNORE_TTH_SEARCHES, - DONT_DL_ALREADY_QUEUED, + DONT_DL_ALREADY_QUEUED, MAX_COMMAND_LENGTH, INT_LAST }; enum Int64Setting { INT64_FIRST = INT_LAST + 1, Modified: dcplusplus/trunk/client/StringDefs.h =================================================================== --- dcplusplus/trunk/client/StringDefs.h 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/client/StringDefs.h 2006-07-02 16:52:24 UTC (rev 623) @@ -51,6 +51,7 @@ CLOSING_CONNECTION, // "Closing connection..." COMPRESSED, // "Compressed" COMPRESSION_ERROR, // "Error during compression" + COMMAND_TOO_LONG, // "Maximum command length exceeded" CONFIGURE, // "&Configure" CONNECT, // "&Connect" CONNECT_FAVUSER_HUB, // "Connect to hub" Modified: dcplusplus/trunk/yassl/README =================================================================== --- dcplusplus/trunk/yassl/README 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/README 2006-07-02 16:52:24 UTC (rev 623) @@ -1,13 +1,66 @@ -yaSSL Release notes, version 1.2.2 (03/27/06) +yaSSL Release notes, version 1.3.7 (06/26/06) + This release of yaSSL contains bug fixes, portability enhancements, + and libcurl 7.15.4 support (any newer versions may not build). + +See normal build instructions below under 1.0.6. +See libcurl build instructions below under 1.3.0. + + +********************yaSSL Release notes, version 1.3.5 (06/01/06) + + + This release of yaSSL contains bug fixes, portability enhancements, + better libcurl support, and improved non-blocking I/O. + +See normal build instructions below under 1.0.6. +See libcurl build instructions below under 1.3.0. + + +********************yaSSL Release notes, version 1.3.0 (04/26/06) + + + This release of yaSSL contains minor bug fixes, portability enhancements, + and libcurl support. + +See normal build instructions below under 1.0.6. + + +--To build for libcurl on Linux, Solaris, *BSD, Mac OS X, or Cygwin: + + To build for libcurl the library needs to be built without C++ globals since + the linker will be called in a C context, also libcurl configure will expect + OpenSSL library names so some symbolic links are created. + + ./configure --enable-pure-c + make + make openssl-links + + (then go to your libcurl home and tell libcurl about yaSSL build dir) + ./configure --with-ssl=/yaSSL-BuildDir LDFLAGS=-lm + make + + +--To build for libcurl on Win32: + + Simply add the yaSSL project as a dependency to libcurl, add + yaSSL-Home\include and yaSSL-Home\include\openssl to the include list, and + define USE_SSLEAY and USE_OPENSSL + + please email to...@ya... if you have any questions. + + +*******************yaSSL Release notes, version 1.2.2 (03/27/06) + + This release of yaSSL contains minor bug fixes and portability enhancements. See build instructions below under 1.0.6: -*****************yaSSL Release notes, version 1.2.0 +*******************yaSSL Release notes, version 1.2.0 This release of yaSSL contains minor bug fixes, portability enhancements, Modified: dcplusplus/trunk/yassl/include/handshake.hpp =================================================================== --- dcplusplus/trunk/yassl/include/handshake.hpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/include/handshake.hpp 2006-07-02 16:52:24 UTC (rev 623) @@ -55,7 +55,7 @@ int sendData(SSL&, const void*, int); int sendAlert(SSL& ssl, const Alert& alert); -int receiveData(SSL&, Data&); +int receiveData(SSL&, Data&, bool peek = false); void processReply(SSL&); void buildFinished(SSL&, Finished&, const opaque*); Modified: dcplusplus/trunk/yassl/include/openssl/crypto.h =================================================================== --- dcplusplus/trunk/yassl/include/openssl/crypto.h 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/include/openssl/crypto.h 2006-07-02 16:52:24 UTC (rev 623) @@ -3,6 +3,10 @@ #ifndef ysSSL_crypto_h__ #define yaSSL_crypto_h__ +#ifdef YASSL_PREFIX +#include "prefix_crypto.h" +#endif + const char* SSLeay_version(int type); #define SSLEAY_VERSION 0x0900L Added: dcplusplus/trunk/yassl/include/openssl/engine.h =================================================================== --- dcplusplus/trunk/yassl/include/openssl/engine.h (rev 0) +++ dcplusplus/trunk/yassl/include/openssl/engine.h 2006-07-02 16:52:24 UTC (rev 623) @@ -0,0 +1,5 @@ +/* engine.h for libcurl */ + +#undef HAVE_OPENSSL_ENGINE_H + + Modified: dcplusplus/trunk/yassl/include/openssl/err.h =================================================================== --- dcplusplus/trunk/yassl/include/openssl/err.h 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/include/openssl/err.h 2006-07-02 16:52:24 UTC (rev 623) @@ -1,6 +1,6 @@ /* err.h for openssl */ -#ifndef ysSSL_err_h__ +#ifndef yaSSL_err_h__ #define yaSSL_err_h__ Added: dcplusplus/trunk/yassl/include/openssl/md4.h =================================================================== --- dcplusplus/trunk/yassl/include/openssl/md4.h (rev 0) +++ dcplusplus/trunk/yassl/include/openssl/md4.h 2006-07-02 16:52:24 UTC (rev 623) @@ -0,0 +1 @@ +/* md4.h for libcurl */ Modified: dcplusplus/trunk/yassl/include/openssl/md5.h =================================================================== --- dcplusplus/trunk/yassl/include/openssl/md5.h 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/include/openssl/md5.h 2006-07-02 16:52:24 UTC (rev 623) @@ -1 +1,4 @@ /* md5.h for openssl */ + +#include "ssl.h" /* in there for now */ + Added: dcplusplus/trunk/yassl/include/openssl/pem.h =================================================================== --- dcplusplus/trunk/yassl/include/openssl/pem.h (rev 0) +++ dcplusplus/trunk/yassl/include/openssl/pem.h 2006-07-02 16:52:24 UTC (rev 623) @@ -0,0 +1 @@ +/* pem.h for libcurl */ Added: dcplusplus/trunk/yassl/include/openssl/pkcs12.h =================================================================== --- dcplusplus/trunk/yassl/include/openssl/pkcs12.h (rev 0) +++ dcplusplus/trunk/yassl/include/openssl/pkcs12.h 2006-07-02 16:52:24 UTC (rev 623) @@ -0,0 +1,5 @@ +/* pkcs12.h for libcurl */ + + +#undef HAVE_OPENSSL_PKCS12_H + Modified: dcplusplus/trunk/yassl/include/openssl/rsa.h =================================================================== --- dcplusplus/trunk/yassl/include/openssl/rsa.h 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/include/openssl/rsa.h 2006-07-02 16:52:24 UTC (rev 623) @@ -1,7 +1,7 @@ /* rsa.h for openSSL */ -#ifndef ysSSL_rsa_h__ +#ifndef yaSSL_rsa_h__ #define yaSSL_rsa_h__ enum { RSA_F4 = 1 }; Modified: dcplusplus/trunk/yassl/include/openssl/ssl.h =================================================================== --- dcplusplus/trunk/yassl/include/openssl/ssl.h 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/include/openssl/ssl.h 2006-07-02 16:52:24 UTC (rev 623) @@ -25,12 +25,30 @@ -#ifndef ysSSL_openssl_h__ +#ifndef yaSSL_openssl_h__ #define yaSSL_openssl_h__ -#include <stdio.h> /* ERR_print fp */ +#ifdef YASSL_PREFIX +#include "prefix_ssl.h" +#endif + +#include <stdio.h> /* ERR_print fp */ +#include "opensslv.h" /* for version number */ #include "rsa.h" +#if defined(__cplusplus) +extern "C" { +#endif + + void yaSSL_CleanUp(); /* call once at end of application use to + free static singleton memory holders, + not a leak per se, but helpful when + looking for them */ + +#if defined(__cplusplus) +} // extern +#endif + #if defined(__cplusplus) && !defined(YASSL_MYSQL_COMPATIBLE) namespace yaSSL { extern "C" { @@ -102,7 +120,6 @@ typedef struct BIO BIO; /* ASN stuff */ -typedef struct ASN1_TIME ASN1_TIME; @@ -260,6 +277,7 @@ enum { /* ssl Constants */ + SSL_WOULD_BLOCK = -8, SSL_BAD_STAT = -7, SSL_BAD_PATH = -6, SSL_BAD_FILETYPE = -5, @@ -345,7 +363,8 @@ long SSL_CTX_set_tmp_dh(SSL_CTX*, DH*); void OpenSSL_add_all_algorithms(void); -void SSLeay_add_ssl_algorithms(void); +int SSL_library_init(); +int SSLeay_add_ssl_algorithms(void); SSL_CIPHER* SSL_get_current_cipher(SSL*); @@ -358,11 +377,9 @@ /* EVP stuff, des and md5, different file? */ -typedef struct Digest Digest; -typedef Digest EVP_MD; +typedef char EVP_MD; -typedef struct BulkCipher BulkCipher; -typedef BulkCipher EVP_CIPHER; +typedef char EVP_CIPHER; typedef struct EVP_PKEY EVP_PKEY; @@ -370,6 +387,10 @@ typedef const DES_cblock const_DES_cblock; typedef DES_cblock DES_key_schedule; +enum { + DES_ENCRYPT = 1, + DES_DECRYPT = 0 +}; const EVP_MD* EVP_md5(void); const EVP_CIPHER* EVP_des_ede3_cbc(void); @@ -391,6 +412,112 @@ int RAND_load_file(const char*, long); +/* for libcurl */ +int RAND_status(void); +int RAND_bytes(unsigned char* buf, int num); + +int DES_set_key(const_DES_cblock*, DES_key_schedule*); +void DES_set_odd_parity(DES_cblock*); +void DES_ecb_encrypt(DES_cblock*, DES_cblock*, DES_key_schedule*, int); + +void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX*, void* userdata); +void SSL_SESSION_free(SSL_SESSION* session); +int SSL_peek(SSL* ssl, void* buf, int num); + +X509* SSL_get_certificate(SSL* ssl); +EVP_PKEY* SSL_get_privatekey(SSL* ssl); +EVP_PKEY* X509_get_pubkey(X509* x); + +int EVP_PKEY_copy_parameters(EVP_PKEY* to, const EVP_PKEY* from); +void EVP_PKEY_free(EVP_PKEY* pkey); +void ERR_error_string_n(unsigned long e, char *buf, size_t len); +void ERR_free_strings(void); +void EVP_cleanup(void); + +void* X509_get_ext_d2i(X509* x, int nid, int* crit, int* idx); + +#define GEN_IPADD 7 +#define NID_subject_alt_name 85 +#define STACK_OF(x) x + + +/* defined here because libcurl dereferences */ +typedef struct ASN1_STRING { + int type; + int length; + unsigned char* data; +} ASN1_STRING; + + +typedef struct GENERAL_NAME { + int type; + union { + ASN1_STRING* ia5; + } d; +} GENERAL_NAME; + +void GENERAL_NAMES_free(STACK_OF(GENERAL_NAME) *x); + +int sk_GENERAL_NAME_num(STACK_OF(GENERAL_NAME) *x); +GENERAL_NAME* sk_GENERAL_NAME_value(STACK_OF(GENERAL_NAME) *x, int i); + + +unsigned char* ASN1_STRING_data(ASN1_STRING* x); +int ASN1_STRING_length(ASN1_STRING* x); +int ASN1_STRING_type(ASN1_STRING *x); + +typedef ASN1_STRING X509_NAME_ENTRY; + +int X509_NAME_get_index_by_NID(X509_NAME* name,int nid, int lastpos); + +ASN1_STRING* X509_NAME_ENTRY_get_data(X509_NAME_ENTRY* ne); +X509_NAME_ENTRY* X509_NAME_get_entry(X509_NAME* name, int loc); + +#define OPENSSL_malloc(x) malloc(x) +#define OPENSSL_free(x) free(x) + +int ASN1_STRING_to_UTF8(unsigned char** out, ASN1_STRING* in); + +SSL_METHOD* SSLv23_client_method(void); /* doesn't actually roll back */ +SSL_METHOD* SSLv2_client_method(void); /* will never work, no v 2 */ + + +SSL_SESSION* SSL_get1_session(SSL* ssl); /* what's ref count */ + + +#define CRYPTO_free(x) free(x) +#define ASN1_TIME ASN1_STRING + +ASN1_TIME* X509_get_notBefore(X509* x); +ASN1_TIME* X509_get_notAfter(X509* x); + + +#define ASN1_UTCTIME ASN1_STRING +#define NID_commonName 13 +#define V_ASN1_UTF8STRING 12 +#define GEN_DNS 2 + + +typedef struct MD4_CTX { + int buffer[32]; /* big enough to hold, check size in Init */ +} MD4_CTX; + +void MD4_Init(MD4_CTX*); +void MD4_Update(MD4_CTX*, const void*, unsigned long); +void MD4_Final(unsigned char*, MD4_CTX*); + + +typedef struct MD5_CTX { + int buffer[32]; /* big enough to hold, check size in Init */ +} MD5_CTX; + +void MD5_Init(MD5_CTX*); +void MD5_Update(MD5_CTX*, const void*, unsigned long); +void MD5_Final(unsigned char*, MD5_CTX*); + +#define MD5_DIGEST_LENGTH 16 + + #define SSL_DEFAULT_CIPHER_LIST "" /* default all */ Added: dcplusplus/trunk/yassl/include/openssl/x509.h =================================================================== --- dcplusplus/trunk/yassl/include/openssl/x509.h (rev 0) +++ dcplusplus/trunk/yassl/include/openssl/x509.h 2006-07-02 16:52:24 UTC (rev 623) @@ -0,0 +1 @@ +/* x509.h for libcurl */ Added: dcplusplus/trunk/yassl/include/openssl/x509v3.h =================================================================== --- dcplusplus/trunk/yassl/include/openssl/x509v3.h (rev 0) +++ dcplusplus/trunk/yassl/include/openssl/x509v3.h 2006-07-02 16:52:24 UTC (rev 623) @@ -0,0 +1 @@ +/* x509v3.h for libcurl */ Modified: dcplusplus/trunk/yassl/include/socket_wrapper.hpp =================================================================== --- dcplusplus/trunk/yassl/include/socket_wrapper.hpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/include/socket_wrapper.hpp 2006-07-02 16:52:24 UTC (rev 623) @@ -66,6 +66,7 @@ // Wraps Windows Sockets and BSD Sockets class Socket { socket_t socket_; // underlying socket descriptor + bool wouldBlock_; // for non-blocking data public: explicit Socket(socket_t s = INVALID_SOCKET); ~Socket(); @@ -75,9 +76,10 @@ socket_t get_fd() const; uint send(const byte* buf, unsigned int len, int flags = 0) const; - uint receive(byte* buf, unsigned int len, int flags = 0) const; + uint receive(byte* buf, unsigned int len, int flags = 0); - bool wait() const; + bool wait(); + bool WouldBlock() const; void closeSocket(); void shutDown(int how = SD_SEND); Modified: dcplusplus/trunk/yassl/include/yassl_error.hpp =================================================================== --- dcplusplus/trunk/yassl/include/yassl_error.hpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/include/yassl_error.hpp 2006-07-02 16:52:24 UTC (rev 623) @@ -26,7 +26,6 @@ #ifndef yaSSL_ERROR_HPP #define yaSSL_ERROR_HPP -#include "stdexcept.hpp" namespace yaSSL { @@ -63,7 +62,7 @@ void SetErrorString(YasslError, char*); - +/* remove for now, if go back to exceptions use this wrapper // Base class for all yaSSL exceptions class Error : public mySTL::runtime_error { YasslError error_; @@ -75,6 +74,7 @@ YasslError get_number() const; Library get_lib() const; }; +*/ } // naemspace Modified: dcplusplus/trunk/yassl/include/yassl_int.hpp =================================================================== --- dcplusplus/trunk/yassl/include/yassl_int.hpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/include/yassl_int.hpp 2006-07-02 16:52:24 UTC (rev 623) @@ -34,6 +34,7 @@ #include "cert_wrapper.hpp" #include "log.hpp" #include "lock.hpp" +#include "openssl/ssl.h" // ASN1_STRING and DH namespace yaSSL { @@ -121,8 +122,6 @@ friend sslFactory& GetSSL_Factory(); // singleton creator private: - static sslFactory instance_; - sslFactory(const sslFactory&); // hide copy sslFactory& operator=(const sslFactory&); // and assign }; @@ -132,28 +131,47 @@ // openSSL X509 names class X509_NAME { - char* name_; + char* name_; + size_t sz_; + ASN1_STRING entry_; public: X509_NAME(const char*, size_t sz); ~X509_NAME(); - char* GetName(); + char* GetName(); + ASN1_STRING* GetEntry(int i); private: X509_NAME(const X509_NAME&); // hide copy X509_NAME& operator=(const X509_NAME&); // and assign }; +class StringHolder { + ASN1_STRING asnString_; +public: + StringHolder(const char* str, int sz); + ~StringHolder(); + + ASN1_STRING* GetString(); +}; + + // openSSL X509 class X509 { X509_NAME issuer_; X509_NAME subject_; + StringHolder beforeDate_; // not valid before + StringHolder afterDate_; // not valid after public: - X509(const char* i, size_t, const char* s, size_t); + X509(const char* i, size_t, const char* s, size_t, + const char* b, int, const char* a, int); ~X509() {} X509_NAME* GetIssuer(); X509_NAME* GetSubject(); + + ASN1_STRING* GetBefore(); + ASN1_STRING* GetAfter(); private: X509(const X509&); // hide copy X509& operator=(const X509&); // and assign @@ -214,8 +232,6 @@ friend Sessions& GetSessions(); // singleton creator private: - static Sessions instance_; - Sessions(const Sessions&); // hide copy Sessions& operator=(const Sessions&); // and assign }; @@ -505,6 +521,7 @@ void makeTLSMasterSecret(); void addData(input_buffer* data); void fillData(Data&); + void PeekData(Data&); void addBuffer(output_buffer* b); void flushBuffer(); void verifyState(const RecordLayerHeader&); Modified: dcplusplus/trunk/yassl/include/yassl_types.hpp =================================================================== --- dcplusplus/trunk/yassl/include/yassl_types.hpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/include/yassl_types.hpp 2006-07-02 16:52:24 UTC (rev 623) @@ -34,6 +34,7 @@ namespace yaSSL { + #ifdef YASSL_PURE_C // library allocation Modified: dcplusplus/trunk/yassl/mySTL/helpers.hpp =================================================================== --- dcplusplus/trunk/yassl/mySTL/helpers.hpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/mySTL/helpers.hpp 2006-07-02 16:52:24 UTC (rev 623) @@ -28,14 +28,14 @@ #define mySTL_HELPERS_HPP #include <stdlib.h> -#include <new> // placement new +#ifdef _MSC_VER + #include <new> +#endif - - -#ifdef __IBMCPP__ /* Workaround for the lack of operator new(size_t, void*) in IBM VA C++ 6.0 + Also used as a workaround to avoid including <new> */ struct Dummy {}; @@ -44,12 +44,13 @@ return static_cast<void*>(d); } + // for compilers that want matching delete + inline void operator delete(void* ptr, Dummy* d) + { + } + typedef Dummy* yassl_pointer; -#else - typedef void* yassl_pointer; -#endif - namespace mySTL { Modified: dcplusplus/trunk/yassl/mySTL/list.hpp =================================================================== --- dcplusplus/trunk/yassl/mySTL/list.hpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/mySTL/list.hpp 2006-07-02 16:52:24 UTC (rev 623) @@ -164,7 +164,7 @@ { void* mem = malloc(sizeof(node)); if (!mem) abort(); - node* add = new (mem) node(t); + node* add = new (reinterpret_cast<yassl_pointer>(mem)) node(t); if (head_) { add->next_ = head_; @@ -210,7 +210,7 @@ { void* mem = malloc(sizeof(node)); if (!mem) abort(); - node* add = new (mem) node(t); + node* add = new (reinterpret_cast<yassl_pointer>(mem)) node(t); if (tail_) { tail_->next_ = add; Modified: dcplusplus/trunk/yassl/mySTL/vector.hpp =================================================================== --- dcplusplus/trunk/yassl/mySTL/vector.hpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/mySTL/vector.hpp 2006-07-02 16:52:24 UTC (rev 623) @@ -45,7 +45,8 @@ vector_base() : start_(0), finish_(0), end_of_storage_(0) {} vector_base(size_t n) { - start_ = static_cast<T*>(malloc(n * sizeof(T))); + // Don't allow malloc(0), if n is 0 use 1 + start_ = static_cast<T*>(malloc((n ? n : 1) * sizeof(T))); if (!start_) abort(); finish_ = start_; end_of_storage_ = start_ + n; Modified: dcplusplus/trunk/yassl/src/cert_wrapper.cpp =================================================================== --- dcplusplus/trunk/yassl/src/cert_wrapper.cpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/src/cert_wrapper.cpp 2006-07-02 16:52:24 UTC (rev 623) @@ -271,10 +271,13 @@ else peerKeyType_ = dsa_sa_algo; - int iSz = cert.GetIssuer() ? strlen(cert.GetIssuer()) + 1 : 0; - int sSz = cert.GetCommonName() ? strlen(cert.GetCommonName()) + 1 : 0; + int iSz = strlen(cert.GetIssuer()) + 1; + int sSz = strlen(cert.GetCommonName()) + 1; + int bSz = strlen(cert.GetBeforeDate()) + 1; + int aSz = strlen(cert.GetAfterDate()) + 1; peerX509_ = NEW_YS X509(cert.GetIssuer(), iSz, cert.GetCommonName(), - sSz); + sSz, cert.GetBeforeDate(), bSz, + cert.GetAfterDate(), aSz); } return 0; } Modified: dcplusplus/trunk/yassl/src/handshake.cpp =================================================================== --- dcplusplus/trunk/yassl/src/handshake.cpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/src/handshake.cpp 2006-07-02 16:52:24 UTC (rev 623) @@ -458,6 +458,11 @@ uint16 sz = ((b0 & 0x7f) << 8) | b1; + if (sz > input.get_remaining()) { + ssl.SetError(bad_input); + return; + } + // hashHandShake manually const opaque* buffer = input.get_buffer() + input.get_current(); ssl.useHashes().use_MD5().update(buffer, sz); @@ -650,16 +655,16 @@ } -mySTL::auto_ptr<input_buffer> null_buffer(ysDelete); // do process input requests mySTL::auto_ptr<input_buffer> DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered) { // wait for input if blocking - if (!ssl.getSocket().wait()) { + if (!ssl.useSocket().wait()) { ssl.SetError(receive_error); - return buffered = null_buffer; + buffered.reset(0); + return buffered; } uint ready = ssl.getSocket().get_ready(); if (!ready) return buffered; @@ -669,11 +674,11 @@ input_buffer buffer(buffSz + ready); if (buffSz) { buffer.assign(buffered.get()->get_buffer(), buffSz); - buffered = null_buffer; + buffered.reset(0); } - // add NEW_YS data - uint read = ssl.getSocket().receive(buffer.get_buffer() + buffSz, ready); + // add new data + uint read = ssl.useSocket().receive(buffer.get_buffer() + buffSz, ready); buffer.add_size(read); uint offset = 0; const MessageFactory& mf = ssl.getFactory().getMessage(); @@ -681,39 +686,56 @@ // old style sslv2 client hello? if (ssl.getSecurity().get_parms().entity_ == server_end && ssl.getStates().getServer() == clientNull) - if (buffer.peek() != handshake) + if (buffer.peek() != handshake) { ProcessOldClientHello(buffer, ssl); + if (ssl.GetError()) { + buffered.reset(0); + return buffered; + } + } while(!buffer.eof()) { // each record RecordLayerHeader hdr; - buffer >> hdr; - ssl.verifyState(hdr); + bool needHdr = false; + if (static_cast<uint>(RECORD_HEADER) > buffer.get_remaining()) + needHdr = true; + else { + buffer >> hdr; + ssl.verifyState(hdr); + } + // make sure we have enough input in buffer to process this record - if (hdr.length_ > buffer.get_remaining()) { - uint sz = buffer.get_remaining() + RECORD_HEADER; + if (needHdr || hdr.length_ > buffer.get_remaining()) { + // put header in front for next time processing + uint extra = needHdr ? 0 : RECORD_HEADER; + uint sz = buffer.get_remaining() + extra; buffered.reset(NEW_YS input_buffer(sz, buffer.get_buffer() + - buffer.get_current() - RECORD_HEADER, sz)); + buffer.get_current() - extra, sz)); break; } while (buffer.get_current() < hdr.length_ + RECORD_HEADER + offset) { - // each message in record + // each message in record, can be more than 1 if not encrypted if (ssl.getSecurity().get_parms().pending_ == false) // cipher on decrypt_message(ssl, buffer, hdr.length_); mySTL::auto_ptr<Message> msg(mf.CreateObject(hdr.type_), ysDelete); if (!msg.get()) { ssl.SetError(factory_error); - return buffered = null_buffer; + buffered.reset(0); + return buffered; } buffer >> *msg; msg->Process(buffer, ssl); - if (ssl.GetError()) return buffered = null_buffer; + if (ssl.GetError()) { + buffered.reset(0); + return buffered; + } } offset += hdr.length_ + RECORD_HEADER; } - return buffered; // done, don't call again + return buffered; } @@ -854,8 +876,11 @@ // send data int sendData(SSL& ssl, const void* buffer, int sz) { + if (ssl.GetError() == YasslError(SSL_ERROR_WANT_READ)) + ssl.SetError(no_error); + ssl.verfiyHandShakeComplete(); - if (ssl.GetError()) return 0; + if (ssl.GetError()) return -1; int sent = 0; for (;;) { @@ -866,7 +891,7 @@ buildMessage(ssl, out, data); ssl.Send(out.get_buffer(), out.get_size()); - if (ssl.GetError()) return 0; + if (ssl.GetError()) return -1; sent += len; if (sent == sz) break; } @@ -887,17 +912,29 @@ // process input data -int receiveData(SSL& ssl, Data& data) +int receiveData(SSL& ssl, Data& data, bool peek) { + if (ssl.GetError() == YasslError(SSL_ERROR_WANT_READ)) + ssl.SetError(no_error); + ssl.verfiyHandShakeComplete(); - if (ssl.GetError()) return 0; + if (ssl.GetError()) return -1; if (!ssl.bufferedData()) processReply(ssl); - ssl.fillData(data); + + if (peek) + ssl.PeekData(data); + else + ssl.fillData(data); + ssl.useLog().ShowData(data.get_length()); + if (ssl.GetError()) return -1; - if (ssl.GetError()) return 0; + if (data.get_length() == 0 && ssl.getSocket().WouldBlock()) { + ssl.SetError(YasslError(SSL_ERROR_WANT_READ)); + return SSL_WOULD_BLOCK; + } return data.get_length(); } Modified: dcplusplus/trunk/yassl/src/socket_wrapper.cpp =================================================================== --- dcplusplus/trunk/yassl/src/socket_wrapper.cpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/src/socket_wrapper.cpp 2006-07-02 16:52:24 UTC (rev 623) @@ -39,7 +39,7 @@ #include <string.h> #endif // _WIN32 -#ifdef __sun +#if defined(__sun) || defined(__SCO_VERSION__) #include <sys/filio.h> #endif @@ -58,7 +58,7 @@ Socket::Socket(socket_t s) - : socket_(s) + : socket_(s), wouldBlock_(false) {} @@ -95,11 +95,15 @@ uint Socket::get_ready() const { +#ifdef _WIN32 unsigned long ready = 0; - -#ifdef _WIN32 ioctlsocket(socket_, FIONREAD, &ready); #else + /* + 64-bit Solaris requires the variable passed to + FIONREAD be a 32-bit value. + */ + unsigned int ready = 0; ioctl(socket_, FIONREAD, &ready); #endif @@ -109,26 +113,39 @@ uint Socket::send(const byte* buf, unsigned int sz, int flags) const { + const byte* pos = buf; + const byte* end = pos + sz; + assert(socket_ != INVALID_SOCKET); - int sent = ::send(socket_, reinterpret_cast<const char *>(buf), sz, flags); - if (sent == -1) - return 0; + while (pos != end) { + int sent = ::send(socket_, reinterpret_cast<const char *>(pos), + static_cast<int>(end - pos), flags); - return sent; + if (sent == -1) + return 0; + + pos += sent; + } + + return sz; } -uint Socket::receive(byte* buf, unsigned int sz, int flags) const +uint Socket::receive(byte* buf, unsigned int sz, int flags) { assert(socket_ != INVALID_SOCKET); + wouldBlock_ = false; + int recvd = ::recv(socket_, reinterpret_cast<char *>(buf), sz, flags); // idea to seperate error from would block by arn...@gm... if (recvd == -1) { if (get_lastError() == SOCKET_EWOULDBLOCK || - get_lastError() == SOCKET_EAGAIN) + get_lastError() == SOCKET_EAGAIN) { + wouldBlock_ = true; return 0; + } } else if (recvd == 0) return static_cast<uint>(-1); @@ -138,7 +155,7 @@ // wait if blocking for input, return false for error -bool Socket::wait() const +bool Socket::wait() { byte b; return receive(&b, 1, MSG_PEEK) != static_cast<uint>(-1); @@ -162,6 +179,12 @@ } +bool Socket::WouldBlock() const +{ + return wouldBlock_; +} + + void Socket::set_lastError(int errorCode) { #ifdef _WIN32 Modified: dcplusplus/trunk/yassl/src/ssl.cpp =================================================================== --- dcplusplus/trunk/yassl/src/ssl.cpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/src/ssl.cpp 2006-07-02 16:52:24 UTC (rev 623) @@ -1,4 +1,4 @@ -/* ssl.cpp + /* ssl.cpp * * Copyright (C) 2003 Sawtooth Consulting Ltd. * @@ -35,6 +35,8 @@ #include "openssl/ssl.h" #include "handshake.hpp" #include "yassl_int.hpp" +#include "md5.hpp" // for TaoCrypt MD5 size assert +#include "md4.hpp" // for TaoCrypt MD4 size assert #include <stdio.h> #ifdef _WIN32 @@ -51,6 +53,53 @@ using mySTL::min; +int read_file(SSL_CTX* ctx, const char* file, int format, CertType type) +{ + if (format != SSL_FILETYPE_ASN1 && format != SSL_FILETYPE_PEM) + return SSL_BAD_FILETYPE; + + FILE* input = fopen(file, "rb"); + if (!input) + return SSL_BAD_FILE; + + if (type == CA) { + x509* ptr = PemToDer(file, Cert); + if (!ptr) { + fclose(input); + return SSL_BAD_FILE; + } + ctx->AddCA(ptr); // takes ownership + } + else { + x509*& x = (type == Cert) ? ctx->certificate_ : ctx->privateKey_; + + if (format == SSL_FILETYPE_ASN1) { + fseek(input, 0, SEEK_END); + long sz = ftell(input); + rewind(input); + x = NEW_YS x509(sz); // takes ownership + size_t bytes = fread(x->use_buffer(), sz, 1, input); + if (bytes != 1) { + fclose(input); + return SSL_BAD_FILE; + } + } + else { + x = PemToDer(file, type); + if (!x) { + fclose(input); + return SSL_BAD_FILE; + } + } + } + fclose(input); + return SSL_SUCCESS; +} + + +extern "C" { + + SSL_METHOD* SSLv3_method() { return SSLv3_client_method(); @@ -447,50 +496,6 @@ } -int read_file(SSL_CTX* ctx, const char* file, int format, CertType type) -{ - if (format != SSL_FILETYPE_ASN1 && format != SSL_FILETYPE_PEM) - return SSL_BAD_FILETYPE; - - FILE* input = fopen(file, "rb"); - if (!input) - return SSL_BAD_FILE; - - if (type == CA) { - x509* ptr = PemToDer(file, Cert); - if (!ptr) { - fclose(input); - return SSL_BAD_FILE; - } - ctx->AddCA(ptr); // takes ownership - } - else { - x509*& x = (type == Cert) ? ctx->certificate_ : ctx->privateKey_; - - if (format == SSL_FILETYPE_ASN1) { - fseek(input, 0, SEEK_END); - long sz = ftell(input); - rewind(input); - x = NEW_YS x509(sz); // takes ownership - size_t bytes = fread(x->use_buffer(), sz, 1, input); - if (bytes != 1) { - fclose(input); - return SSL_BAD_FILE; - } - } - else { - x = PemToDer(file, type); - if (!x) { - fclose(input); - return SSL_BAD_FILE; - } - } - } - fclose(input); - return SSL_SUCCESS; -} - - int SSL_CTX_use_certificate_file(SSL_CTX* ctx, const char* file, int format) { return read_file(ctx, file, format, Cert); @@ -722,6 +727,12 @@ {} +int SSL_library_init() // compatiblity only +{ + return 1; +} + + DH* DH_new(void) { DH* dh = NEW_YS DH; @@ -799,27 +810,34 @@ const EVP_MD* EVP_md5(void) { - // TODO: FIX add to some list for destruction - return NEW_YS MD5; + static const char* type = "MD5"; + return type; } const EVP_CIPHER* EVP_des_ede3_cbc(void) { - // TODO: FIX add to some list for destruction - return NEW_YS DES_EDE; + static const char* type = "DES_EDE3_CBC"; + return type; } int EVP_BytesToKey(const EVP_CIPHER* type, const EVP_MD* md, const byte* salt, const byte* data, int sz, int count, byte* key, byte* iv) { - EVP_MD* myMD = const_cast<EVP_MD*>(md); - uint digestSz = myMD->get_digestSize(); + // only support MD5 for now + if (strncmp(md, "MD5", 3)) return 0; + + // only support DES_EDE3_CBC for now + if (strncmp(type, "DES_EDE3_CBC", 12)) return 0; + + yaSSL::MD5 myMD; + uint digestSz = myMD.get_digestSize(); byte digest[SHA_LEN]; // max size - int keyLen = type->get_keySize(); - int ivLen = type->get_ivSize(); + yaSSL::DES_EDE cipher; + int keyLen = cipher.get_keySize(); + int ivLen = cipher.get_ivSize(); int keyLeft = keyLen; int ivLeft = ivLen; int keyOutput = 0; @@ -828,17 +846,17 @@ int digestLeft = digestSz; // D_(i - 1) if (keyOutput) // first time D_0 is empty - myMD->update(digest, digestSz); + myMD.update(digest, digestSz); // data - myMD->update(data, sz); + myMD.update(data, sz); // salt if (salt) - myMD->update(salt, EVP_SALT_SZ); - myMD->get_digest(digest); + myMD.update(salt, EVP_SALT_SZ); + myMD.get_digest(digest); // count for (int j = 1; j < count; j++) { - myMD->update(digest, digestSz); - myMD->get_digest(digest); + myMD.update(digest, digestSz); + myMD.get_digest(digest); } if (keyLeft) { @@ -892,6 +910,303 @@ } +// functions for libcurl +int RAND_status() +{ + return 1; /* TaoCrypt provides enough seed */ +} + + +int DES_set_key(const_DES_cblock* key, DES_key_schedule* schedule) +{ + memcpy(schedule, key, sizeof(const_DES_cblock)); + return 1; +} + + +void DES_set_odd_parity(DES_cblock* key) +{ + // not needed now for TaoCrypt +} + + +void DES_ecb_encrypt(DES_cblock* input, DES_cblock* output, + DES_key_schedule* key, int enc) +{ + DES des; + + if (enc) { + des.set_encryptKey(*key, 0); + des.encrypt(*output, *input, DES_BLOCK); + } + else { + des.set_decryptKey(*key, 0); + des.decrypt(*output, *input, DES_BLOCK); + } +} + + +void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX*, void* userdata) +{ + // yaSSL doesn't support yet, unencrypt your PEM file with userdata + // before handing off to yaSSL +} + + +X509* SSL_get_certificate(SSL* ssl) +{ + // only used to pass to get_privatekey which isn't used + return 0; +} + + +EVP_PKEY* SSL_get_privatekey(SSL* ssl) +{ + // only called, not used + return 0; +} + + +void SSL_SESSION_free(SSL_SESSION* session) +{ + // managed by singleton +} + + + +EVP_PKEY* X509_get_pubkey(X509* x) +{ + // called, not used though + return 0; +} + + +int EVP_PKEY_copy_parameters(EVP_PKEY* to, const EVP_PKEY* from) +{ + // called, not used though + return 0; +} + + +void EVP_PKEY_free(EVP_PKEY* pkey) +{ + // never allocated from above +} + + +void ERR_error_string_n(unsigned long e, char *buf, size_t len) +{ + if (len) ERR_error_string(e, buf); +} + + +void ERR_free_strings(void) +{ + // handled internally +} + + +void EVP_cleanup(void) +{ + // nothing to do yet +} + + +ASN1_TIME* X509_get_notBefore(X509* x) +{ + if (x) return x->GetBefore(); + return 0; +} + + +ASN1_TIME* X509_get_notAfter(X509* x) +{ + if (x) return x->GetAfter(); + return 0; +} + + +SSL_METHOD* SSLv23_client_method(void) /* doesn't actually roll back */ +{ + return SSLv3_client_method(); +} + + +SSL_METHOD* SSLv2_client_method(void) /* will never work, no v 2 */ +{ + return 0; +} + + +SSL_SESSION* SSL_get1_session(SSL* ssl) /* what's ref count */ +{ + return SSL_get_session(ssl); +} + + +void GENERAL_NAMES_free(STACK_OF(GENERAL_NAME) *x) +{ + // no extension names supported yet +} + + +int sk_GENERAL_NAME_num(STACK_OF(GENERAL_NAME) *x) +{ + // no extension names supported yet + return 0; +} + + +GENERAL_NAME* sk_GENERAL_NAME_value(STACK_OF(GENERAL_NAME) *x, int i) +{ + // no extension names supported yet + return 0; +} + + +unsigned char* ASN1_STRING_data(ASN1_STRING* x) +{ + if (x) return x->data; + return 0; +} + + +int ASN1_STRING_length(ASN1_STRING* x) +{ + if (x) return x->length; + return 0; +} + + +int ASN1_STRING_type(ASN1_STRING *x) +{ + if (x) return x->type; + return 0; +} + + +int X509_NAME_get_index_by_NID(X509_NAME* name,int nid, int lastpos) +{ + int idx = -1; // not found + const char* start = &name->GetName()[lastpos + 1]; + + switch (nid) { + case NID_commonName: + const char* found = strstr(start, "/CN="); + if (found) { + found += 4; // advance to str + idx = found - start + lastpos + 1; + } + break; + } + + return idx; +} + + +ASN1_STRING* X509_NAME_ENTRY_get_data(X509_NAME_ENTRY* ne) +{ + // the same in yaSSL + return ne; +} + + +X509_NAME_ENTRY* X509_NAME_get_entry(X509_NAME* name, int loc) +{ + return name->GetEntry(loc); +} + + +// already formatted, caller responsible for freeing *out +int ASN1_STRING_to_UTF8(unsigned char** out, ASN1_STRING* in) +{ + if (!in) return 0; + + *out = (unsigned char*)malloc(in->length + 1); + if (*out) { + memcpy(*out, in->data, in->length); + (*out)[in->length] = 0; + } + return in->length; +} + + +void* X509_get_ext_d2i(X509* x, int nid, int* crit, int* idx) +{ + // no extensions supported yet + return 0; +} + + +void MD4_Init(MD4_CTX* md4) +{ + // make sure we have a big enough buffer + typedef char ok[sizeof(md4->buffer) >= sizeof(TaoCrypt::MD4) ? 1 : -1]; + (void) sizeof(ok); + + // using TaoCrypt since no dynamic memory allocated + // and no destructor will be called + new (reinterpret_cast<yassl_pointer>(md4->buffer)) TaoCrypt::MD4(); +} + + +void MD4_Update(MD4_CTX* md4, const void* data, unsigned long sz) +{ + reinterpret_cast<TaoCrypt::MD4*>(md4->buffer)->Update( + static_cast<const byte*>(data), static_cast<unsigned int>(sz)); +} + + +void MD4_Final(unsigned char* hash, MD4_CTX* md4) +{ + reinterpret_cast<TaoCrypt::MD4*>(md4->buffer)->Final(hash); +} + + +void MD5_Init(MD5_CTX* md5) +{ + // make sure we have a big enough buffer + typedef char ok[sizeof(md5->buffer) >= sizeof(TaoCrypt::MD5) ? 1 : -1]; + (void) sizeof(ok); + + // using TaoCrypt since no dynamic memory allocated + // and no destructor will be called + new (reinterpret_cast<yassl_pointer>(md5->buffer)) TaoCrypt::MD5(); +} + + +void MD5_Update(MD5_CTX* md5, const void* data, unsigned long sz) +{ + reinterpret_cast<TaoCrypt::MD5*>(md5->buffer)->Update( + static_cast<const byte*>(data), static_cast<unsigned int>(sz)); +} + + +void MD5_Final(unsigned char* hash, MD5_CTX* md5) +{ + reinterpret_cast<TaoCrypt::MD5*>(md5->buffer)->Final(hash); +} + + +int RAND_bytes(unsigned char* buf, int num) +{ + RandomPool ran; + + if (ran.GetError()) return 0; + + ran.Fill(buf, num); + return 1; +} + + +int SSL_peek(SSL* ssl, void* buffer, int sz) +{ + Data data(min(sz, MAX_RECORD_SIZE), static_cast<opaque*>(buffer)); + return receiveData(*ssl, data, true); +} + + + // functions for stunnel void RAND_screen() @@ -1093,8 +1408,10 @@ } - void SSLeay_add_ssl_algorithms() // compatibility only - {} + int SSLeay_add_ssl_algorithms() // compatibility only + { + return 1; + } void ERR_remove_state(unsigned long) @@ -1124,4 +1441,5 @@ // end stunnel needs +} // extern "C" } // namespace Modified: dcplusplus/trunk/yassl/src/template_instnt.cpp =================================================================== --- dcplusplus/trunk/yassl/src/template_instnt.cpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/src/template_instnt.cpp 2006-07-02 16:52:24 UTC (rev 623) @@ -35,13 +35,6 @@ #include "openssl/ssl.h" #ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION -#if !defined(USE_CRYPTOPP_LIB) -namespace TaoCrypt { -template class HMAC<MD5>; -template class HMAC<SHA>; -template class HMAC<RIPEMD160>; -} -#endif // USE_CRYPTOPP_LIB namespace mySTL { template class list<unsigned char*>; @@ -58,12 +51,16 @@ template class list<yaSSL::input_buffer*>; template class list<yaSSL::output_buffer*>; template class list<yaSSL::x509*>; +template class list<yaSSL::Digest*>; +template class list<yaSSL::BulkCipher*>; template void destroy<mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*>(mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*, mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*); template yaSSL::del_ptr_zero for_each<mySTL::list<TaoCrypt::Signer*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<TaoCrypt::Signer*>::iterator, mySTL::list<TaoCrypt::Signer*>::iterator, yaSSL::del_ptr_zero); template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::SSL_SESSION*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::SSL_SESSION*>::iterator, mySTL::list<yaSSL::SSL_SESSION*>::iterator, yaSSL::del_ptr_zero); template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::input_buffer*>::iterator, mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::del_ptr_zero); template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::output_buffer*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::output_buffer*>::iterator, mySTL::list<yaSSL::output_buffer*>::iterator, yaSSL::del_ptr_zero); template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::x509*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::x509*>::iterator, mySTL::list<yaSSL::x509*>::iterator, yaSSL::del_ptr_zero); +template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::Digest*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::Digest*>::iterator, mySTL::list<yaSSL::Digest*>::iterator, yaSSL::del_ptr_zero); +template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::BulkCipher*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::BulkCipher*>::iterator, mySTL::list<yaSSL::BulkCipher*>::iterator, yaSSL::del_ptr_zero); } namespace yaSSL { @@ -87,6 +84,8 @@ template void ysDelete<Digest>(Digest*); template void ysDelete<X509>(X509*); template void ysDelete<Message>(Message*); +template void ysDelete<sslFactory>(sslFactory*); +template void ysDelete<Sessions>(Sessions*); template void ysArrayDelete<unsigned char>(unsigned char*); template void ysArrayDelete<char>(char*); } Modified: dcplusplus/trunk/yassl/src/timer.cpp =================================================================== --- dcplusplus/trunk/yassl/src/timer.cpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/src/timer.cpp 2006-07-02 16:52:24 UTC (rev 623) @@ -26,13 +26,17 @@ #include "runtime.hpp" #include "timer.hpp" +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#else +#include <sys/time.h> +#endif + namespace yaSSL { #ifdef _WIN32 - #define WIN32_LEAN_AND_MEAN - #include <windows.h> - timer_d timer() { static bool init(false); @@ -57,8 +61,6 @@ #else // _WIN32 - #include <sys/time.h> - timer_d timer() { struct timeval tv; Modified: dcplusplus/trunk/yassl/src/yassl.cpp =================================================================== --- dcplusplus/trunk/yassl/src/yassl.cpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/src/yassl.cpp 2006-07-02 16:52:24 UTC (rev 623) @@ -31,7 +31,7 @@ #include "openssl/ssl.h" // get rid of this -/* + // yaSSL overloads hide these void* operator new[](size_t sz) { @@ -43,7 +43,7 @@ ::operator delete(ptr); } -*/ + namespace yaSSL { using mySTL::min; Modified: dcplusplus/trunk/yassl/src/yassl_error.cpp =================================================================== --- dcplusplus/trunk/yassl/src/yassl_error.cpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/src/yassl_error.cpp 2006-07-02 16:52:24 UTC (rev 623) @@ -26,10 +26,13 @@ #include "runtime.hpp" #include "yassl_error.hpp" #include "error.hpp" // TaoCrypt error numbers +#include "openssl/ssl.h" // SSL_ERROR_WANT_READ +#include <string.h> // strncpy namespace yaSSL { +/* may bring back in future Error::Error(const char* s, YasslError e, Library l) : mySTL::runtime_error(s), error_(e), lib_(l) { @@ -47,6 +50,7 @@ return lib_; } +*/ void SetErrorString(YasslError error, char* buffer) @@ -115,7 +119,12 @@ case certificate_error : strncpy(buffer, "unable to proccess cerificate", max); - break; + break; + + // openssl errors + case SSL_ERROR_WANT_READ : + strncpy(buffer, "the read operation would block", max); + break; // TaoCrypt errors case NO_ERROR : Modified: dcplusplus/trunk/yassl/src/yassl_imp.cpp =================================================================== --- dcplusplus/trunk/yassl/src/yassl_imp.cpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/src/yassl_imp.cpp 2006-07-02 16:52:24 UTC (rev 623) @@ -1329,7 +1329,8 @@ // Compression hello.comp_len_ = input[AUTO]; - hello.compression_methods_ = CompressionMethod(input[AUTO]); + while (hello.comp_len_--) // ignore for now + hello.compression_methods_ = CompressionMethod(input[AUTO]); return input; } @@ -1974,7 +1975,9 @@ : pre_master_secret_(0), sequence_number_(0), peer_sequence_number_(0), pre_secret_len_(0), send_server_key_(false), master_clean_(false), TLS_(v.major_ >= 3 && v.minor_ >= 1), version_(v), random_(ran) -{} +{ + memset(sessionID_, 0, sizeof(sessionID_)); +} Connection::~Connection() Modified: dcplusplus/trunk/yassl/src/yassl_int.cpp =================================================================== --- dcplusplus/trunk/yassl/src/yassl_int.cpp 2006-06-19 19:16:49 UTC (rev 622) +++ dcplusplus/trunk/yassl/src/yassl_int.cpp 2006-07-02 16:52:24 UTC (rev 623) @@ -28,7 +28,6 @@ #include "yassl_int.hpp" #include "handshake.hpp" #include "timer.hpp" -#include "openssl/ssl.h" // for DH #ifdef YASSL_PURE_C @@ -987,6 +986,36 @@ } +// like Fill but keep data in buffer +void SSL::PeekData(Data& data) +{ + if (GetError()) return; + uint dataSz = data.get_length(); // input, data size to fill + uint elements = buffers_.getData().size(); + + data.set_length(0); // output, actual data filled + dataSz = min(dataSz, bufferedData()); + + Buffers::inputList::iterator front = buffers_.getData().begin(); + + while (elements) { + uint frontSz = (*front)->get_remaining(); + uint readSz = min(dataSz - data.get_length(), frontSz); + uint before = (*front)->get_current(); + + (*front)->read(data.set_buffer() + data.get_length(), readSz); + data.set_length(data.get_length() + readSz); + (*front)->set_current(before); + + if (data.get_length() == dataSz) + break; + + elements--; + front++; + } +} + + // flush output buffer void SSL::flushBuffer() { @@ -1363,22 +1392,27 @@ } -Sessions Sessions::instance_; // simple singleton +static Sessions* sessionsInstance = 0; Sessions& GetSessions() { - return Sessions::instance_; + if (!sessionsInstance) + sessionsInstance = NEW_YS Sessions; + return *sessionsInstance; } -sslFactory sslFactory::instance_; // simple singleton +static sslFactory* sslFactoryInstance = 0; sslFactory& GetSSL_Factory() -{ - return sslFactory::instance_; +{ + if (!sslFactoryInstance) + sslFactoryInstance = NEW_YS sslFactory; + retur... [truncated message content] |
From: <arn...@us...> - 2006-06-19 19:17:14
|
Revision: 622 Author: arnetheduck Date: 2006-06-19 12:16:49 -0700 (Mon, 19 Jun 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=622&view=rev Log Message: ----------- Fixes / patches Modified Paths: -------------- dcplusplus/trunk/DCPlusPlus.rc dcplusplus/trunk/Example.xml dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/ClientManager.cpp dcplusplus/trunk/client/NmdcHub.cpp dcplusplus/trunk/client/Util.cpp dcplusplus/trunk/client/Util.h dcplusplus/trunk/client/version.h dcplusplus/trunk/windows/ExListViewCtrl.cpp dcplusplus/trunk/windows/ExListViewCtrl.h dcplusplus/trunk/windows/HubFrame.cpp dcplusplus/trunk/windows/WinUtil.cpp dcplusplus/trunk/windows/WinUtil.h Modified: dcplusplus/trunk/DCPlusPlus.rc =================================================================== --- dcplusplus/trunk/DCPlusPlus.rc 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/DCPlusPlus.rc 2006-06-19 19:16:49 UTC (rev 622) @@ -933,8 +933,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,6,9,1 - PRODUCTVERSION 0,6,9,1 + FILEVERSION 0,6,9,2 + PRODUCTVERSION 0,6,9,2 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -951,12 +951,12 @@ BEGIN VALUE "Comments", "http://dcplusplus.sourceforge.net" VALUE "FileDescription", "DC++" - VALUE "FileVersion", "0, 6, 9, 1" + VALUE "FileVersion", "0, 6, 9, 2" VALUE "InternalName", "DC++" VALUE "LegalCopyright", "Copyright 2001-2006 Jacek Sieka" VALUE "OriginalFilename", "DCPlusPlus.exe" VALUE "ProductName", "DC++" - VALUE "ProductVersion", "0, 6, 9, 1" + VALUE "ProductVersion", "0, 6, 9, 2" END END BLOCK "VarFileInfo" Modified: dcplusplus/trunk/Example.xml =================================================================== --- dcplusplus/trunk/Example.xml 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/Example.xml 2006-06-19 19:16:49 UTC (rev 622) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> -<Language Name="Example Language" Author="arnetheduck" Version="0.691" Revision="1" RightToLeft="0"> +<Language Name="Example Language" Author="arnetheduck" Version="0.692" Revision="1" RightToLeft="0"> <Strings> <String Name="Active">Active</String> <String Name="ActiveSearchString">Enabled / Search String</String> Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/changelog.txt 2006-06-19 19:16:49 UTC (rev 622) @@ -23,7 +23,11 @@ * Fixed targetdrive bug for temp target location * Fixed a crash bug when hash data cannot be saved * Possibly fixed issues with queue items not being updated +* Added warning when someone tries to spam hublist.org or dcpp.net with your client +* [bug 968] Fixed unix compile issue (thanks pothead) +* [bug 975] Fixed silly warning (thanks pothead) + -- 0.691 2006-06-03 -- * Links to bugzilla in html changelog * [bug 122] Added userlist filter (thanks trem) Modified: dcplusplus/trunk/client/ClientManager.cpp =================================================================== --- dcplusplus/trunk/client/ClientManager.cpp 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/client/ClientManager.cpp 2006-06-19 19:16:49 UTC (rev 622) @@ -29,6 +29,7 @@ #include "SimpleXML.h" #include "UserCommand.h" #include "ResourceManager.h" +#include "LogManager.h" #include "AdcHub.h" #include "NmdcHub.h" @@ -364,7 +365,15 @@ u_int16_t port = 0; Util::decodeUrl(aSeeker, ip, port, file); ip = Socket::resolve(ip); - if(port == 0) port = 412; + + // Temporary fix to avoid spamming hublist.org and dcpp.net + if(ip == "70.85.55.252" || ip == "207.44.220.108") { + LogManager::getInstance()->message("Someone is trying to use your client to spam " + ip + ", please urge hub owner to fix this"); + return; + } + + if(port == 0) + port = 412; for(SearchResult::Iter i = l.begin(); i != l.end(); ++i) { SearchResult* sr = *i; s.writeTo(ip, port, sr->toSR(*aClient)); Modified: dcplusplus/trunk/client/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/client/NmdcHub.cpp 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/client/NmdcHub.cpp 2006-06-19 19:16:49 UTC (rev 622) @@ -800,22 +800,6 @@ tmp.replace(i, 5, "&"); i++; } -#if 0 -/// @todo move this to a better place - if(checkNewLines) { - // Check all '<' and '[' after newlines... - i = 0; - while( (i = tmp.find('\n', i)) != string::npos) { - if(i + 1 < tmp.length()) { - if(tmp[i+1] == '[' || tmp[i+1] == '<') { - tmp.insert(i+1, "- "); - i += 2; - } - } - i++; - } - } -#endif } else { i = 0; while( (i = tmp.find("&", i)) != string::npos) { Modified: dcplusplus/trunk/client/Util.cpp =================================================================== --- dcplusplus/trunk/client/Util.cpp 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/client/Util.cpp 2006-06-19 19:16:49 UTC (rev 622) @@ -341,24 +341,6 @@ return buf; } -double Util::toBytes(TCHAR* aSize) { - double bytes = _tstof(aSize); - - if (_tcsstr(aSize, CTSTRING(PIB))) { - return bytes * 1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0; - } else if (_tcsstr(aSize, CTSTRING(TiB))) { - return bytes * 1024.0 * 1024.0 * 1024.0 * 1024.0; - } else if (_tcsstr(aSize, CTSTRING(GiB))) { - return bytes * 1024.0 * 1024.0 * 1024.0; - } else if (_tcsstr(aSize, CTSTRING(MiB))) { - return bytes * 1024.0 * 1024.0; - } else if (_tcsstr(aSize, CTSTRING(KiB))) { - return bytes * 1024.0; - } else { - return bytes; - } -} - string Util::formatExactSize(int64_t aBytes) { #ifdef _WIN32 TCHAR buf[64]; @@ -916,3 +898,19 @@ } return tmp2; } + +string Util::formatMessage(const string& nick, const string& message) { + string tmp = '<' + nick + "> " + message; + // Check all '<' and '[' after newlines as they're probably pasts... + size_t i = 0; + while( (i = tmp.find('\n', i)) != string::npos) { + if(i + 1 < tmp.length()) { + if(tmp[i+1] == '[' || tmp[i+1] == '<') { + tmp.insert(i+1, "- "); + i += 2; + } + } + i++; + } + return toDOS(tmp); +} \ No newline at end of file Modified: dcplusplus/trunk/client/Util.h =================================================================== --- dcplusplus/trunk/client/Util.h 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/client/Util.h 2006-06-19 19:16:49 UTC (rev 622) @@ -274,8 +274,7 @@ return formatBytes(toInt64(aString)); } - static double toBytes(TCHAR* aSize); - + static string formatMessage(const string& nick, const string& message); static string toDOS(const string& tmp); static string getShortTimeString(time_t t = time(NULL) ); Modified: dcplusplus/trunk/client/version.h =================================================================== --- dcplusplus/trunk/client/version.h 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/client/version.h 2006-06-19 19:16:49 UTC (rev 622) @@ -17,8 +17,8 @@ */ #define APPNAME "DC++" -#define VERSIONSTRING "0.691" -#define VERSIONFLOAT 0.691 +#define VERSIONSTRING "0.692" +#define VERSIONFLOAT 0.692 /* Update the .rc file as well... */ Modified: dcplusplus/trunk/windows/ExListViewCtrl.cpp =================================================================== --- dcplusplus/trunk/windows/ExListViewCtrl.cpp 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/windows/ExListViewCtrl.cpp 2006-06-19 19:16:49 UTC (rev 622) @@ -45,9 +45,9 @@ lvi.iItem = newPos; } int i = InsertItem(&lvi); - int j = 0; - for(TStringIter k = l.begin(); k != l.end(); ++k, j++) { - SetItemText(i, j, k->c_str()); + int m = 0; + for(TStringIter k = l.begin(); k != l.end(); ++k, m++) { + SetItemText(i, m, k->c_str()); } EnsureVisible(i, FALSE); Modified: dcplusplus/trunk/windows/ExListViewCtrl.h =================================================================== --- dcplusplus/trunk/windows/ExListViewCtrl.h 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/windows/ExListViewCtrl.h 2006-06-19 19:16:49 UTC (rev 622) @@ -23,8 +23,8 @@ #pragma once #endif // _MSC_VER > 1000 -#include "../client/Util.h" #include "ListViewArrows.h" +#include "WinUtil.h" class ExListViewCtrl : public CWindowImpl<ExListViewCtrl, CListViewCtrl, CControlWinTraits>, public ListViewArrows<ExListViewCtrl> @@ -147,7 +147,7 @@ } else if(result == SORT_BYTES) { p->GetItemText(na, p->sortColumn, buf, 128); p->GetItemText(nb, p->sortColumn, buf2, 128); - result = compare(Util::toBytes(buf), Util::toBytes(buf2)); + result = compare(WinUtil::toBytes(buf), WinUtil::toBytes(buf2)); } if(!p->ascending) result = -result; Modified: dcplusplus/trunk/windows/HubFrame.cpp =================================================================== --- dcplusplus/trunk/windows/HubFrame.cpp 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/windows/HubFrame.cpp 2006-06-19 19:16:49 UTC (rev 622) @@ -1250,7 +1250,7 @@ speak(SET_WINDOW_TITLE, hubName); } void HubFrame::on(Message, Client*, const OnlineUser& from, const string& msg) throw() { - speak(ADD_CHAT_LINE, Util::toDOS("<" + from.getIdentity().getNick() + "> " + msg)); + speak(ADD_CHAT_LINE, Util::formatMessage(from.getIdentity().getNick(), msg)); } void HubFrame::on(StatusMessage, Client*, const string& line) { @@ -1268,7 +1268,7 @@ } void HubFrame::on(PrivateMessage, Client*, const OnlineUser& from, const OnlineUser& to, const OnlineUser& replyTo, const string& line) throw() { - speak(from, to, replyTo, Util::toDOS("<" + from.getIdentity().getNick() + "> " + line)); + speak(from, to, replyTo, Util::formatMessage(from.getIdentity().getNick(), line)); } void HubFrame::on(NickTaken, Client*) throw() { speak(ADD_STATUS_LINE, STRING(NICK_TAKEN)); Modified: dcplusplus/trunk/windows/WinUtil.cpp =================================================================== --- dcplusplus/trunk/windows/WinUtil.cpp 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/windows/WinUtil.cpp 2006-06-19 19:16:49 UTC (rev 622) @@ -1113,6 +1113,24 @@ } } +double WinUtil::toBytes(TCHAR* aSize) { + double bytes = _tstof(aSize); + + if (_tcsstr(aSize, CTSTRING(PIB))) { + return bytes * 1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0; + } else if (_tcsstr(aSize, CTSTRING(TiB))) { + return bytes * 1024.0 * 1024.0 * 1024.0 * 1024.0; + } else if (_tcsstr(aSize, CTSTRING(GiB))) { + return bytes * 1024.0 * 1024.0 * 1024.0; + } else if (_tcsstr(aSize, CTSTRING(MiB))) { + return bytes * 1024.0 * 1024.0; + } else if (_tcsstr(aSize, CTSTRING(KiB))) { + return bytes * 1024.0; + } else { + return bytes; + } +} + int WinUtil::getOsMajor() { OSVERSIONINFOEX ver; memset(&ver, 0, sizeof(OSVERSIONINFOEX)); Modified: dcplusplus/trunk/windows/WinUtil.h =================================================================== --- dcplusplus/trunk/windows/WinUtil.h 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/windows/WinUtil.h 2006-06-19 19:16:49 UTC (rev 622) @@ -312,6 +312,8 @@ static int getDirIconIndex() { return dirIconIndex; } static int getDirMaskedIndex() { return dirMaskedIndex; } + + static double toBytes(TCHAR* aSize); static int getOsMajor(); static int getOsMinor(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-06-18 21:46:40
|
Revision: 621 Author: arnetheduck Date: 2006-06-18 14:46:33 -0700 (Sun, 18 Jun 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=621&view=rev Log Message: ----------- invalid asserts Modified Paths: -------------- dcplusplus/trunk/client/ShareManager.cpp Modified: dcplusplus/trunk/client/ShareManager.cpp =================================================================== --- dcplusplus/trunk/client/ShareManager.cpp 2006-06-18 16:50:11 UTC (rev 620) +++ dcplusplus/trunk/client/ShareManager.cpp 2006-06-18 21:46:33 UTC (rev 621) @@ -1180,7 +1180,6 @@ if(!newStr.get()) { newStr = auto_ptr<StringSearch::List>(new StringSearch::List(aStrings)); } - dcassert(find(newStr->begin(), newStr->end(), *k) != newStr->end()); newStr->erase(remove(newStr->begin(), newStr->end(), *k), newStr->end()); } } @@ -1312,7 +1311,6 @@ if(!newStr.get()) { newStr = auto_ptr<StringSearch::List>(new StringSearch::List(*cur)); } - dcassert(find(newStr->begin(), newStr->end(), *k) != newStr->end()); newStr->erase(remove(newStr->begin(), newStr->end(), *k), newStr->end()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-06-18 16:50:28
|
Revision: 620 Author: arnetheduck Date: 2006-06-18 09:50:11 -0700 (Sun, 18 Jun 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=620&view=rev Log Message: ----------- Reconnect fixes Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/AdcHub.cpp dcplusplus/trunk/client/AdcHub.h dcplusplus/trunk/client/BufferedSocket.cpp dcplusplus/trunk/client/BufferedSocket.h dcplusplus/trunk/client/Client.cpp dcplusplus/trunk/client/NmdcHub.cpp dcplusplus/trunk/client/NmdcHub.h dcplusplus/trunk/windows/HubFrame.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-06-18 15:13:10 UTC (rev 619) +++ dcplusplus/trunk/changelog.txt 2006-06-18 16:50:11 UTC (rev 620) @@ -22,6 +22,7 @@ * [ADC] Allowed $ and | in nick/description * Fixed targetdrive bug for temp target location * Fixed a crash bug when hash data cannot be saved +* Possibly fixed issues with queue items not being updated -- 0.691 2006-06-03 -- * Links to bugzilla in html changelog Modified: dcplusplus/trunk/client/AdcHub.cpp =================================================================== --- dcplusplus/trunk/client/AdcHub.cpp 2006-06-18 15:13:10 UTC (rev 619) +++ dcplusplus/trunk/client/AdcHub.cpp 2006-06-18 16:50:11 UTC (rev 620) @@ -354,12 +354,6 @@ } } -void AdcHub::disconnect(bool graceless) { - Client::disconnect(graceless); - state = STATE_PROTOCOL; - clearUsers(); -} - void AdcHub::hubMessage(const string& aMessage) { if(state != STATE_NORMAL) return; @@ -545,6 +539,8 @@ void AdcHub::on(Failed, const string& aLine) throw() { clearUsers(); + socket->removeListener(this); + state = STATE_PROTOCOL; fire(ClientListener::Failed(), this, aLine); } @@ -557,3 +553,10 @@ sendUDP(cmd); send(cmd.toString(sid)); } + +void AdcHub::on(Second, u_int32_t aTick) throw() { + if(getAutoReconnect() && state == STATE_PROTOCOL && (getLastActivity() + getReconnDelay() * 1000) < aTick) { + // Try to reconnect... + connect(); + } +} Modified: dcplusplus/trunk/client/AdcHub.h =================================================================== --- dcplusplus/trunk/client/AdcHub.h 2006-06-18 15:13:10 UTC (rev 619) +++ dcplusplus/trunk/client/AdcHub.h 2006-06-18 16:50:11 UTC (rev 620) @@ -33,10 +33,10 @@ class AdcHub : public Client, public CommandHandler<AdcHub> { public: using Client::send; + using Client::connect; virtual void connect(const OnlineUser& user); void connect(const OnlineUser& user, string const& token, bool secure); - virtual void disconnect(bool graceless); virtual void hubMessage(const string& aMessage); virtual void privateMessage(const OnlineUser& user, const string& aMessage); @@ -119,6 +119,8 @@ virtual void on(Connected) throw(); virtual void on(Line, const string& aLine) throw(); virtual void on(Failed, const string& aLine) throw(); + + virtual void on(Second, u_int32_t aTick) throw(); }; #endif // !defined(ADC_HUB_H) Modified: dcplusplus/trunk/client/BufferedSocket.cpp =================================================================== --- dcplusplus/trunk/client/BufferedSocket.cpp 2006-06-18 15:13:10 UTC (rev 619) +++ dcplusplus/trunk/client/BufferedSocket.cpp 2006-06-18 16:50:11 UTC (rev 620) @@ -459,6 +459,16 @@ return 0; } +void BufferedSocket::fail(const string& aError) { + if(sock) { + sock->disconnect(); + } + if(!failed) { + failed = true; + fire(BufferedSocketListener::Failed(), aError); + } +} + void BufferedSocket::shutdown() { if(sock) { Lock l(cs); Modified: dcplusplus/trunk/client/BufferedSocket.h =================================================================== --- dcplusplus/trunk/client/BufferedSocket.h 2006-06-18 15:13:10 UTC (rev 619) +++ dcplusplus/trunk/client/BufferedSocket.h 2006-06-18 16:50:11 UTC (rev 620) @@ -170,13 +170,7 @@ void threadSendData(); void threadDisconnect(); - void fail(const string& aError) { - if(sock) - sock->disconnect(); - fire(BufferedSocketListener::Failed(), aError); - failed = true; - } - + void fail(const string& aError); static size_t sockets; bool checkEvents(); Modified: dcplusplus/trunk/client/Client.cpp =================================================================== --- dcplusplus/trunk/client/Client.cpp 2006-06-18 15:13:10 UTC (rev 619) +++ dcplusplus/trunk/client/Client.cpp 2006-06-18 16:50:11 UTC (rev 620) @@ -109,7 +109,6 @@ void Client::disconnect(bool graceLess) { if(!socket) return; - socket->removeListener(this); socket->disconnect(graceLess); } @@ -158,9 +157,5 @@ return lip; } -void Client::on(Second, u_int32_t aTick) throw() { - if(getAutoReconnect() && !isConnected() && (getLastActivity() + getReconnDelay() * 1000) < aTick) { - // Try to reconnect... - connect(); - } +void Client::on(Second, u_int32_t) throw() { } Modified: dcplusplus/trunk/client/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/client/NmdcHub.cpp 2006-06-18 15:13:10 UTC (rev 619) +++ dcplusplus/trunk/client/NmdcHub.cpp 2006-06-18 16:50:11 UTC (rev 620) @@ -296,9 +296,9 @@ return; int type = Util::toInt(param.substr(i, j-i)) - 1; i = j + 1; - string terms = param.substr(i); + string terms = unescape(param.substr(i)); - if(param.size() > 0) { + if(terms.size() > 0) { if(seeker.compare(0, 4, "Hub:") == 0) { OnlineUser* u = findUser(seeker.substr(4)); @@ -312,7 +312,7 @@ } } - fire(ClientListener::NmdcSearch(), this, seeker, a, Util::toInt64(size), type, param); + fire(ClientListener::NmdcSearch(), this, seeker, a, Util::toInt64(size), type, terms); } } else if(cmd == "$MyINFO") { string::size_type i, j; @@ -760,18 +760,12 @@ } } -void NmdcHub::disconnect(bool graceless) throw() { - Client::disconnect(graceless); - state = STATE_CONNECT; - clearUsers(); -} - void NmdcHub::search(int aSizeType, int64_t aSize, int aFileType, const string& aString, const string&) { checkstate(); AutoArray<char> buf((char*)NULL); char c1 = (aSizeType == SearchManager::SIZE_DONTCARE) ? 'F' : 'T'; char c2 = (aSizeType == SearchManager::SIZE_ATLEAST) ? 'F' : 'T'; - string tmp = toAcp(escape((aFileType == SearchManager::TYPE_TTH) ? "TTH:" + aString : aString)); + string tmp = ((aFileType == SearchManager::TYPE_TTH) ? "TTH:" + aString : toAcp(escape(aString))); string::size_type i; while((i = tmp.find(' ')) != string::npos) { tmp[i] = '$'; @@ -866,12 +860,15 @@ // TimerManagerListener void NmdcHub::on(Second, u_int32_t aTick) throw() { - - if(isConnected() && (getLastActivity() + getReconnDelay() * 1000) < aTick) { + if(state == STATE_CONNECTED && (getLastActivity() + getReconnDelay() * 1000) < aTick) { // Try to send something for the fun of it... dcdebug("Testing writing...\n"); send("|", 1); + } else if(getAutoReconnect() && state == STATE_CONNECT && (getLastActivity() + getReconnDelay() * 1000) < aTick) { + // Try to reconnect... + connect(); } + { Lock l(cs); @@ -891,6 +888,8 @@ void NmdcHub::on(BufferedSocketListener::Failed, const string& aLine) throw() { clearUsers(); + socket->removeListener(this); + if(state == STATE_CONNECTED) state = STATE_CONNECT; Modified: dcplusplus/trunk/client/NmdcHub.h =================================================================== --- dcplusplus/trunk/client/NmdcHub.h 2006-06-18 15:13:10 UTC (rev 619) +++ dcplusplus/trunk/client/NmdcHub.h 2006-06-18 16:50:11 UTC (rev 620) @@ -40,7 +40,6 @@ virtual void connect(); virtual void connect(const OnlineUser& aUser); - virtual void disconnect(bool graceless) throw(); virtual void hubMessage(const string& aMessage); virtual void privateMessage(const OnlineUser& aUser, const string& aMessage); Modified: dcplusplus/trunk/windows/HubFrame.cpp =================================================================== --- dcplusplus/trunk/windows/HubFrame.cpp 2006-06-18 15:13:10 UTC (rev 619) +++ dcplusplus/trunk/windows/HubFrame.cpp 2006-06-18 16:50:11 UTC (rev 620) @@ -1415,9 +1415,10 @@ ctrlUsers.insertItem(i->second, getImage(i->second->getIdentity())); } } else { - for(UserMapIter i = userMap.begin(); i != userMap.end(); ++i){ - if(!ui->isHidden() && matchFilter(*i->second, sel, doSizeCompare, mode, size)) { - ctrlUsers.insertItem(i->second, getImage(i->second->getIdentity())); + for(UserMapIter i = userMap.begin(); i != userMap.end(); ++i) { + UserInfo* ui = i->second; + if(!ui->isHidden() && matchFilter(*ui, sel, doSizeCompare, mode, size)) { + ctrlUsers.insertItem(ui, getImage(ui->getIdentity())); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-06-18 15:13:39
|
Revision: 619 Author: arnetheduck Date: 2006-06-18 08:13:10 -0700 (Sun, 18 Jun 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=619&view=rev Log Message: ----------- More cleanup Modified Paths: -------------- dcplusplus/trunk/Example.xml dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/AdcHub.cpp dcplusplus/trunk/client/Client.cpp dcplusplus/trunk/client/ClientManager.cpp dcplusplus/trunk/client/ConnectionManager.cpp dcplusplus/trunk/client/DCPlusPlus.cpp dcplusplus/trunk/client/DownloadManager.cpp dcplusplus/trunk/client/DownloadManager.h dcplusplus/trunk/client/File.h dcplusplus/trunk/client/HashManager.cpp dcplusplus/trunk/client/HashManager.h dcplusplus/trunk/client/NmdcHub.cpp dcplusplus/trunk/client/QueueItem.h dcplusplus/trunk/client/QueueManager.cpp dcplusplus/trunk/client/ShareManager.cpp dcplusplus/trunk/client/StringDefs.cpp dcplusplus/trunk/client/StringDefs.h dcplusplus/trunk/client/UploadManager.cpp dcplusplus/trunk/windows/CommandDlg.cpp dcplusplus/trunk/windows/CommandDlg.h dcplusplus/trunk/windows/FlatTabCtrl.h dcplusplus/trunk/windows/GeneralPage.cpp dcplusplus/trunk/windows/GeneralPage.h dcplusplus/trunk/windows/HubFrame.cpp Modified: dcplusplus/trunk/Example.xml =================================================================== --- dcplusplus/trunk/Example.xml 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/Example.xml 2006-06-18 15:13:10 UTC (rev 619) @@ -112,6 +112,7 @@ <String Name="ErrorCreatingRegistryKeyDchub">Error creating dchub registry key</String> <String Name="ErrorCreatingRegistryKeyMagnet">Error creating magnet registry key</String> <String Name="ErrorHashing">Error hashing </String> + <String Name="ErrorSavingHash">Error saving hash data: </String> <String Name="ExactSize">Exact size</String> <String Name="Executable">Executable</String> <String Name="FavJoinShowingOff">Join/part of favorite users showing off</String> Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/changelog.txt 2006-06-18 15:13:10 UTC (rev 619) @@ -17,7 +17,11 @@ * Fixed auto-reconnect * [bug 936] Fixed duplicate entries in search hubs * Fixed some hub title display issues -* Some code spring cleanup +* Some spring cleanup +* [bug 970] Unix file permissions correctly set (thanks steven sheehy) +* [ADC] Allowed $ and | in nick/description +* Fixed targetdrive bug for temp target location +* Fixed a crash bug when hash data cannot be saved -- 0.691 2006-06-03 -- * Links to bugzilla in html changelog Modified: dcplusplus/trunk/client/AdcHub.cpp =================================================================== --- dcplusplus/trunk/client/AdcHub.cpp 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/client/AdcHub.cpp 2006-06-18 15:13:10 UTC (rev 619) @@ -133,7 +133,7 @@ u->getUser()->setFlag(User::SSL); } - if(u->getUser() == ClientManager::getInstance()->getMe()) { + if(u->getUser() == getMyIdentity().getUser()) { state = STATE_NORMAL; setMyIdentity(u->getIdentity()); updateCounts(false); @@ -519,9 +519,10 @@ string AdcHub::checkNick(const string& aNick) { string tmp = aNick; - string::size_type i = 0; - while( (i = tmp.find_first_of(" ", i)) != string::npos) { - tmp[i++]='_'; + for(size_t i = 0; i < aNick.size(); ++i) { + if(tmp[i] <= 32) { + tmp[i] = '_'; + } } return tmp; } Modified: dcplusplus/trunk/client/Client.cpp =================================================================== --- dcplusplus/trunk/client/Client.cpp 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/client/Client.cpp 2006-06-18 15:13:10 UTC (rev 619) @@ -74,7 +74,9 @@ } setPassword(hub->getPassword()); } else { - setCurrentNick(checkNick(SETTING(NICK))); + if(updateNick) { + setCurrentNick(checkNick(SETTING(NICK))); + } setCurrentDescription(SETTING(DESCRIPTION)); } } @@ -87,7 +89,7 @@ setReconnDelay(120 + Util::rand(0, 60)); reloadSettings(true); setRegistered(false); - setMyIdentity(Identity()); + setMyIdentity(Identity(ClientManager::getInstance()->getMe(), 0)); setHubIdentity(Identity()); try { Modified: dcplusplus/trunk/client/ClientManager.cpp =================================================================== --- dcplusplus/trunk/client/ClientManager.cpp 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/client/ClientManager.cpp 2006-06-18 15:13:10 UTC (rev 619) @@ -61,18 +61,7 @@ { Lock l(cs); - - // Either I'm stupid or the msvc7 optimizer is doing something _very_ strange here... - // STL-port -D_STL_DEBUG complains that .begin() and .end() don't have the same owner (!) - // dcassert(find(clients.begin(), clients.end(), aClient) != clients.end()); - // clients.erase(find(clients.begin(), clients.end(), aClient)); - - for(Client::Iter i = clients.begin(); i != clients.end(); ++i) { - if(*i == aClient) { - clients.erase(i); - break; - } - } + clients.erase(remove(clients.begin(), clients.end(), aClient), clients.end()); } delete aClient; } Modified: dcplusplus/trunk/client/ConnectionManager.cpp =================================================================== --- dcplusplus/trunk/client/ConnectionManager.cpp 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/client/ConnectionManager.cpp 2006-06-18 15:13:10 UTC (rev 619) @@ -122,10 +122,10 @@ fire(ConnectionManagerListener::Removed(), cqi); if(cqi->getDownload()) { dcassert(find(downloads.begin(), downloads.end(), cqi) != downloads.end()); - downloads.erase(find(downloads.begin(), downloads.end(), cqi)); + downloads.erase(remove(downloads.begin(), downloads.end(), cqi), downloads.end()); } else { dcassert(find(uploads.begin(), uploads.end(), cqi) != uploads.end()); - uploads.erase(find(uploads.begin(), uploads.end(), cqi)); + uploads.erase(remove(uploads.begin(), uploads.end(), cqi), uploads.end()); } delete cqi; } Modified: dcplusplus/trunk/client/DCPlusPlus.cpp =================================================================== --- dcplusplus/trunk/client/DCPlusPlus.cpp 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/client/DCPlusPlus.cpp 2006-06-18 15:13:10 UTC (rev 619) @@ -36,6 +36,13 @@ #include "StringTokenizer.h" +#ifdef _STLP_DEBUG +void __stl_debug_terminate() { + int* x = 0; + *x = 0; +} +#endif + void startup(void (*f)(void*, const string&), void* p) { // "Dedicated to the near-memory of Nev. Let's start remembering people while they're still alive." // Nev's great contribution to dc++ Modified: dcplusplus/trunk/client/DownloadManager.cpp =================================================================== --- dcplusplus/trunk/client/DownloadManager.cpp 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/client/DownloadManager.cpp 2006-06-18 15:13:10 UTC (rev 619) @@ -86,46 +86,53 @@ return cmd; } -void DownloadManager::on(TimerManagerListener::Second, u_int32_t /*aTick*/) throw() { - Lock l(cs); +void DownloadManager::on(TimerManagerListener::Second, u_int32_t aTick) throw() { + typedef vector<pair<string, User::Ptr> > TargetList; + TargetList dropTargets; - Download::List tickList; - // Tick each ongoing download - for(Download::Iter i = downloads.begin(); i != downloads.end(); ++i) { - if((*i)->getTotal() > 0) { - tickList.push_back(*i); + { + Lock l(cs); + + Download::List tickList; + // Tick each ongoing download + for(Download::Iter i = downloads.begin(); i != downloads.end(); ++i) { + if((*i)->getTotal() > 0) { + tickList.push_back(*i); + } } - } - if(tickList.size() > 0) - fire(DownloadManagerListener::Tick(), tickList); + if(tickList.size() > 0) + fire(DownloadManagerListener::Tick(), tickList); + - // Automatically remove or disconnect slow sources - if((u_int32_t)(GET_TICK() / 1000) % SETTING(AUTODROP_INTERVAL) == 0) { - for(Download::Iter i = downloads.begin(); i != downloads.end(); ++i) { - u_int32_t timeElapsed = GET_TICK() - (*i)->getStart(); - u_int32_t timeInactive = GET_TICK() - (*i)->getUserConnection()->getLastActivity(); - u_int64_t bytesDownloaded = (*i)->getTotal(); - bool timeElapsedOk = timeElapsed >= (u_int32_t)SETTING(AUTODROP_ELAPSED) * 1000; - bool timeInactiveOk = timeInactive <= (u_int32_t)SETTING(AUTODROP_INACTIVITY) * 1000; - bool speedTooLow = timeElapsedOk && timeInactiveOk && bytesDownloaded > 0 ? - bytesDownloaded / timeElapsed * 1000 < (u_int32_t)SETTING(AUTODROP_SPEED) : false; - bool onlineSourcesOk = (*i)->isSet(Download::FLAG_USER_LIST) ? - true : QueueManager::getInstance()->countOnlineSources((*i)->getTarget()) >= SETTING(AUTODROP_MINSOURCES); - bool filesizeOk = !((*i)->isSet(Download::FLAG_USER_LIST)) && (*i)->getSize() >= ((size_t)SETTING(AUTODROP_FILESIZE)) * 1024; - bool dropIt = ((*i)->isSet(Download::FLAG_USER_LIST) && BOOLSETTING(AUTODROP_FILELISTS)) || - (filesizeOk && BOOLSETTING(AUTODROP_ALL)); - if(speedTooLow && onlineSourcesOk && dropIt) { - if(BOOLSETTING(AUTODROP_DISCONNECT) && !((*i)->isSet(Download::FLAG_USER_LIST))) { - (*i)->getUserConnection()->disconnect(); - } else { - QueueManager::getInstance()->removeSource((*i)->getTarget(), - (*i)->getUserConnection()->getUser(), QueueItem::Source::FLAG_SLOW_SOURCE); + // Automatically remove or disconnect slow sources + if((u_int32_t)(aTick / 1000) % SETTING(AUTODROP_INTERVAL) == 0) { + for(Download::Iter i = downloads.begin(); i != downloads.end(); ++i) { + u_int32_t timeElapsed = GET_TICK() - (*i)->getStart(); + u_int32_t timeInactive = GET_TICK() - (*i)->getUserConnection()->getLastActivity(); + u_int64_t bytesDownloaded = (*i)->getTotal(); + bool timeElapsedOk = timeElapsed >= (u_int32_t)SETTING(AUTODROP_ELAPSED) * 1000; + bool timeInactiveOk = timeInactive <= (u_int32_t)SETTING(AUTODROP_INACTIVITY) * 1000; + bool speedTooLow = timeElapsedOk && timeInactiveOk && bytesDownloaded > 0 ? + bytesDownloaded / timeElapsed * 1000 < (u_int32_t)SETTING(AUTODROP_SPEED) : false; + bool onlineSourcesOk = (*i)->isSet(Download::FLAG_USER_LIST) ? + true : QueueManager::getInstance()->countOnlineSources((*i)->getTarget()) >= SETTING(AUTODROP_MINSOURCES); + bool filesizeOk = !((*i)->isSet(Download::FLAG_USER_LIST)) && (*i)->getSize() >= ((size_t)SETTING(AUTODROP_FILESIZE)) * 1024; + bool dropIt = ((*i)->isSet(Download::FLAG_USER_LIST) && BOOLSETTING(AUTODROP_FILELISTS)) || + (filesizeOk && BOOLSETTING(AUTODROP_ALL)); + if(speedTooLow && onlineSourcesOk && dropIt) { + if(BOOLSETTING(AUTODROP_DISCONNECT) && !((*i)->isSet(Download::FLAG_USER_LIST))) { + (*i)->getUserConnection()->disconnect(); + } else { + dropTargets.push_back(make_pair((*i)->getTarget(), (*i)->getUserConnection()->getUser())); + } } - continue; } } } + for(TargetList::iterator i = dropTargets.begin(); i != dropTargets.end(); ++i) { + QueueManager::getInstance()->removeSource(i->first, i->second, QueueItem::Source::FLAG_SLOW_SOURCE); + } } void DownloadManager::FileMover::moveFile(const string& source, const string& target) { @@ -237,7 +244,7 @@ Download* d = QueueManager::getInstance()->getDownload(aConn->getUser(), aConn->isSet(UserConnection::FLAG_SUPPORTS_TTHL)); - if(d == NULL) { + if(!d) { Lock l(cs); idlers.push_back(aConn); return; @@ -499,19 +506,11 @@ file->setPos(d->getPos()); } catch(const FileException& e) { delete file; - removeDownload(d); - fire(DownloadManagerListener::Failed(), d, STRING(COULD_NOT_OPEN_TARGET_FILE) + e.getError()); - aSource->setDownload(NULL); - QueueManager::getInstance()->putDownload(d, false); - removeConnection(aSource); + failDownload(aSource, STRING(COULD_NOT_OPEN_TARGET_FILE) + e.getError()); return false; } catch(const Exception& e) { delete file; - removeDownload(d); - fire(DownloadManagerListener::Failed(), d, e.getError()); - aSource->setDownload(NULL); - QueueManager::getInstance()->putDownload(d, false); - removeConnection(aSource); + failDownload(aSource, e.getError()); return false; } @@ -572,34 +571,16 @@ aSource->setLineMode(0); } } catch(const RollbackException& e) { - string target = d->getTarget(); - QueueManager::getInstance()->removeSource(target, aSource->getUser(), QueueItem::Source::FLAG_ROLLBACK_INCONSISTENCY); - removeDownload(d); - fire(DownloadManagerListener::Failed(), d, e.getError()); - + QueueManager::getInstance()->removeSource(d->getTarget(), aSource->getUser(), QueueItem::Source::FLAG_ROLLBACK_INCONSISTENCY); d->resetPos(); - aSource->setDownload(NULL); - QueueManager::getInstance()->putDownload(d, false); - removeConnection(aSource); - return; + failDownload(aSource, e.getError()); } catch(const FileException& e) { - removeDownload(d); - fire(DownloadManagerListener::Failed(), d, e.getError()); - d->resetPos(); - aSource->setDownload(NULL); - QueueManager::getInstance()->putDownload(d, false); - removeConnection(aSource); - return; + failDownload(aSource, e.getError()); } catch(const Exception& e) { - removeDownload(d); - fire(DownloadManagerListener::Failed(), d, e.getError()); // Nuke the bytes we have written, this is probably a compression error d->resetPos(); - aSource->setDownload(NULL); - QueueManager::getInstance()->putDownload(d, false); - removeConnection(aSource); - return; + failDownload(aSource, e.getError()); } } @@ -626,12 +607,11 @@ removeDownload(d); fire(DownloadManagerListener::Failed(), d, STRING(INVALID_TREE)); - string target = d->getTarget(); + QueueManager::getInstance()->removeSource(d->getTarget(), aSource->getUser(), QueueItem::Source::FLAG_BAD_TREE, false); aSource->setDownload(NULL); QueueManager::getInstance()->putDownload(d, false); - QueueManager::getInstance()->removeSource(target, aSource->getUser(), QueueItem::Source::FLAG_BAD_TREE, false); checkDownloads(aSource); return; } @@ -663,12 +643,7 @@ } } } catch(const FileException& e) { - removeDownload(d); - fire(DownloadManagerListener::Failed(), d, e.getError()); - - aSource->setDownload(NULL); - QueueManager::getInstance()->putDownload(d, false); - removeConnection(aSource); + failDownload(aSource, e.getError()); return; } @@ -733,12 +708,10 @@ removeDownload(d); fire(DownloadManagerListener::Failed(), d, STRING(SFV_INCONSISTENCY)); - string target = d->getTarget(); - + QueueManager::getInstance()->removeSource(d->getTarget(), aSource->getUser(), QueueItem::Source::FLAG_CRC_WARN, false); aSource->setDownload(NULL); QueueManager::getInstance()->putDownload(d, false); - QueueManager::getInstance()->removeSource(target, aSource->getUser(), QueueItem::Source::FLAG_CRC_WARN, false); checkDownloads(aSource); return false; } @@ -814,31 +787,23 @@ return; } - Download* d = aSource->getDownload(); - dcassert(d != NULL); - - removeDownload(d); - fire(DownloadManagerListener::Failed(), d, STRING(NO_SLOTS_AVAILABLE)); - - aSource->setDownload(NULL); - QueueManager::getInstance()->putDownload(d, false); - removeConnection(aSource); + failDownload(aSource, STRING(NO_SLOTS_AVAILABLE)); } void DownloadManager::on(UserConnectionListener::Failed, UserConnection* aSource, const string& aError) throw() { + failDownload(aSource, aError); +} + +void DownloadManager::failDownload(UserConnection* aSource, const string& reason) { Download* d = aSource->getDownload(); - if(d == NULL) { - removeConnection(aSource); - return; - } - - removeDownload(d); - fire(DownloadManagerListener::Failed(), d, aError); + if(d) { + removeDownload(d); + fire(DownloadManagerListener::Failed(), d, reason); - string target = d->getTarget(); - aSource->setDownload(NULL); - QueueManager::getInstance()->putDownload(d, false); + aSource->setDownload(0); + QueueManager::getInstance()->putDownload(d, false); + } removeConnection(aSource); } @@ -855,7 +820,6 @@ d->setCrcCalc(NULL); if(d->isSet(Download::FLAG_ANTI_FRAG)) { - // Ok, set the pos to whereever it was last writing and hope for the best... d->unsetFlag(Download::FLAG_ANTI_FRAG); } } @@ -868,29 +832,17 @@ dcassert(find(downloads.begin(), downloads.end(), d) != downloads.end()); - // downloads.erase(find(downloads.begin(), downloads.end(), d)); + downloads.erase(remove(downloads.begin(), downloads.end(), d), downloads.end()); - for(Download::Iter i = downloads.begin(); i != downloads.end(); ++i) { +/* for(Download::Iter i = downloads.begin(); i != downloads.end(); ++i) { if(*i == d) { downloads.erase(i); break; } - } + }*/ } } -void DownloadManager::abortDownload(const string& aTarget) { - Lock l(cs); - for(Download::Iter i = downloads.begin(); i != downloads.end(); ++i) { - Download* d = *i; - if(d->getTarget() == aTarget) { - dcassert(d->getUserConnection() != NULL); - d->getUserConnection()->disconnect(); - break; - } - } -} - void DownloadManager::on(UserConnectionListener::FileNotAvailable, UserConnection* aSource) throw() { fileNotAvailable(aSource); } @@ -930,12 +882,6 @@ dcassert(d != NULL); dcdebug("File Not Available: %s\n", d->getTarget().c_str()); - if(d->getFile()) { - delete d->getFile(); - d->setFile(NULL); - d->setCrcCalc(NULL); - } - removeDownload(d); fire(DownloadManagerListener::Failed(), d, d->getTargetFileName() + ": " + STRING(FILE_NOT_AVAILABLE)); Modified: dcplusplus/trunk/client/DownloadManager.h =================================================================== --- dcplusplus/trunk/client/DownloadManager.h 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/client/DownloadManager.h 2006-06-18 15:13:10 UTC (rev 619) @@ -181,9 +181,6 @@ void checkIdle(const User::Ptr& user); - /** @internal */ - void abortDownload(const string& aTarget); - /** * @remarks This is only used in the tray icons. In MainFrame this is * calculated instead so there seems to be a little duplication of code. @@ -242,6 +239,8 @@ bool checkSfv(UserConnection* aSource, Download* d, u_int32_t crc); int64_t getResumePos(const string& file, const TigerTree& tt, int64_t startPos); + void failDownload(UserConnection* aSource, const string& reason); + friend class Singleton<DownloadManager>; DownloadManager() { TimerManager::getInstance()->addListener(this); Modified: dcplusplus/trunk/client/File.h =================================================================== --- dcplusplus/trunk/client/File.h 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/client/File.h 2006-06-18 15:13:10 UTC (rev 619) @@ -246,7 +246,7 @@ if(mode & TRUNCATE) { m |= O_TRUNC; } - h = open(aFileName.c_str(), m, S_IRUSR | S_IWUSR); + h = open(aFileName.c_str(), m, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); if(h == -1) throw FileException("Could not open file"); } @@ -390,7 +390,7 @@ string acp = Text::utf8ToAcp(aFile); string::size_type start = 0; while( (start = aFile.find_first_of(L'/', start)) != string::npos) { - mkdir(aFile.substr(0, start+1).c_str(), 0755); + mkdir(aFile.substr(0, start+1).c_str(), S_IRWXU | S_IRWXG | S_IRWXO); start++; } } Modified: dcplusplus/trunk/client/HashManager.cpp =================================================================== --- dcplusplus/trunk/client/HashManager.cpp 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/client/HashManager.cpp 2006-06-18 15:13:10 UTC (rev 619) @@ -97,16 +97,20 @@ dirty = true; } -void HashManager::HashStore::addTree(const TigerTree& tt) { +void HashManager::HashStore::addTree(const TigerTree& tt) throw() { if(treeIndex.find(tt.getRoot()) == treeIndex.end()) { - File f(getDataFile(), File::READ|File::WRITE, File::OPEN); - int64_t index = saveTree(f, tt); - treeIndex.insert(make_pair(tt.getRoot(), TreeInfo(tt.getFileSize(), index, tt.getBlockSize()))); - dirty = true; + try { + File f(getDataFile(), File::READ|File::WRITE, File::OPEN); + int64_t index = saveTree(f, tt); + treeIndex.insert(make_pair(tt.getRoot(), TreeInfo(tt.getFileSize(), index, tt.getBlockSize()))); + dirty = true; + } catch(const FileException& e) { + LogManager::getInstance()->message(STRING(ERROR_SAVING_HASH) + e.getError()); + } } } -int64_t HashManager::HashStore::saveTree(File& f, const TigerTree& tt) { +int64_t HashManager::HashStore::saveTree(File& f, const TigerTree& tt) throw(FileException) { if(tt.getLeaves().size() == 1) return SMALL_TREE; @@ -310,8 +314,8 @@ File::renameFile(getIndexFile() + ".tmp", getIndexFile()); dirty = false; - } catch(const FileException&) { - // Too bad... + } catch(const FileException& e) { + LogManager::getInstance()->message(STRING(ERROR_SAVING_HASH) + e.getError()); } } } Modified: dcplusplus/trunk/client/HashManager.h =================================================================== --- dcplusplus/trunk/client/HashManager.h 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/client/HashManager.h 2006-06-18 15:13:10 UTC (rev 619) @@ -48,6 +48,7 @@ }; class HashLoader; +class FileException; class HashManager : public Singleton<HashManager>, public Speaker<HashManagerListener>, private TimerManagerListener @@ -194,7 +195,7 @@ bool checkTTH(const string& aFileName, int64_t aSize, u_int32_t aTimeStamp); - void addTree(const TigerTree& tt); + void addTree(const TigerTree& tt) throw(); const TTHValue* getTTH(const string& aFileName); bool getTree(const TTHValue& root, TigerTree& tth); bool isDirty() { return dirty; } @@ -244,7 +245,7 @@ void createDataFile(const string& name); bool loadTree(File& dataFile, const TreeInfo& ti, const TTHValue& root, TigerTree& tt); - int64_t saveTree(File& dataFile, const TigerTree& tt); + int64_t saveTree(File& dataFile, const TigerTree& tt) throw(FileException); string getIndexFile() { return Util::getConfigPath() + "HashIndex.xml"; } string getDataFile() { return Util::getConfigPath() + "HashData.dat"; } Modified: dcplusplus/trunk/client/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/client/NmdcHub.cpp 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/client/NmdcHub.cpp 2006-06-18 15:13:10 UTC (rev 619) @@ -84,7 +84,7 @@ } User::Ptr p; - if(aNick == getMyNick()) { + if(aNick == getCurrentNick()) { p = ClientManager::getInstance()->getMe(); } else { p = ClientManager::getInstance()->getUser(aNick, getHubUrl()); @@ -524,13 +524,14 @@ } key(CryptoManager::getInstance()->makeKey(lock)); - validateNick(getMyNick()); + OnlineUser& ou = getUser(getCurrentNick()); + validateNick(ou.getIdentity().getNick()); } } else if(cmd == "$Hello") { if(!param.empty()) { OnlineUser& u = getUser(param); - if(getMyNick() == param) { + if(u.getUser() == getMyIdentity().getUser()) { u.getUser()->setFlag(User::DCPLUSPLUS); if(ClientManager::getInstance()->isActive()) u.getUser()->unsetFlag(User::PASSIVE); @@ -538,7 +539,7 @@ u.getUser()->setFlag(User::PASSIVE); } - if(state == STATE_HELLO) { + if(state == STATE_HELLO && u.getUser() == getMyIdentity().getUser()) { state = STATE_CONNECTED; updateCounts(false); @@ -689,9 +690,10 @@ string NmdcHub::checkNick(const string& aNick) { string tmp = aNick; - string::size_type i = 0; - while( (i = tmp.find_first_of("|$ ", i)) != string::npos) { - tmp[i++]='_'; + for(size_t i = 0; i < aNick.size(); ++i) { + if(tmp[i] <= 32 || tmp[i] == '|' || tmp[i] == '$' || tmp[i] == '<' || tmp[i] == '>') { + tmp[i] = '_'; + } } return tmp; } @@ -745,7 +747,7 @@ string uMin = (SETTING(MIN_UPLOAD_SPEED) == 0) ? Util::emptyString : tmp5 + Util::toString(SETTING(MIN_UPLOAD_SPEED)); string myInfoA = - "$MyINFO $ALL " + toAcp(getCurrentNick()) + " " + toAcp(escape(getCurrentDescription())) + + "$MyINFO $ALL " + toAcp(getMyNick()) + " " + toAcp(escape(getCurrentDescription())) + tmp1 + VERSIONSTRING + tmp2 + modeChar + tmp3 + getCounts() + tmp4 + Util::toString(SETTING(SLOTS)) + uMin + ">$ $" + SETTING(UPLOAD_SPEED) + "\x01$" + toAcp(escape(SETTING(EMAIL))) + '$'; string myInfoB = ShareManager::getInstance()->getShareSizeString() + "$|"; Modified: dcplusplus/trunk/client/QueueItem.h =================================================================== --- dcplusplus/trunk/client/QueueItem.h 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/client/QueueItem.h 2006-06-18 15:13:10 UTC (rev 619) @@ -204,8 +204,6 @@ } } - string getSearchString() const; - const string& getTempTarget(); void setTempTarget(const string& aTempTarget) { tempTarget = aTempTarget; Modified: dcplusplus/trunk/client/QueueManager.cpp =================================================================== --- dcplusplus/trunk/client/QueueManager.cpp 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/client/QueueManager.cpp 2006-06-18 15:13:10 UTC (rev 619) @@ -62,9 +62,6 @@ return tmp; } } -string QueueItem::getSearchString() const { - return SearchManager::clean(getTargetFileName()); -} const string& QueueItem::getTempTarget() { if(!isSet(QueueItem::FLAG_USER_LIST) && tempTarget.empty()) { @@ -75,7 +72,7 @@ sm["targetdrive"] = target.substr(0, 3); else sm["targetdrive"] = Util::getConfigPath().substr(0, 3); - setTempTarget(Util::formatParams(SETTING(TEMP_DOWNLOAD_DIRECTORY), sm, true) + getTempName(getTargetFileName(), getTTH())); + setTempTarget(Util::formatParams(SETTING(TEMP_DOWNLOAD_DIRECTORY), sm, false) + getTempName(getTargetFileName(), getTTH())); #else //_WIN32 setTempTarget(SETTING(TEMP_DOWNLOAD_DIRECTORY) + getTempName(getTargetFileName(), getTTH())); #endif //_WIN32 @@ -219,9 +216,9 @@ } void QueueManager::UserQueue::add(QueueItem* qi, const User::Ptr& aUser) { - dcassert(qi->getStatus() == QueueItem::STATUS_WAITING); - dcassert(qi->isSource(aUser)); - dcassert(qi->getCurrent() == NULL); + if(qi->getStatus() == QueueItem::STATUS_RUNNING) { + return; + } QueueItem::List& l = userQueue[qi->getPriority()][aUser]; if(qi->isSet(QueueItem::FLAG_EXISTS)) { @@ -247,7 +244,8 @@ } void QueueManager::UserQueue::setRunning(QueueItem* qi, const User::Ptr& aUser) { - dcassert(qi->getCurrent() == NULL); + dcassert(qi->getCurrent() == 0); + dcassert(qi->getCurrentDownload() == 0); dcassert(qi->getStatus() == QueueItem::STATUS_WAITING); // Remove the download from the userQueue... @@ -260,13 +258,12 @@ // Move the download to the running list... dcassert(running.find(aUser) == running.end()); running[aUser] = qi; - } void QueueManager::UserQueue::setWaiting(QueueItem* qi) { - dcassert(qi->getCurrentDownload() != NULL); - dcassert(qi->getCurrent() != NULL); dcassert(qi->getStatus() == QueueItem::STATUS_RUNNING); + dcassert(qi->getCurrentDownload() != 0); + dcassert(qi->getCurrent() != 0); dcassert(running.find(qi->getCurrent()->getUser()) != running.end()); // Remove the download from running @@ -274,8 +271,8 @@ // Set flag to waiting qi->setStatus(QueueItem::STATUS_WAITING); - qi->setCurrent(NULL); - qi->setCurrentDownload(NULL); + qi->setCurrent(0); + qi->setCurrentDownload(0); // Add to the userQueue add(qi); @@ -283,26 +280,23 @@ QueueItem* QueueManager::UserQueue::getRunning(const User::Ptr& aUser) { QueueItem::UserIter i = running.find(aUser); - return (i == running.end()) ? NULL : i->second; + return (i == running.end()) ? 0 : i->second; } void QueueManager::UserQueue::remove(QueueItem* qi) { - if(qi->getStatus() == QueueItem::STATUS_RUNNING) { - dcassert(qi->getCurrent() != NULL); - remove(qi, qi->getCurrent()->getUser()); - } else { - for(QueueItem::Source::Iter i = qi->getSources().begin(); i != qi->getSources().end(); ++i) { - remove(qi, (*i)->getUser()); - } + for(QueueItem::Source::Iter i = qi->getSources().begin(); i != qi->getSources().end(); ++i) { + remove(qi, (*i)->getUser()); } } void QueueManager::UserQueue::remove(QueueItem* qi, const User::Ptr& aUser) { if(qi->getStatus() == QueueItem::STATUS_RUNNING) { - // Remove from running... - dcassert(qi->getCurrent() != NULL); - dcassert(running.find(aUser) != running.end()); - running.erase(aUser); + dcassert(qi->getCurrent() != 0); + if(qi->getCurrent()->getUser() == aUser) { + // Remove from running... + dcassert(running.find(aUser) != running.end()); + running.erase(aUser); + } } else { dcassert(qi->isSource(aUser)); dcassert(qi->getCurrent() == NULL); @@ -311,7 +305,7 @@ dcassert(j != ulm.end()); QueueItem::List& l = j->second; dcassert(find(l.begin(), l.end(), qi) != l.end()); - l.erase(find(l.begin(), l.end(), qi)); + l.erase(std::remove(l.begin(), l.end(), qi), l.end()); if(l.empty()) { ulm.erase(j); @@ -578,12 +572,11 @@ if(aUser->isSet(User::PASSIVE) && !ClientManager::getInstance()->isActive() ) { qi->removeSource(aUser, QueueItem::Source::FLAG_PASSIVE); wantConnection = false; - } else if(qi->getStatus() != QueueItem::STATUS_RUNNING) { + } else { userQueue.add(qi, aUser); + aUser->setFlag(User::SAVE_NICK); } - aUser->setFlag(User::SAVE_NICK); - fire(QueueManagerListener::SourcesUpdated(), qi); setDirty(); @@ -809,7 +802,6 @@ d->setStartPos(q->getDownloadedBytes()); } - fire(QueueManagerListener::StatusUpdated(), q); return d; } @@ -834,7 +826,7 @@ } else { QueueItem* q = fileQueue.find(aDownload->getTarget()); - if(q != NULL) { + if(q) { if(aDownload->isSet(Download::FLAG_USER_LIST)) { if(aDownload->getSource() == "files.xml.bz2") { q->setFlag(QueueItem::FLAG_XML_BZLIST); @@ -844,18 +836,16 @@ } if(finished) { - dcassert(q->getStatus() == QueueItem::STATUS_RUNNING); if(aDownload->isSet(Download::FLAG_TREE_DOWNLOAD)) { // Got a full tree, now add it to the HashManager dcassert(aDownload->getTreeValid()); HashManager::getInstance()->addTree(aDownload->getTigerTree()); - userQueue.setWaiting(q); - - fire(QueueManagerListener::StatusUpdated(), q); + if(q->getStatus() == QueueItem::STATUS_RUNNING) { + userQueue.setWaiting(q); + fire(QueueManagerListener::StatusUpdated(), q); + } } else { - fire(QueueManagerListener::Finished(), q, aDownload->getAverageSpeed()); - fire(QueueManagerListener::Removed(), q); // Now, let's see if this was a directory download filelist... if( (q->isSet(QueueItem::FLAG_DIRECTORY_DOWNLOAD) && directories.find(q->getCurrent()->getUser()) != directories.end()) || (q->isSet(QueueItem::FLAG_MATCH_QUEUE)) ) @@ -864,7 +854,11 @@ up = q->getCurrent()->getUser(); flag = (q->isSet(QueueItem::FLAG_DIRECTORY_DOWNLOAD) ? QueueItem::FLAG_DIRECTORY_DOWNLOAD : 0) | (q->isSet(QueueItem::FLAG_MATCH_QUEUE) ? QueueItem::FLAG_MATCH_QUEUE : 0); - } + } + + fire(QueueManagerListener::Finished(), q, aDownload->getAverageSpeed()); + fire(QueueManagerListener::Removed(), q); + userQueue.remove(q); fileQueue.remove(q); setDirty(); @@ -888,7 +882,7 @@ q->getOnlineUsers(getConn); } - // This might have been set to wait by removesource already... + // This might have been set to wait elsewhere already... if(q->getStatus() == QueueItem::STATUS_RUNNING) { userQueue.setWaiting(q); fire(QueueManagerListener::StatusUpdated(), q); @@ -901,7 +895,7 @@ } } } - aDownload->setUserConnection(NULL); + aDownload->setUserConnection(0); delete aDownload; } @@ -948,13 +942,13 @@ } void QueueManager::remove(const string& aTarget) throw() { - string x; + User::Ptr x; { Lock l(cs); QueueItem* q = fileQueue.find(aTarget); - if(q == NULL) + if(!q) return; if(q->isSet(QueueItem::FLAG_DIRECTORY_DOWNLOAD)) { @@ -967,7 +961,7 @@ } if(q->getStatus() == QueueItem::STATUS_RUNNING) { - x = q->getTarget(); + x = q->getCurrent()->getUser(); } else if(!q->getTempTarget().empty() && q->getTempTarget() != q->getTarget()) { File::deleteFile(q->getTempTarget() + Download::ANTI_FRAG_EXT); File::deleteFile(q->getTempTarget()); @@ -981,18 +975,18 @@ setDirty(); } - if(!x.empty()) { - DownloadManager::getInstance()->abortDownload(x); + if(x) { + ConnectionManager::getInstance()->disconnect(x, true); } } void QueueManager::removeSource(const string& aTarget, User::Ptr& aUser, int reason, bool removeConn /* = true */) throw() { - string x; + bool isRunning = false; bool removeCompletely = false; { Lock l(cs); QueueItem* q = fileQueue.find(aTarget); - if(q == NULL) + if(!q) return; if(!q->isSource(aUser)) @@ -1019,23 +1013,22 @@ return; } } + if((q->getStatus() == QueueItem::STATUS_RUNNING) && q->getCurrent()->getUser() == aUser) { - if(removeConn) - x = q->getTarget(); + isRunning = true; userQueue.setWaiting(q); - userQueue.remove(q, aUser); - } else if(q->getStatus() == QueueItem::STATUS_WAITING) { - userQueue.remove(q, aUser); + fire(QueueManagerListener::StatusUpdated(), q); } + userQueue.remove(q, aUser); q->removeSource(aUser, reason); fire(QueueManagerListener::SourcesUpdated(), q); setDirty(); } endCheck: - if(!x.empty()) { - DownloadManager::getInstance()->abortDownload(x); + if(isRunning && removeConn) { + ConnectionManager::getInstance()->disconnect(aUser, true); } if(removeCompletely) { remove(aTarget); @@ -1043,7 +1036,7 @@ } void QueueManager::removeSource(User::Ptr& aUser, int reason) throw() { - string x; + bool isRunning = false; string removeRunning; { Lock l(cs); @@ -1060,22 +1053,23 @@ } qi = userQueue.getRunning(aUser); - if(qi != NULL) { + if(qi) { if(qi->isSet(QueueItem::FLAG_USER_LIST)) { removeRunning = qi->getTarget(); } else { userQueue.setWaiting(qi); userQueue.remove(qi, aUser); - x = qi->getTarget(); + isRunning = true; qi->removeSource(aUser, reason); + fire(QueueManagerListener::StatusUpdated(), qi); fire(QueueManagerListener::SourcesUpdated(), qi); setDirty(); } } } - if(!x.empty()) { - DownloadManager::getInstance()->abortDownload(x); + if(isRunning) { + ConnectionManager::getInstance()->disconnect(aUser, true); } if(!removeRunning.empty()) { remove(removeRunning); Modified: dcplusplus/trunk/client/ShareManager.cpp =================================================================== --- dcplusplus/trunk/client/ShareManager.cpp 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/client/ShareManager.cpp 2006-06-18 15:13:10 UTC (rev 619) @@ -1181,7 +1181,7 @@ newStr = auto_ptr<StringSearch::List>(new StringSearch::List(aStrings)); } dcassert(find(newStr->begin(), newStr->end(), *k) != newStr->end()); - newStr->erase(find(newStr->begin(), newStr->end(), *k)); + newStr->erase(remove(newStr->begin(), newStr->end(), *k), newStr->end()); } } @@ -1313,7 +1313,7 @@ newStr = auto_ptr<StringSearch::List>(new StringSearch::List(*cur)); } dcassert(find(newStr->begin(), newStr->end(), *k) != newStr->end()); - newStr->erase(find(newStr->begin(), newStr->end(), *k)); + newStr->erase(remove(newStr->begin(), newStr->end(), *k), newStr->end()); } } Modified: dcplusplus/trunk/client/StringDefs.cpp =================================================================== --- dcplusplus/trunk/client/StringDefs.cpp 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/client/StringDefs.cpp 2006-06-18 15:13:10 UTC (rev 619) @@ -113,6 +113,7 @@ "Error creating dchub registry key", "Error creating magnet registry key", "Error hashing ", +"Error saving hash data: ", "Exact size", "Executable", "Join/part of favorite users showing off", @@ -724,6 +725,7 @@ "ErrorCreatingRegistryKeyDchub", "ErrorCreatingRegistryKeyMagnet", "ErrorHashing", +"ErrorSavingHash", "ExactSize", "Executable", "FavJoinShowingOff", Modified: dcplusplus/trunk/client/StringDefs.h =================================================================== --- dcplusplus/trunk/client/StringDefs.h 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/client/StringDefs.h 2006-06-18 15:13:10 UTC (rev 619) @@ -116,6 +116,7 @@ ERROR_CREATING_REGISTRY_KEY_DCHUB, // "Error creating dchub registry key" ERROR_CREATING_REGISTRY_KEY_MAGNET, // "Error creating magnet registry key" ERROR_HASHING, // "Error hashing " + ERROR_SAVING_HASH, // "Error saving hash data: " EXACT_SIZE, // "Exact size" EXECUTABLE, // "Executable" FAV_JOIN_SHOWING_OFF, // "Join/part of favorite users showing off" Modified: dcplusplus/trunk/client/UploadManager.cpp =================================================================== --- dcplusplus/trunk/client/UploadManager.cpp 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/client/UploadManager.cpp 2006-06-18 15:13:10 UTC (rev 619) @@ -224,7 +224,7 @@ void UploadManager::removeUpload(Upload* aUpload) { Lock l(cs); dcassert(find(uploads.begin(), uploads.end(), aUpload) != uploads.end()); - uploads.erase(find(uploads.begin(), uploads.end(), aUpload)); + uploads.erase(remove(uploads.begin(), uploads.end(), aUpload), uploads.end()); aUpload->setUserConnection(NULL); delete aUpload; } Modified: dcplusplus/trunk/windows/CommandDlg.cpp =================================================================== --- dcplusplus/trunk/windows/CommandDlg.cpp 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/windows/CommandDlg.cpp 2006-06-18 15:13:10 UTC (rev 619) @@ -19,10 +19,12 @@ #include "stdafx.h" #include "../client/DCPlusPlus.h" #include "Resource.h" + #include "../client/ResourceManager.h" - #include "../client/UserCommand.h" +#include "../client/NmdcHub.h" +#include "WinUtil.h" #include "CommandDlg.h" LRESULT CommandDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) @@ -194,3 +196,55 @@ HtmlHelp(m_hWnd, WinUtil::getHelpFile().c_str(), HH_HELP_CONTEXT, IDD_UCPAGE); return 0; } + +void CommandDlg::updateType() { + if(ctrlSeparator.GetCheck() == BST_CHECKED) { + type = 0; + } else if(ctrlRaw.GetCheck() == BST_CHECKED) { + type = 1; + } else if(ctrlChat.GetCheck() == BST_CHECKED) { + type = 2; + } else if(ctrlPM.GetCheck() == BST_CHECKED) { + type = 3; + } +} + +void CommandDlg::updateCommand() { + static const size_t BUF_LEN = 1024; + TCHAR buf[BUF_LEN]; + if(type == 0) { + command.clear(); + } else if(type == 1) { + ctrlCommand.GetWindowText(buf, BUF_LEN-1); + command = buf; + } else if(type == 2) { + ctrlCommand.GetWindowText(buf, BUF_LEN - 1); + command = Text::toT("<%[myNI]> " + NmdcHub::validateMessage(Text::fromT(buf), false) + "|"); + } else if(type == 3) { + ctrlNick.GetWindowText(buf, BUF_LEN - 1); + tstring to(buf); + ctrlCommand.GetWindowText(buf, BUF_LEN - 1); + command = _T("$To: ") + to + _T(" From: %[myNI] $<%[myNI]> ") + Text::toT(NmdcHub::validateMessage(Text::fromT(buf), false)) + _T("|"); + } +} + +void CommandDlg::updateControls() { + switch(type) { + case 0: + ctrlName.EnableWindow(FALSE); + ctrlCommand.EnableWindow(FALSE); + ctrlNick.EnableWindow(FALSE); + break; + case 1: + case 2: + ctrlName.EnableWindow(TRUE); + ctrlCommand.EnableWindow(TRUE); + ctrlNick.EnableWindow(FALSE); + break; + case 3: + ctrlName.EnableWindow(TRUE); + ctrlCommand.EnableWindow(TRUE); + ctrlNick.EnableWindow(TRUE); + break; + } +} Modified: dcplusplus/trunk/windows/CommandDlg.h =================================================================== --- dcplusplus/trunk/windows/CommandDlg.h 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/windows/CommandDlg.h 2006-06-18 15:13:10 UTC (rev 619) @@ -23,9 +23,6 @@ #pragma once #endif // _MSC_VER > 1000 -#include "../client/Util.h" -#include "WinUtil.h" - class CommandDlg : public CDialogImpl<CommandDlg> { CEdit ctrlName; @@ -82,55 +79,9 @@ LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); private: - void updateType() { - if(ctrlSeparator.GetCheck() == BST_CHECKED) { - type = 0; - } else if(ctrlRaw.GetCheck() == BST_CHECKED) { - type = 1; - } else if(ctrlChat.GetCheck() == BST_CHECKED) { - type = 2; - } else if(ctrlPM.GetCheck() == BST_CHECKED) { - type = 3; - } - } - enum { BUF_LEN = 1024 }; - void updateCommand() { - TCHAR buf[BUF_LEN]; - if(type == 0) { - command.clear(); - } else if(type == 1) { - ctrlCommand.GetWindowText(buf, BUF_LEN-1); - command = buf; - } else if(type == 2) { - ctrlCommand.GetWindowText(buf, BUF_LEN - 1); - command = Text::toT("<%[myNI]> " + NmdcHub::validateMessage(Text::fromT(buf), false) + "|"); - } else if(type == 3) { - ctrlNick.GetWindowText(buf, BUF_LEN - 1); - tstring to(buf); - ctrlCommand.GetWindowText(buf, BUF_LEN - 1); - command = _T("$To: ") + to + _T(" From: %[myNI] $<%[myNI]> ") + Text::toT(NmdcHub::validateMessage(Text::fromT(buf), false)) + _T("|"); - } - } - void updateControls() { - switch(type) { - case 0: - ctrlName.EnableWindow(FALSE); - ctrlCommand.EnableWindow(FALSE); - ctrlNick.EnableWindow(FALSE); - break; - case 1: - case 2: - ctrlName.EnableWindow(TRUE); - ctrlCommand.EnableWindow(TRUE); - ctrlNick.EnableWindow(FALSE); - break; - case 3: - ctrlName.EnableWindow(TRUE); - ctrlCommand.EnableWindow(TRUE); - ctrlNick.EnableWindow(TRUE); - break; - } - } + void updateType(); + void updateCommand(); + void updateControls(); void updateContext(); }; Modified: dcplusplus/trunk/windows/FlatTabCtrl.h =================================================================== --- dcplusplus/trunk/windows/FlatTabCtrl.h 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/windows/FlatTabCtrl.h 2006-06-18 15:13:10 UTC (rev 619) @@ -83,7 +83,7 @@ delete ti; tabs.erase(i); dcassert(find(viewOrder.begin(), viewOrder.end(), aWnd) != viewOrder.end()); - viewOrder.erase(find(viewOrder.begin(), viewOrder.end(), aWnd)); + viewOrder.erase(remove(viewOrder.begin(), viewOrder.end(), aWnd), viewOrder.end()); nextTab = viewOrder.end(); if(!viewOrder.empty()) --nextTab; @@ -137,7 +137,7 @@ void setTop(HWND aWnd) { dcassert(find(viewOrder.begin(), viewOrder.end(), aWnd) != viewOrder.end()); - viewOrder.erase(find(viewOrder.begin(), viewOrder.end(), aWnd)); + viewOrder.erase(remove(viewOrder.begin(), viewOrder.end(), aWnd), viewOrder.end()); viewOrder.push_back(aWnd); nextTab = --viewOrder.end(); } Modified: dcplusplus/trunk/windows/GeneralPage.cpp =================================================================== --- dcplusplus/trunk/windows/GeneralPage.cpp 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/windows/GeneralPage.cpp 2006-06-18 15:13:10 UTC (rev 619) @@ -75,11 +75,11 @@ GetDlgItemText(wID, buf, SETTINGS_BUF_LEN); tstring old = buf; - // Strip '$', '|', '<', '>' and ' ' from text + // Strip ' ' from nick TCHAR *b = buf, *f = buf, c; while( (c = *b++) != 0 ) { - if(c != '$' && c != '|' && (wID == IDC_DESCRIPTION || c != ' ') && ( (wID != IDC_NICK) || (c != '<' && c != '>')) ) + if(c != ' ') *f++ = c; } Modified: dcplusplus/trunk/windows/GeneralPage.h =================================================================== --- dcplusplus/trunk/windows/GeneralPage.h 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/windows/GeneralPage.h 2006-06-18 15:13:10 UTC (rev 619) @@ -39,8 +39,6 @@ MESSAGE_HANDLER(WM_INITDIALOG, onInitDialog) MESSAGE_HANDLER(WM_HELP, onHelp) COMMAND_HANDLER(IDC_NICK, EN_CHANGE, onTextChanged) - COMMAND_HANDLER(IDC_EMAIL, EN_CHANGE, onTextChanged) - COMMAND_HANDLER(IDC_DESCRIPTION, EN_CHANGE, onTextChanged) NOTIFY_CODE_HANDLER_EX(PSN_HELP, onHelpInfo) END_MSG_MAP() Modified: dcplusplus/trunk/windows/HubFrame.cpp =================================================================== --- dcplusplus/trunk/windows/HubFrame.cpp 2006-06-17 23:26:36 UTC (rev 618) +++ dcplusplus/trunk/windows/HubFrame.cpp 2006-06-18 15:13:10 UTC (rev 619) @@ -1313,6 +1313,9 @@ tstring::size_type end = static_cast<tstring::size_type>(tstring::npos); int64_t multiplier = 1; + if(filter.empty()) { + return false; + } if(filter.compare(0, 2, _T(">=")) == 0) { mode = FilterModes::GREATER_EQUAL; start = 2; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-06-17 23:26:45
|
Revision: 618 Author: arnetheduck Date: 2006-06-17 16:26:36 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=618&view=rev Log Message: ----------- Spring cleaning Modified Paths: -------------- dcplusplus/trunk/client/NmdcHub.cpp dcplusplus/trunk/client/NmdcHub.h dcplusplus/trunk/windows/CommandDlg.cpp Modified: dcplusplus/trunk/client/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/client/NmdcHub.cpp 2006-06-17 22:24:01 UTC (rev 617) +++ dcplusplus/trunk/client/NmdcHub.cpp 2006-06-17 23:26:36 UTC (rev 618) @@ -192,8 +192,22 @@ } } string line = fromAcp(aLine); - // @todo Decrypt who the message is from... - fire(ClientListener::StatusMessage(), this, unescape(fromAcp(aLine))); + if(line[0] != '<') { + fire(ClientListener::StatusMessage(), this, unescape(line)); + return; + } + string::size_type i = line.find('>', 2); + if(i == string::npos) { + fire(ClientListener::StatusMessage(), this, unescape(line)); + return; + } + string nick = line.substr(1, i-1); + OnlineUser* ou = findUser(nick); + if(ou) { + fire(ClientListener::Message(), this, *ou, unescape(line.substr(i+1))); + } else { + fire(ClientListener::StatusMessage(), this, unescape(line)); + } return; } @@ -282,7 +296,7 @@ return; int type = Util::toInt(param.substr(i, j-i)) - 1; i = j + 1; - param = param.substr(i); + string terms = param.substr(i); if(param.size() > 0) { if(seeker.compare(0, 4, "Hub:") == 0) { @@ -351,7 +365,7 @@ if(j == string::npos) return; - u.getIdentity().setEmail(unescape(param.substr(i, j-i)); + u.getIdentity().setEmail(unescape(param.substr(i, j-i))); i = j + 1; j = param.find('$', i); @@ -366,9 +380,9 @@ fire(ClientListener::UserUpdated(), this, u); } else if(cmd == "$Quit") { if(!param.empty()) { - string nick = param; + const string& nick = param; OnlineUser* u = findUser(nick); - if(u == NULL) + if(!u) return; fire(ClientListener::UserRemoved(), this, *u); @@ -394,7 +408,7 @@ return; } string port = param.substr(j+1); - ConnectionManager::getInstance()->nmdcConnect(server, (short)Util::toInt(port), getMyNick(), getHubUrl()); + ConnectionManager::getInstance()->nmdcConnect(server, (unsigned short)Util::toInt(port), getMyNick(), getHubUrl()); } else if(cmd == "$RevConnectToMe") { if(state != STATE_CONNECTED) { return; @@ -466,10 +480,10 @@ j = param.find('$'); if(j == string::npos) return; - string name = param.substr(i, j-i); + string name = unescape(param.substr(i, j-i)); i = j+1; - string command = param.substr(i, param.length() - i); - fire(ClientListener::UserCommand(), this, type, ctx, unescape(name), unescape(command)); + string command = unescape(param.substr(i, param.length() - i)); + fire(ClientListener::UserCommand(), this, type, ctx, name, command); } } else if(cmd == "$Lock") { if(state != STATE_LOCK) { @@ -557,7 +571,7 @@ OnlineUser* u = findUser(it->substr(0, j)); - if(u == NULL) + if(!u) continue; u->getIdentity().setIp(it->substr(j+1)); @@ -666,7 +680,7 @@ } else if(cmd == "$BadPass") { fire(ClientListener::BadPassword(), this); } else if(cmd == "$ZOn") { - socket->setMode (BufferedSocket::MODE_ZPIPE); + socket->setMode(BufferedSocket::MODE_ZPIPE); } else { dcassert(cmd[0] == '$'); dcdebug("NmdcHub::onLine Unknown command %s\n", aLine.c_str()); @@ -731,9 +745,9 @@ string uMin = (SETTING(MIN_UPLOAD_SPEED) == 0) ? Util::emptyString : tmp5 + Util::toString(SETTING(MIN_UPLOAD_SPEED)); string myInfoA = - "$MyINFO $ALL " + toAcp(getCurrentNick()) + " " + toAcp(NmdcHub::validateMessage(getCurrentDescription(), false)) + + "$MyINFO $ALL " + toAcp(getCurrentNick()) + " " + toAcp(escape(getCurrentDescription())) + tmp1 + VERSIONSTRING + tmp2 + modeChar + tmp3 + getCounts() + tmp4 + Util::toString(SETTING(SLOTS)) + uMin + - ">$ $" + SETTING(UPLOAD_SPEED) + "\x01$" + toAcp(NmdcHub::validateMessage(SETTING(EMAIL), false)) + '$'; + ">$ $" + SETTING(UPLOAD_SPEED) + "\x01$" + toAcp(escape(SETTING(EMAIL))) + '$'; string myInfoB = ShareManager::getInstance()->getShareSizeString() + "$|"; if(lastMyInfoA != myInfoA || alwaysSend || (lastMyInfoB != myInfoB && lastUpdate + 15*60*1000 < GET_TICK()) ){ @@ -755,7 +769,7 @@ AutoArray<char> buf((char*)NULL); char c1 = (aSizeType == SearchManager::SIZE_DONTCARE) ? 'F' : 'T'; char c2 = (aSizeType == SearchManager::SIZE_ATLEAST) ? 'F' : 'T'; - string tmp = NmdcHub::validateMessage(toAcp((aFileType == SearchManager::TYPE_TTH) ? "TTH:" + aString : aString), false); + string tmp = toAcp(escape((aFileType == SearchManager::TYPE_TTH) ? "TTH:" + aString : aString)); string::size_type i; while((i = tmp.find(' ')) != string::npos) { tmp[i] = '$'; @@ -772,7 +786,7 @@ send(buf, chars); } -string NmdcHub::validateMessage(string tmp, bool reverse, bool checkNewLines) { +string NmdcHub::validateMessage(string tmp, bool reverse) { string::size_type i = 0; if(reverse) { @@ -790,6 +804,8 @@ tmp.replace(i, 5, "&"); i++; } +#if 0 +/// @todo move this to a better place if(checkNewLines) { // Check all '<' and '[' after newlines... i = 0; @@ -803,6 +819,7 @@ i++; } } +#endif } else { i = 0; while( (i = tmp.find("&", i)) != string::npos) { @@ -836,12 +853,13 @@ void NmdcHub::privateMessage(const OnlineUser& aUser, const string& aMessage) { checkstate(); - send("$To: " + toAcp(aUser.getIdentity().getNick()) + " From: " + toAcp(getMyNick()) + " $" + toAcp(NmdcHub::validateMessage("<" + getMyNick() + "> " + aMessage, false)) + "|"); + send("$To: " + toAcp(aUser.getIdentity().getNick()) + " From: " + toAcp(getMyNick()) + " $" + toAcp(escape("<" + getMyNick() + "> " + aMessage)) + "|"); // Emulate a returning message... Lock l(cs); - NickIter i = users.find(getMyNick()); - if(i != users.end()) - fire(ClientListener::PrivateMessage(), this, *i->second, aUser, *i->second, aMessage); + OnlineUser* ou = findUser(getMyNick()); + if(ou) { + fire(ClientListener::PrivateMessage(), this, *ou, aUser, *ou, aMessage); + } } // TimerManagerListener Modified: dcplusplus/trunk/client/NmdcHub.h =================================================================== --- dcplusplus/trunk/client/NmdcHub.h 2006-06-17 22:24:01 UTC (rev 617) +++ dcplusplus/trunk/client/NmdcHub.h 2006-06-17 23:26:36 UTC (rev 618) @@ -52,12 +52,12 @@ virtual size_t getUserCount() const { Lock l(cs); return users.size(); } virtual int64_t getAvailable() const; - virtual string escape(string const& str) const; - virtual string unescape(const string& str) const; + virtual string escape(string const& str) const { return validateMessage(str, false); } + static string unescape(const string& str) { return validateMessage(str, true); } virtual void send(const AdcCommand&) { dcassert(0); } - static string validateMessage(string tmp, bool reverse, bool checkNewLines); + static string validateMessage(string tmp, bool reverse); GETSET(int, supportFlags, SupportFlags); private: Modified: dcplusplus/trunk/windows/CommandDlg.cpp =================================================================== --- dcplusplus/trunk/windows/CommandDlg.cpp 2006-06-17 22:24:01 UTC (rev 617) +++ dcplusplus/trunk/windows/CommandDlg.cpp 2006-06-17 23:26:36 UTC (rev 618) @@ -84,7 +84,7 @@ dcassert(i != string::npos); tstring to = command.substr(5, i-5); string::size_type cmd_pos = command.find(_T('>'), 5) + 2; - tstring cmd = Text::toT(NmdcHub::validateMessage(Text::fromT(command.substr(cmd_pos, command.length()-cmd_pos-1)), true, false)); + tstring cmd = Text::toT(NmdcHub::validateMessage(Text::fromT(command.substr(cmd_pos, command.length()-cmd_pos-1)), true)); ctrlPM.SetCheck(BST_CHECKED); ctrlNick.SetWindowText(to.c_str()); ctrlCommand.SetWindowText(cmd.c_str()); @@ -94,7 +94,7 @@ { // Looks like a chat thing... string::size_type cmd_pos = command.find(_T('>')) + 2; - tstring cmd = Text::toT(NmdcHub::validateMessage(Text::fromT(command.substr(cmd_pos, command.length()-cmd_pos-1)), true, false)); + tstring cmd = Text::toT(NmdcHub::validateMessage(Text::fromT(command.substr(cmd_pos, command.length()-cmd_pos-1)), true)); ctrlChat.SetCheck(BST_CHECKED); ctrlCommand.SetWindowText(cmd.c_str()); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-06-17 22:24:50
|
Revision: 617 Author: arnetheduck Date: 2006-06-17 15:24:01 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=617&view=rev Log Message: ----------- Partial commit, more to come in a few minutes Modified Paths: -------------- dcplusplus/trunk/Example.xml dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/AdcHub.cpp dcplusplus/trunk/client/AdcHub.h dcplusplus/trunk/client/BufferedSocket.cpp dcplusplus/trunk/client/Client.cpp dcplusplus/trunk/client/Client.h dcplusplus/trunk/client/ClientManager.cpp dcplusplus/trunk/client/ClientManager.h dcplusplus/trunk/client/CryptoManager.cpp dcplusplus/trunk/client/CryptoManager.h dcplusplus/trunk/client/DCPlusPlus.cpp dcplusplus/trunk/client/FavoriteUser.h dcplusplus/trunk/client/NmdcHub.cpp dcplusplus/trunk/client/NmdcHub.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/StringDefs.cpp dcplusplus/trunk/client/StringDefs.h dcplusplus/trunk/client/User.cpp dcplusplus/trunk/client/User.h dcplusplus/trunk/client/Util.cpp dcplusplus/trunk/client/Util.h dcplusplus/trunk/windows/CommandDlg.cpp dcplusplus/trunk/windows/CommandDlg.h dcplusplus/trunk/windows/HubFrame.cpp dcplusplus/trunk/windows/MainFrm.cpp dcplusplus/trunk/windows/QueuePage.cpp dcplusplus/trunk/windows/UPnP.cpp dcplusplus/trunk/windows/UPnP.h Modified: dcplusplus/trunk/Example.xml =================================================================== --- dcplusplus/trunk/Example.xml 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/Example.xml 2006-06-17 22:24:01 UTC (rev 617) @@ -130,6 +130,7 @@ <String Name="File">File</String> <String Name="Files">Files</String> <String Name="FileHasNoTth">This file has no TTH</String> + <String Name="FileIsAlreadyQueued">This file is already queued</String> <String Name="FileListDiff">Subtract list</String> <String Name="FileListRefreshFailed">File list refresh failed: </String> <String Name="FileListRefreshFinished">File list refresh finished</String> @@ -406,6 +407,7 @@ <String Name="SettingsDefaultAwayMsg">Default away message</String> <String Name="SettingsDirect">Direct connection</String> <String Name="SettingsDirectories">Directories</String> + <String Name="SettingsDontDlAlreadyQueued">Don't download files already in the queue</String> <String Name="SettingsDontDlAlreadyShared">Don't download files already in share</String> <String Name="SettingsDownloadDirectory">Default download directory</String> <String Name="SettingsDownloadLimits">Limits</String> Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/changelog.txt 2006-06-17 22:24:01 UTC (rev 617) @@ -14,8 +14,11 @@ * [bug 959] Code cleanup (thanks pothead) * [bug 966] Max hash speed fixed when fast hashing method is not used (thanks steven sheehy) * [bug 967] Fixed path case-sensitivity issue (thanks steven sheehy) +* Fixed auto-reconnect +* [bug 936] Fixed duplicate entries in search hubs +* Fixed some hub title display issues +* Some code spring cleanup - -- 0.691 2006-06-03 -- * Links to bugzilla in html changelog * [bug 122] Added userlist filter (thanks trem) Modified: dcplusplus/trunk/client/AdcHub.cpp =================================================================== --- dcplusplus/trunk/client/AdcHub.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/AdcHub.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -29,7 +29,7 @@ #include "Util.h" #include "UserCommand.h" #include "FavoriteManager.h" -#include "SSLSocket.h" +#include "CryptoManager.h" const string AdcHub::CLIENT_PROTOCOL("ADC/0.10"); const string AdcHub::SECURE_CLIENT_PROTOCOL("ADCS/0.10"); @@ -453,8 +453,8 @@ ADDPARAM("ID", ClientManager::getInstance()->getMyCID().toBase32()); ADDPARAM("PD", ClientManager::getInstance()->getMyPID().toBase32()); - ADDPARAM("NI", getMyIdentity().getNick()); - ADDPARAM("DE", getMyIdentity().getDescription()); + ADDPARAM("NI", getCurrentNick()); + ADDPARAM("DE", getCurrentDescription()); ADDPARAM("SL", Util::toString(SETTING(SLOTS))); ADDPARAM("SS", ShareManager::getInstance()->getShareSizeString()); ADDPARAM("SF", Util::toString(ShareManager::getInstance()->getSharedFiles())); @@ -478,7 +478,7 @@ } string su; - if(SSLSocketFactory::getInstance()->hasCerts()) { + if(CryptoManager::getInstance()->hasCerts()) { su += ADCS_FEATURE + ","; } @@ -548,17 +548,6 @@ fire(ClientListener::Failed(), this, aLine); } -void AdcHub::on(TimerManagerListener::Second, u_int32_t aTick) throw() { - if(socket && (getLastActivity() + getReconnDelay() * 1000) < aTick) { - // Nothing's happened for ~120 seconds, check if we're connected, if not, try to connect... - if(!isConnected()) { - // Try to reconnect... - if(reconnect && !getAddress().empty()) - Client::connect(); - } - } -} - void AdcHub::send(const AdcCommand& cmd) { dcassert(socket); if(!socket) Modified: dcplusplus/trunk/client/AdcHub.h =================================================================== --- dcplusplus/trunk/client/AdcHub.h 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/AdcHub.h 2006-06-17 22:24:01 UTC (rev 617) @@ -30,7 +30,7 @@ class ClientManager; -class AdcHub : public Client, public CommandHandler<AdcHub>, private TimerManagerListener { +class AdcHub : public Client, public CommandHandler<AdcHub> { public: using Client::send; @@ -119,7 +119,6 @@ virtual void on(Connected) throw(); virtual void on(Line, const string& aLine) throw(); virtual void on(Failed, const string& aLine) throw(); - virtual void on(TimerManagerListener::Second, u_int32_t aTick) throw(); }; #endif // !defined(ADC_HUB_H) Modified: dcplusplus/trunk/client/BufferedSocket.cpp =================================================================== --- dcplusplus/trunk/client/BufferedSocket.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/BufferedSocket.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -27,6 +27,7 @@ #include "Streams.h" #include "SSLSocket.h" +#include "CryptoManager.h" // Polling is used for tasks...should be fixed... #define POLL_TIMEOUT 250 @@ -75,7 +76,7 @@ dcassert(!sock); dcdebug("BufferedSocket::accept() %p\n", (void*)this); - sock = secure ? SSLSocketFactory::getInstance()->getClientSocket() : new Socket; + sock = secure ? CryptoManager::getInstance()->getClientSocket() : new Socket; sock->accept(srv); if(SETTING(SOCKET_IN_BUFFER) > 0) @@ -103,7 +104,7 @@ dcassert(!sock); dcdebug("BufferedSocket::connect() %p\n", (void*)this); - sock = secure ? SSLSocketFactory::getInstance()->getClientSocket() : new Socket; + sock = secure ? CryptoManager::getInstance()->getClientSocket() : new Socket; sock->create(); if(SETTING(SOCKET_IN_BUFFER) >= 1024) Modified: dcplusplus/trunk/client/Client.cpp =================================================================== --- dcplusplus/trunk/client/Client.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/Client.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -29,20 +29,31 @@ Client::Counts Client::counts; Client::Client(const string& hubURL, char separator_, bool secure_) : - reconnDelay(120), lastActivity(0), registered(false), socket(NULL), + myIdentity(ClientManager::getInstance()->getMe(), 0), + reconnDelay(120), lastActivity(GET_TICK()), registered(false), autoReconnect(true), socket(0), hubUrl(hubURL), port(0), separator(separator_), secure(secure_), countType(COUNT_UNCOUNTED) { string file; Util::decodeUrl(hubURL, address, port, file); + + TimerManager::getInstance()->addListener(this); } Client::~Client() throw() { dcassert(!socket); + TimerManager::getInstance()->removeListener(this); updateCounts(true); } +void Client::reconnect() { + disconnect(true); + setAutoReconnect(true); + resetActivtiy(); +} + void Client::shutdown() { + if(socket) { BufferedSocket::putSocket(socket); socket = 0; @@ -52,29 +63,32 @@ void Client::reloadSettings(bool updateNick) { FavoriteHubEntry* hub = FavoriteManager::getInstance()->getFavoriteHubEntry(getHubUrl()); if(hub) { - if(updateNick) - getMyIdentity().setNick(checkNick(hub->getNick(true))); + if(updateNick) { + setCurrentNick(checkNick(hub->getNick(true))); + } + if(!hub->getUserDescription().empty()) { - getMyIdentity().setDescription(hub->getUserDescription()); + setCurrentDescription(hub->getUserDescription()); } else { - getMyIdentity().setDescription(SETTING(DESCRIPTION)); + setCurrentDescription(SETTING(DESCRIPTION)); } setPassword(hub->getPassword()); } else { - getMyIdentity().setNick(checkNick(SETTING(NICK))); - getMyIdentity().setDescription(SETTING(DESCRIPTION)); + setCurrentNick(checkNick(SETTING(NICK))); + setCurrentDescription(SETTING(DESCRIPTION)); } - getMyIdentity().setUser(ClientManager::getInstance()->getMe()); - getMyIdentity().setHubUrl(getHubUrl()); } void Client::connect() { if(socket) BufferedSocket::putSocket(socket); + setAutoReconnect(true); setReconnDelay(120 + Util::rand(0, 60)); reloadSettings(true); setRegistered(false); + setMyIdentity(Identity()); + setHubIdentity(Identity()); try { socket = BufferedSocket::getSocket(separator); @@ -97,10 +111,6 @@ socket->disconnect(graceLess); } -void Client::updateActivity() { - lastActivity = GET_TICK(); -} - void Client::updateCounts(bool aRemove) { // We always remove the count and then add the correct one if requested... if(countType == COUNT_NORMAL) { @@ -117,7 +127,7 @@ if(getMyIdentity().isOp()) { Thread::safeInc(counts.op); countType = COUNT_OP; - } else if(registered) { + } else if(getMyIdentity().isRegistered()) { Thread::safeInc(counts.registered); countType = COUNT_REGISTERED; } else { @@ -145,3 +155,10 @@ return Util::getLocalIp(); return lip; } + +void Client::on(Second, u_int32_t aTick) throw() { + if(getAutoReconnect() && !isConnected() && (getLastActivity() + getReconnDelay() * 1000) < aTick) { + // Try to reconnect... + connect(); + } +} Modified: dcplusplus/trunk/client/Client.h =================================================================== --- dcplusplus/trunk/client/Client.h 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/Client.h 2006-06-17 22:24:01 UTC (rev 617) @@ -26,6 +26,7 @@ #include "User.h" #include "BufferedSocket.h" #include "SettingsManager.h" +#include "TimerManager.h" class Client; class AdcCommand; @@ -77,7 +78,7 @@ }; /** Yes, this should probably be called a Hub */ -class Client : public Speaker<ClientListener>, public BufferedSocketListener { +class Client : public Speaker<ClientListener>, public BufferedSocketListener, protected TimerManagerListener { public: typedef Client* Ptr; typedef list<Ptr> List; @@ -125,6 +126,8 @@ return sm; } + void reconnect(); + void shutdown(); void send(const string& aMessage) { send(aMessage.c_str(), aMessage.length()); } @@ -140,7 +143,6 @@ const string& getHubName() const { return getHubIdentity().getNick().empty() ? getHubUrl() : getHubIdentity().getNick(); } const string& getHubDescription() const { return getHubIdentity().getDescription(); } - Identity& getMyIdentity() { return myIdentity; } Identity& getHubIdentity() { return hubIdentity; } const string& getHubUrl() const { return hubUrl; } @@ -152,7 +154,10 @@ GETSET(u_int32_t, reconnDelay, ReconnDelay); GETSET(u_int32_t, lastActivity, LastActivity); GETSET(bool, registered, Registered); + GETSET(bool, autoReconnect, AutoReconnect); + GETSET(string, currentNick, CurrentNick); + GETSET(string, currentDescription, CurrentDescription); protected: friend class ClientManager; Client(const string& hubURL, char separator, bool secure_); @@ -171,13 +176,17 @@ Counts lastCounts; void updateCounts(bool aRemove); - void updateActivity(); + void updateActivity() { lastActivity = GET_TICK(); } + void resetActivtiy() { lastActivity = 0; } /** Reload details from favmanager or settings */ void reloadSettings(bool updateNick); virtual string checkNick(const string& nick) = 0; + // TimerManagerListener + virtual void on(Second, u_int32_t aTick) throw(); + private: enum CountType { @@ -196,12 +205,13 @@ u_int16_t port; char separator; bool secure; - CountType countType; // BufferedSocketListener virtual void on(Connecting) throw() { fire(ClientListener::Connecting(), this); } virtual void on(Connected) throw() { updateActivity(); ip = socket->getIp(); fire(ClientListener::Connected(), this); } + + }; #endif // !defined(CLIENT_H) Modified: dcplusplus/trunk/client/ClientManager.cpp =================================================================== --- dcplusplus/trunk/client/ClientManager.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/ClientManager.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -405,14 +405,6 @@ SearchManager::getInstance()->respond(adc, from); } -Identity ClientManager::getIdentity(const User::Ptr& aUser) { - OnlineIter i = onlineUsers.find(aUser->getCID()); - if(i != onlineUsers.end()) { - return i->second->getIdentity(); - } - return Identity(aUser, Util::emptyString, 0); -} - void ClientManager::search(int aSizeMode, int64_t aSize, int aFileType, const string& aString, const string& aToken) { Lock l(cs); Modified: dcplusplus/trunk/client/ClientManager.h =================================================================== --- dcplusplus/trunk/client/ClientManager.h 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/ClientManager.h 2006-06-17 22:24:01 UTC (rev 617) @@ -89,8 +89,6 @@ void lock() throw() { cs.enter(); } void unlock() throw() { cs.leave(); } - Identity getIdentity(const User::Ptr& aUser); - Client::List& getClients() { return clients; } string getCachedIp() const { Lock l(cs); return cachedIp; } Modified: dcplusplus/trunk/client/CryptoManager.cpp =================================================================== --- dcplusplus/trunk/client/CryptoManager.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/CryptoManager.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -24,13 +24,118 @@ #include "BitInputStream.h" #include "BitOutputStream.h" #include "ResourceManager.h" +#include "LogManager.h" +#include <openssl/ssl.h> + #ifdef _WIN32 #include "../bzip2/bzlib.h" #else #include <bzlib.h> #endif +CryptoManager::CryptoManager() +: + clientContext(SSL_CTX_new(TLSv1_client_method())), + serverContext(SSL_CTX_new(TLSv1_server_method())), + dh(DH_new()), + certsLoaded(false), + lock("EXTENDEDPROTOCOLABCABCABCABCABCABC"), + pk("DCPLUSPLUS" VERSIONSTRING "ABCABC") +{ + static unsigned char dh512_p[] = + { + 0xDA,0x58,0x3C,0x16,0xD9,0x85,0x22,0x89,0xD0,0xE4,0xAF,0x75, + 0x6F,0x4C,0xCA,0x92,0xDD,0x4B,0xE5,0x33,0xB8,0x04,0xFB,0x0F, + 0xED,0x94,0xEF,0x9C,0x8A,0x44,0x03,0xED,0x57,0x46,0x50,0xD3, + 0x69,0x99,0xDB,0x29,0xD7,0x76,0x27,0x6B,0xA2,0xD3,0xD4,0x12, + 0xE2,0x18,0xF4,0xDD,0x1E,0x08,0x4C,0xF6,0xD8,0x00,0x3E,0x7C, + 0x47,0x74,0xE8,0x33, + }; + + static unsigned char dh512_g[] = + { + 0x02, + }; + + if(dh) { + dh->p = BN_bin2bn(dh512_p, sizeof(dh512_p), 0); + dh->g = BN_bin2bn(dh512_g, sizeof(dh512_g), 0); + + if (!dh->p || !dh->g) { + DH_free(dh); + dh = 0; + } else { + SSL_CTX_set_tmp_dh(serverContext, dh); + } + } +} + +CryptoManager::~CryptoManager() { + if(serverContext) + SSL_CTX_free(serverContext); + if(clientContext) + SSL_CTX_free(clientContext); + if(dh) + DH_free(dh); +} + + +void CryptoManager::loadCertificates() throw() { + SSL_CTX_set_verify(serverContext, SSL_VERIFY_NONE, 0); + SSL_CTX_set_verify(clientContext, SSL_VERIFY_NONE, 0); + + if(!SETTING(SSL_CERTIFICATE_FILE).empty()) { + if(SSL_CTX_use_certificate_file(serverContext, SETTING(SSL_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { + LogManager::getInstance()->message("Failed to load certificate file"); + return; + } + if(SSL_CTX_use_certificate_file(clientContext, SETTING(SSL_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { + LogManager::getInstance()->message("Failed to load certificate file"); + return; + } + } + + if(!SETTING(SSL_PRIVATE_KEY_FILE).empty()) { + if(SSL_CTX_use_PrivateKey_file(serverContext, SETTING(SSL_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { + LogManager::getInstance()->message("Failed to load private key"); + return; + } + if(SSL_CTX_use_PrivateKey_file(clientContext, SETTING(SSL_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { + LogManager::getInstance()->message("Failed to load private key"); + return; + } + } + +#ifdef _WIN32 + WIN32_FIND_DATA data; + HANDLE hFind; + + hFind = FindFirstFile(Text::toT(SETTING(SSL_TRUSTED_CERTIFICATES_PATH) + "*.pem").c_str(), &data); + if(hFind != INVALID_HANDLE_VALUE) { + do { + if(SSL_CTX_load_verify_locations(clientContext, (SETTING(SSL_TRUSTED_CERTIFICATES_PATH) + Text::fromT(data.cFileName)).c_str(), NULL) != SSL_SUCCESS) { + LogManager::getInstance()->message("Failed to load trusted certificate from " + Text::fromT(data.cFileName)); + } + } while(FindNextFile(hFind, &data)); + + FindClose(hFind); + } +#else +#error todo +#endif + certsLoaded = true; +} + + +SSLSocket* CryptoManager::getClientSocket() throw(SocketException) { + return new SSLSocket(clientContext); +} +SSLSocket* CryptoManager::getServerSocket() throw(SocketException) { + return new SSLSocket(serverContext); +} + + void CryptoManager::decodeBZ2(const u_int8_t* is, size_t sz, string& os) throw (CryptoException) { bz_stream bs = { 0 }; Modified: dcplusplus/trunk/client/CryptoManager.h =================================================================== --- dcplusplus/trunk/client/CryptoManager.h 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/CryptoManager.h 2006-06-17 22:24:01 UTC (rev 617) @@ -29,6 +29,7 @@ #include "Singleton.h" #include "FastAlloc.h" #include "version.h" +#include "SSLSocket.h" STANDARD_EXCEPTION(CryptoException); @@ -79,12 +80,18 @@ void decodeHuffman(const u_int8_t* /*is*/, string& /*os*/, const size_t /*len*/) throw(CryptoException); void decodeBZ2(const u_int8_t* is, size_t sz, string& os) throw(CryptoException); + + SSLSocket* getClientSocket() throw(SocketException); + SSLSocket* getServerSocket() throw(SocketException); + + void loadCertificates() throw(); + bool hasCerts() const { return certsLoaded; } private: friend class Singleton<CryptoManager>; - CryptoManager() : lock("EXTENDEDPROTOCOLABCABCABCABCABCABC"), pk("DCPLUSPLUS" VERSIONSTRING "ABCABC") { } - virtual ~CryptoManager() { } + CryptoManager(); + virtual ~CryptoManager(); class Leaf : public FastAlloc<Leaf> { public: @@ -108,6 +115,11 @@ } }; + SSL_CTX* clientContext; + SSL_CTX* serverContext; + DH* dh; + bool certsLoaded; + const string lock; const string pk; Modified: dcplusplus/trunk/client/DCPlusPlus.cpp =================================================================== --- dcplusplus/trunk/client/DCPlusPlus.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/DCPlusPlus.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -33,7 +33,6 @@ #include "SettingsManager.h" #include "FinishedManager.h" #include "ADLSearch.h" -#include "SSLSocket.h" #include "StringTokenizer.h" @@ -61,7 +60,6 @@ QueueManager::newInstance(); FinishedManager::newInstance(); ADLSearchManager::newInstance(); - SSLSocketFactory::newInstance(); SettingsManager::getInstance()->load(); @@ -70,7 +68,7 @@ } FavoriteManager::getInstance()->load(); - SSLSocketFactory::getInstance()->loadCertificates(); + CryptoManager::getInstance()->loadCertificates(); if(f != NULL) (*f)(p, STRING(HASH_DATABASE)); @@ -93,7 +91,6 @@ SettingsManager::getInstance()->save(); - SSLSocketFactory::deleteInstance(); ADLSearchManager::deleteInstance(); FinishedManager::deleteInstance(); ShareManager::deleteInstance(); Modified: dcplusplus/trunk/client/FavoriteUser.h =================================================================== --- dcplusplus/trunk/client/FavoriteUser.h 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/FavoriteUser.h 2006-06-17 22:24:01 UTC (rev 617) @@ -37,7 +37,7 @@ User::Ptr& getUser() { return user; } - void update(const OnlineUser& info) { setNick(info.getIdentity().getNick()); setUrl(info.getIdentity().getHubUrl()); } + void update(const OnlineUser& info); GETSET(User::Ptr, user, User); GETSET(string, nick, Nick); Modified: dcplusplus/trunk/client/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/client/NmdcHub.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/NmdcHub.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -33,18 +33,15 @@ #include "StringTokenizer.h" NmdcHub::NmdcHub(const string& aHubURL) : Client(aHubURL, '|', false), supportFlags(0), state(STATE_CONNECT), - reconnect(true), lastUpdate(0) + lastUpdate(0) { - TimerManager::getInstance()->addListener(this); } NmdcHub::~NmdcHub() throw() { - TimerManager::getInstance()->removeListener(this); clearUsers(); } void NmdcHub::connect() { - reconnect = true; supportFlags = 0; lastMyInfoA.clear(); lastMyInfoB.clear(); @@ -89,8 +86,6 @@ User::Ptr p; if(aNick == getMyNick()) { p = ClientManager::getInstance()->getMe(); - getMyIdentity().setUser(p); - getMyIdentity().setHubUrl(getHubUrl()); } else { p = ClientManager::getInstance()->getUser(aNick, getHubUrl()); } @@ -99,6 +94,9 @@ Lock l(cs); u = users.insert(make_pair(aNick, new OnlineUser(p, *this, 0))).first->second; u->getIdentity().setNick(aNick); + if(u->getUser() == getMyIdentity().getUser()) { + setMyIdentity(u->getIdentity()); + } } ClientManager::getInstance()->putOnline(*u); @@ -190,12 +188,12 @@ // Check if we're being banned... if(state != STATE_CONNECTED) { if(Util::findSubString(aLine, "banned") != string::npos) { - reconnect = false; + setAutoReconnect(false); } } - string line = fromNmdc(aLine); + string line = fromAcp(aLine); // @todo Decrypt who the message is from... - fire(ClientListener::StatusMessage(), this, Util::validateMessage(fromNmdc(aLine), true)); + fire(ClientListener::StatusMessage(), this, unescape(fromAcp(aLine))); return; } @@ -207,7 +205,7 @@ cmd = aLine; } else { cmd = aLine.substr(0, x); - param = fromNmdc(aLine.substr(x+1)); + param = fromAcp(aLine.substr(x+1)); } if(cmd == "$Search") { @@ -321,7 +319,7 @@ if(j == string::npos) return; - string tmpDesc = Util::validateMessage(param.substr(i, j-i), true); + string tmpDesc = unescape(param.substr(i, j-i)); // Look for a tag... if(tmpDesc.size() > 0 && tmpDesc[tmpDesc.size()-1] == '>') { x = tmpDesc.rfind('<'); @@ -353,7 +351,7 @@ if(j == string::npos) return; - u.getIdentity().setEmail(Util::validateMessage(param.substr(i, j-i), true)); + u.getIdentity().setEmail(unescape(param.substr(i, j-i)); i = j + 1; j = param.find('$', i); @@ -361,8 +359,9 @@ return; u.getIdentity().setBytesShared(param.substr(i, j-i)); - if(u.getUser() == getMyIdentity().getUser()) + if(u.getUser() == getMyIdentity().getUser()) { setMyIdentity(u.getIdentity()); + } fire(ClientListener::UserUpdated(), this, u); } else if(cmd == "$Quit") { @@ -428,11 +427,11 @@ // Hack - first word goes to hub name, rest to description string::size_type i = param.find(' '); if(i == string::npos) { - getHubIdentity().setNick(param); + getHubIdentity().setNick(unescape(param)); getHubIdentity().setDescription(Util::emptyString); } else { - getHubIdentity().setNick(param.substr(0, i)); - getHubIdentity().setDescription(param.substr(i+1)); + getHubIdentity().setNick(unescape(param.substr(0, i))); + getHubIdentity().setDescription(unescape(param.substr(i+1))); } fire(ClientListener::HubUpdated(), this); } else if(cmd == "$Supports") { @@ -470,7 +469,7 @@ string name = param.substr(i, j-i); i = j+1; string command = param.substr(i, param.length() - i); - fire(ClientListener::UserCommand(), this, type, ctx, Util::validateMessage(name, true, false), Util::validateMessage(command, true, false)); + fire(ClientListener::UserCommand(), this, type, ctx, unescape(name), unescape(command)); } } else if(cmd == "$Lock") { if(state != STATE_LOCK) { @@ -478,7 +477,7 @@ } state = STATE_HELLO; - // Param must not be fromNmdc'd... + // Param must not be fromAcp'd... param = aLine.substr(6); if(!param.empty()) { @@ -562,6 +561,9 @@ continue; u->getIdentity().setIp(it->substr(j+1)); + if(u->getUser() == getMyIdentity().getUser()) { + setMyIdentity(u->getIdentity()); + } v.push_back(u); } @@ -584,10 +586,10 @@ string tmp; // Let's assume 10 characters per nick... tmp.reserve(v.size() * (11 + 10 + getMyNick().length())); - string n = ' ' + toNmdc(getMyNick()) + '|'; + string n = ' ' + toAcp(getMyNick()) + '|'; for(OnlineUser::List::const_iterator i = v.begin(); i != v.end(); ++i) { tmp += "$GetINFO "; - tmp += toNmdc((*i)->getIdentity().getNick()); + tmp += toAcp((*i)->getIdentity().getNick()); tmp += n; } if(!tmp.empty()) { @@ -607,8 +609,9 @@ continue; OnlineUser& ou = getUser(*it); ou.getIdentity().setOp(true); - if(*it == getMyNick()) - getMyIdentity().setOp(true); + if(ou.getUser() == getMyIdentity().getUser()) { + setMyIdentity(ou.getIdentity()); + } v.push_back(&ou); } @@ -650,13 +653,15 @@ OnlineUser* to = findUser(getMyNick()); if(replyTo == NULL || from == NULL || to == NULL) { - fire(ClientListener::StatusMessage(), this, Util::validateMessage(param.substr(i), true)); + fire(ClientListener::StatusMessage(), this, unescape(param.substr(i))); } else { string msg = param.substr(j + 2); - fire(ClientListener::PrivateMessage(), this, *from, *to, *replyTo, Util::validateMessage(param.substr(j + 2), true)); + fire(ClientListener::PrivateMessage(), this, *from, *to, *replyTo, unescape(param.substr(j + 2))); } } else if(cmd == "$GetPass") { - setRegistered(true); + OnlineUser& ou = getUser(getMyNick()); + ou.getIdentity().set("RG", "1"); + setMyIdentity(ou.getIdentity()); fire(ClientListener::GetPassword(), this); } else if(cmd == "$BadPass") { fire(ClientListener::BadPassword(), this); @@ -681,18 +686,18 @@ checkstate(); dcdebug("NmdcHub::connectToMe %s\n", aUser.getIdentity().getNick().c_str()); ConnectionManager::getInstance()->nmdcExpect(aUser.getIdentity().getNick(), getMyNick(), getHubUrl()); - send("$ConnectToMe " + toNmdc(aUser.getIdentity().getNick()) + " " + getLocalIp() + ":" + Util::toString(ConnectionManager::getInstance()->getPort()) + "|"); + send("$ConnectToMe " + toAcp(aUser.getIdentity().getNick()) + " " + getLocalIp() + ":" + Util::toString(ConnectionManager::getInstance()->getPort()) + "|"); } void NmdcHub::revConnectToMe(const OnlineUser& aUser) { checkstate(); dcdebug("NmdcHub::revConnectToMe %s\n", aUser.getIdentity().getNick().c_str()); - send("$RevConnectToMe " + toNmdc(getMyNick()) + " " + toNmdc(aUser.getIdentity().getNick()) + "|"); + send("$RevConnectToMe " + toAcp(getMyNick()) + " " + toAcp(aUser.getIdentity().getNick()) + "|"); } void NmdcHub::hubMessage(const string& aMessage) { checkstate(); - send(toNmdc( "<" + getMyNick() + "> " + Util::validateMessage(aMessage, false) + "|" ) ); + send(toAcp( "<" + getMyNick() + "> " + escape(aMessage) + "|" ) ); } void NmdcHub::myInfo(bool alwaysSend) { @@ -726,9 +731,9 @@ string uMin = (SETTING(MIN_UPLOAD_SPEED) == 0) ? Util::emptyString : tmp5 + Util::toString(SETTING(MIN_UPLOAD_SPEED)); string myInfoA = - "$MyINFO $ALL " + toNmdc(checkNick(getMyNick())) + " " + toNmdc(Util::validateMessage(getMyIdentity().getDescription(), false)) + + "$MyINFO $ALL " + toAcp(getCurrentNick()) + " " + toAcp(NmdcHub::validateMessage(getCurrentDescription(), false)) + tmp1 + VERSIONSTRING + tmp2 + modeChar + tmp3 + getCounts() + tmp4 + Util::toString(SETTING(SLOTS)) + uMin + - ">$ $" + SETTING(UPLOAD_SPEED) + "\x01$" + toNmdc(Util::validateMessage(SETTING(EMAIL), false)) + '$'; + ">$ $" + SETTING(UPLOAD_SPEED) + "\x01$" + toAcp(NmdcHub::validateMessage(SETTING(EMAIL), false)) + '$'; string myInfoB = ShareManager::getInstance()->getShareSizeString() + "$|"; if(lastMyInfoA != myInfoA || alwaysSend || (lastMyInfoB != myInfoB && lastUpdate + 15*60*1000 < GET_TICK()) ){ @@ -750,7 +755,7 @@ AutoArray<char> buf((char*)NULL); char c1 = (aSizeType == SearchManager::SIZE_DONTCARE) ? 'F' : 'T'; char c2 = (aSizeType == SearchManager::SIZE_ATLEAST) ? 'F' : 'T'; - string tmp = Util::validateMessage(toNmdc((aFileType == SearchManager::TYPE_TTH) ? "TTH:" + aString : aString), false); + string tmp = NmdcHub::validateMessage(toAcp((aFileType == SearchManager::TYPE_TTH) ? "TTH:" + aString : aString), false); string::size_type i; while((i = tmp.find(' ')) != string::npos) { tmp[i] = '$'; @@ -762,15 +767,76 @@ chars = sprintf(buf, "$Search %s:%d %c?%c?%s?%d?%s|", x.c_str(), (int)SearchManager::getInstance()->getPort(), c1, c2, Util::toString(aSize).c_str(), aFileType+1, tmp.c_str()); } else { buf = new char[getMyNick().length() + aString.length() + 64]; - chars = sprintf(buf, "$Search Hub:%s %c?%c?%s?%d?%s|", toNmdc(getMyNick()).c_str(), c1, c2, Util::toString(aSize).c_str(), aFileType+1, tmp.c_str()); + chars = sprintf(buf, "$Search Hub:%s %c?%c?%s?%d?%s|", toAcp(getMyNick()).c_str(), c1, c2, Util::toString(aSize).c_str(), aFileType+1, tmp.c_str()); } send(buf, chars); } +string NmdcHub::validateMessage(string tmp, bool reverse, bool checkNewLines) { + string::size_type i = 0; + + if(reverse) { + while( (i = tmp.find("$", i)) != string::npos) { + tmp.replace(i, 5, "$"); + i++; + } + i = 0; + while( (i = tmp.find("|", i)) != string::npos) { + tmp.replace(i, 6, "|"); + i++; + } + i = 0; + while( (i = tmp.find("&", i)) != string::npos) { + tmp.replace(i, 5, "&"); + i++; + } + if(checkNewLines) { + // Check all '<' and '[' after newlines... + i = 0; + while( (i = tmp.find('\n', i)) != string::npos) { + if(i + 1 < tmp.length()) { + if(tmp[i+1] == '[' || tmp[i+1] == '<') { + tmp.insert(i+1, "- "); + i += 2; + } + } + i++; + } + } + } else { + i = 0; + while( (i = tmp.find("&", i)) != string::npos) { + tmp.replace(i, 1, "&"); + i += 4; + } + i = 0; + while( (i = tmp.find("$", i)) != string::npos) { + tmp.replace(i, 1, "&"); + i += 4; + } + i = 0; + while( (i = tmp.find("|", i)) != string::npos) { + tmp.replace(i, 1, "&"); + i += 4; + } + i = 0; + while( (i = tmp.find('$', i)) != string::npos) { + tmp.replace(i, 1, "$"); + i += 4; + } + i = 0; + while( (i = tmp.find('|', i)) != string::npos) { + tmp.replace(i, 1, "|"); + i += 5; + } + } + return tmp; +} + void NmdcHub::privateMessage(const OnlineUser& aUser, const string& aMessage) { checkstate(); - send("$To: " + toNmdc(aUser.getIdentity().getNick()) + " From: " + toNmdc(getMyNick()) + " $" + toNmdc(Util::validateMessage("<" + getMyNick() + "> " + aMessage, false)) + "|"); + send("$To: " + toAcp(aUser.getIdentity().getNick()) + " From: " + toAcp(getMyNick()) + " $" + toAcp(NmdcHub::validateMessage("<" + getMyNick() + "> " + aMessage, false)) + "|"); // Emulate a returning message... Lock l(cs); NickIter i = users.find(getMyNick()); @@ -779,18 +845,12 @@ } // TimerManagerListener -void NmdcHub::on(TimerManagerListener::Second, u_int32_t aTick) throw() { - if(socket && (getLastActivity() + getReconnDelay() * 1000) < aTick) { - // Nothing's happened for ~120 seconds, check if we're connected, if not, try to connect... - if(isConnected()) { - // Try to send something for the fun of it... - dcdebug("Testing writing...\n"); - send("|", 1); - } else { - // Try to reconnect... - if(reconnect && !getAddress().empty()) - connect(); - } +void NmdcHub::on(Second, u_int32_t aTick) throw() { + + if(isConnected() && (getLastActivity() + getReconnDelay() * 1000) < aTick) { + // Try to send something for the fun of it... + dcdebug("Testing writing...\n"); + send("|", 1); } { Lock l(cs); @@ -803,6 +863,8 @@ flooders.pop_front(); } } + + Client::on(Second(), aTick); } // BufferedSocketListener Modified: dcplusplus/trunk/client/NmdcHub.h =================================================================== --- dcplusplus/trunk/client/NmdcHub.h 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/NmdcHub.h 2006-06-17 22:24:01 UTC (rev 617) @@ -33,7 +33,7 @@ class ClientManager; -class NmdcHub : public Client, private TimerManagerListener, private Flags +class NmdcHub : public Client, private Flags { public: using Client::send; @@ -44,18 +44,21 @@ virtual void hubMessage(const string& aMessage); virtual void privateMessage(const OnlineUser& aUser, const string& aMessage); - virtual void sendUserCmd(const string& aUserCmd) throw() { send(toNmdc(aUserCmd)); } + virtual void sendUserCmd(const string& aUserCmd) throw() { send(toAcp(aUserCmd)); } virtual void search(int aSizeType, int64_t aSize, int aFileType, const string& aString, const string& aToken); - virtual void password(const string& aPass) { send("$MyPass " + toNmdc(aPass) + "|"); } + virtual void password(const string& aPass) { send("$MyPass " + toAcp(aPass) + "|"); } virtual void info(bool force) { myInfo(force); } virtual size_t getUserCount() const { Lock l(cs); return users.size(); } virtual int64_t getAvailable() const; - virtual string escape(string const& str) const { return Util::validateMessage(str, false); } + virtual string escape(string const& str) const; + virtual string unescape(const string& str) const; virtual void send(const AdcCommand&) { dcassert(0); } + static string validateMessage(string tmp, bool reverse, bool checkNewLines); + GETSET(int, supportFlags, SupportFlags); private: friend class ClientManager; @@ -79,7 +82,6 @@ NickMap users; - bool reconnect; u_int32_t lastUpdate; string lastMyInfoA, lastMyInfoB; @@ -102,10 +104,10 @@ OnlineUser* findUser(const string& aNick); void putUser(const string& aNick); - string fromNmdc(const string& str) const { return Text::acpToUtf8(str); } - string toNmdc(const string& str) const { return Text::utf8ToAcp(str); } + string fromAcp(const string& str) const { return Text::acpToUtf8(str); } + string toAcp(const string& str) const { return Text::utf8ToAcp(str); } - void validateNick(const string& aNick) { send("$ValidateNick " + toNmdc(aNick) + "|"); } + void validateNick(const string& aNick) { send("$ValidateNick " + toAcp(aNick) + "|"); } void key(const string& aKey) { send("$Key " + aKey + "|"); } void version() { send("$Version 1,0091|"); } void getNickList() { send("$GetNickList|"); } @@ -119,7 +121,7 @@ virtual string checkNick(const string& aNick); // TimerManagerListener - virtual void on(TimerManagerListener::Second, u_int32_t aTick) throw(); + virtual void on(Second, u_int32_t aTick) throw(); virtual void on(Line, const string& l) throw() { onLine(l); } virtual void on(Failed, const string&) throw(); Modified: dcplusplus/trunk/client/QueueManager.cpp =================================================================== --- dcplusplus/trunk/client/QueueManager.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/QueueManager.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -489,7 +489,9 @@ q->setTTH(new TTHValue(*root)); } else if(!(*root == *q->getTTH())) { throw QueueException(STRING(FILE_WITH_DIFFERENT_TTH)); - } + } else if(BOOLSETTING(DONT_DL_ALREADY_QUEUED)) { + throw QueueException(STRING(FILE_IS_ALREADY_QUEUED)); + } } q->setFlag(aFlags); Modified: dcplusplus/trunk/client/SSLSocket.cpp =================================================================== --- dcplusplus/trunk/client/SSLSocket.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/SSLSocket.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -25,102 +25,7 @@ #include <openssl/ssl.h> -SSLSocketFactory::SSLSocketFactory() -: clientContext(SSL_CTX_new(TLSv1_client_method())), - serverContext(SSL_CTX_new(TLSv1_server_method())), - dh(DH_new()), - certsLoaded(false) -{ - static unsigned char dh512_p[] = - { - 0xDA,0x58,0x3C,0x16,0xD9,0x85,0x22,0x89,0xD0,0xE4,0xAF,0x75, - 0x6F,0x4C,0xCA,0x92,0xDD,0x4B,0xE5,0x33,0xB8,0x04,0xFB,0x0F, - 0xED,0x94,0xEF,0x9C,0x8A,0x44,0x03,0xED,0x57,0x46,0x50,0xD3, - 0x69,0x99,0xDB,0x29,0xD7,0x76,0x27,0x6B,0xA2,0xD3,0xD4,0x12, - 0xE2,0x18,0xF4,0xDD,0x1E,0x08,0x4C,0xF6,0xD8,0x00,0x3E,0x7C, - 0x47,0x74,0xE8,0x33, - }; - static unsigned char dh512_g[] = - { - 0x02, - }; - - if(dh) { - dh->p = BN_bin2bn(dh512_p, sizeof(dh512_p), 0); - dh->g = BN_bin2bn(dh512_g, sizeof(dh512_g), 0); - - if (!dh->p || !dh->g) { - DH_free(dh); - dh = 0; - } else { - SSL_CTX_set_tmp_dh(serverContext, dh); - } - } -} - -void SSLSocketFactory::loadCertificates() throw() { - SSL_CTX_set_verify(serverContext, SSL_VERIFY_NONE, 0); - SSL_CTX_set_verify(clientContext, SSL_VERIFY_NONE, 0); - - if(!SETTING(SSL_CERTIFICATE_FILE).empty()) { - if(SSL_CTX_use_certificate_file(serverContext, SETTING(SSL_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { - LogManager::getInstance()->message("Failed to load certificate file"); - return; - } - if(SSL_CTX_use_certificate_file(clientContext, SETTING(SSL_CERTIFICATE_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { - LogManager::getInstance()->message("Failed to load certificate file"); - return; - } - } - - if(!SETTING(SSL_PRIVATE_KEY_FILE).empty()) { - if(SSL_CTX_use_PrivateKey_file(serverContext, SETTING(SSL_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { - LogManager::getInstance()->message("Failed to load private key"); - return; - } - if(SSL_CTX_use_PrivateKey_file(clientContext, SETTING(SSL_PRIVATE_KEY_FILE).c_str(), SSL_FILETYPE_PEM) != SSL_SUCCESS) { - LogManager::getInstance()->message("Failed to load private key"); - return; - } - } - -#ifdef _WIN32 - WIN32_FIND_DATA data; - HANDLE hFind; - - hFind = FindFirstFile(Text::toT(SETTING(SSL_TRUSTED_CERTIFICATES_PATH) + "*.pem").c_str(), &data); - if(hFind != INVALID_HANDLE_VALUE) { - do { - if(SSL_CTX_load_verify_locations(clientContext, (SETTING(SSL_TRUSTED_CERTIFICATES_PATH) + Text::fromT(data.cFileName)).c_str(), NULL) != SSL_SUCCESS) { - LogManager::getInstance()->message("Failed to load trusted certificate from " + Text::fromT(data.cFileName)); - } - } while(FindNextFile(hFind, &data)); - - FindClose(hFind); - } -#else -#error todo -#endif - certsLoaded = true; -} - -SSLSocketFactory::~SSLSocketFactory() { - if(serverContext) - SSL_CTX_free(serverContext); - if(clientContext) - SSL_CTX_free(clientContext); - if(dh) - DH_free(dh); -} - -SSLSocket* SSLSocketFactory::getClientSocket() throw(SocketException) { - return new SSLSocket(clientContext); -} -SSLSocket* SSLSocketFactory::getServerSocket() throw(SocketException) { - return new SSLSocket(serverContext); -} - SSLSocket::SSLSocket(SSL_CTX* context) throw(SocketException) : ctx(context), ssl(0) { } Modified: dcplusplus/trunk/client/SSLSocket.h =================================================================== --- dcplusplus/trunk/client/SSLSocket.h 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/SSLSocket.h 2006-06-17 22:24:01 UTC (rev 617) @@ -32,23 +32,8 @@ using namespace yaSSL; -class SSLSocketFactory : public Singleton<SSLSocketFactory> { -public: - SSLSocketFactory(); - virtual ~SSLSocketFactory(); +class CryptoManager; - SSLSocket* getClientSocket() throw(SocketException); - SSLSocket* getServerSocket() throw(SocketException); - - void loadCertificates() throw(); - bool hasCerts() const { return certsLoaded; } -private: - SSL_CTX* clientContext; - SSL_CTX* serverContext; - DH* dh; - bool certsLoaded; -}; - class SSLSocket : public Socket { public: virtual ~SSLSocket() throw() {} @@ -61,7 +46,7 @@ virtual void shutdown() throw(); virtual void close() throw(); private: - friend class SSLSocketFactory; + friend class CryptoManager; SSLSocket(SSL_CTX* context) throw(SocketException); SSLSocket(const SSLSocket&); Modified: dcplusplus/trunk/client/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/client/SettingsManager.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/SettingsManager.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -74,6 +74,7 @@ "BoldHub", "BoldPm", "BoldSearch", "SocketInBuffer", "SocketOutBuffer", "OnlyDlTthFiles", "OpenWaitingUsers", "BoldWaitingUsers", "OpenSystemLog", "BoldSystemLog", "AutoRefreshTime", "UseSsl", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", "PromptPassword", "SpyFrameIgnoreTthSearches", + "DontDlAlreadyQueued", "SENTRY", // Int64 "TotalUpload", "TotalDownload", @@ -258,6 +259,7 @@ setDefault(AUTO_KICK_NO_FAVS, false); setDefault(PROMPT_PASSWORD, false); setDefault(SPY_FRAME_IGNORE_TTH_SEARCHES, false); + setDefault(DONT_DL_ALREADY_QUEUED, false); #ifdef _WIN32 setDefault(MAIN_WINDOW_STATE, SW_SHOWNORMAL); Modified: dcplusplus/trunk/client/SettingsManager.h =================================================================== --- dcplusplus/trunk/client/SettingsManager.h 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/SettingsManager.h 2006-06-17 22:24:01 UTC (rev 617) @@ -89,7 +89,8 @@ NO_IP_OVERRIDE, SEARCH_ONLY_FREE_SLOTS, LAST_SEARCH_TYPE, BOLD_FINISHED_DOWNLOADS, BOLD_FINISHED_UPLOADS, BOLD_QUEUE, BOLD_HUB, BOLD_PM, BOLD_SEARCH, SOCKET_IN_BUFFER, SOCKET_OUT_BUFFER, ONLY_DL_TTH_FILES, OPEN_WAITING_USERS, BOLD_WAITING_USERS, OPEN_SYSTEM_LOG, BOLD_SYSTEM_LOG, AUTO_REFRESH_TIME, - USE_SSL, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, PROMPT_PASSWORD, SPY_FRAME_IGNORE_TTH_SEARCHES, + USE_SSL, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, PROMPT_PASSWORD, SPY_FRAME_IGNORE_TTH_SEARCHES, + DONT_DL_ALREADY_QUEUED, INT_LAST }; enum Int64Setting { INT64_FIRST = INT_LAST + 1, Modified: dcplusplus/trunk/client/StringDefs.cpp =================================================================== --- dcplusplus/trunk/client/StringDefs.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/StringDefs.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -131,6 +131,7 @@ "File", "Files", "This file has no TTH", +"This file is already queued", "Subtract list", "File list refresh failed: ", "File list refresh finished", @@ -407,6 +408,7 @@ "Default away message", "Direct connection", "Directories", +"Don't download files already in the queue", "Don't download files already in share", "Default download directory", "Limits", @@ -740,6 +742,7 @@ "File", "Files", "FileHasNoTth", +"FileIsAlreadyQueued", "FileListDiff", "FileListRefreshFailed", "FileListRefreshFinished", @@ -1016,6 +1019,7 @@ "SettingsDefaultAwayMsg", "SettingsDirect", "SettingsDirectories", +"SettingsDontDlAlreadyQueued", "SettingsDontDlAlreadyShared", "SettingsDownloadDirectory", "SettingsDownloadLimits", Modified: dcplusplus/trunk/client/StringDefs.h =================================================================== --- dcplusplus/trunk/client/StringDefs.h 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/StringDefs.h 2006-06-17 22:24:01 UTC (rev 617) @@ -134,6 +134,7 @@ FILE, // "File" FILES, // "Files" FILE_HAS_NO_TTH, // "This file has no TTH" + FILE_IS_ALREADY_QUEUED, // "This file is already queued" FILE_LIST_DIFF, // "Subtract list" FILE_LIST_REFRESH_FAILED, // "File list refresh failed: " FILE_LIST_REFRESH_FINISHED, // "File list refresh finished" @@ -410,6 +411,7 @@ SETTINGS_DEFAULT_AWAY_MSG, // "Default away message" SETTINGS_DIRECT, // "Direct connection" SETTINGS_DIRECTORIES, // "Directories" + SETTINGS_DONT_DL_ALREADY_QUEUED, // "Don't download files already in the queue" SETTINGS_DONT_DL_ALREADY_SHARED, // "Don't download files already in share" SETTINGS_DOWNLOAD_DIRECTORY, // "Default download directory" SETTINGS_DOWNLOAD_LIMITS, // "Limits" Modified: dcplusplus/trunk/client/User.cpp =================================================================== --- dcplusplus/trunk/client/User.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/User.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -22,8 +22,9 @@ #include "User.h" #include "Client.h" #include "StringTokenizer.h" +#include "FavoriteUser.h" -OnlineUser::OnlineUser(const User::Ptr& ptr, Client& client_, u_int32_t sid_) : user(ptr), identity(ptr, client_.getHubUrl(), sid_), client(&client_) { +OnlineUser::OnlineUser(const User::Ptr& ptr, Client& client_, u_int32_t sid_) : identity(ptr, sid_), client(&client_) { } @@ -64,3 +65,8 @@ } return false; } + +void FavoriteUser::update(const OnlineUser& info) { + setNick(info.getIdentity().getNick()); + setUrl(info.getClient().getHubUrl()); +} Modified: dcplusplus/trunk/client/User.h =================================================================== --- dcplusplus/trunk/client/User.h 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/User.h 2006-06-17 22:24:01 UTC (rev 617) @@ -98,9 +98,9 @@ }; Identity() : sid(0) { } - Identity(const User::Ptr& ptr, const string& aHubUrl, u_int32_t aSID) : user(ptr), hubUrl(aHubUrl), sid(aSID) { } - Identity(const Identity& rhs) : ::Flags(rhs), user(rhs.user), hubUrl(rhs.hubUrl), sid(rhs.sid), info(rhs.info) { } - Identity& operator=(const Identity& rhs) { user = rhs.user; hubUrl = rhs.hubUrl; sid = rhs.sid; info = rhs.info; return *this; } + Identity(const User::Ptr& ptr, u_int32_t aSID) : user(ptr), sid(aSID) { } + Identity(const Identity& rhs) : ::Flags(rhs), user(rhs.user), sid(rhs.sid), info(rhs.info) { } + Identity& operator=(const Identity& rhs) { user = rhs.user; sid = rhs.sid; info = rhs.info; return *this; } #define GS(n, x) const string& get##n() const { return get(x); } void set##n(const string& v) { set(x, v); } GS(Nick, "NI") @@ -127,8 +127,10 @@ bool supports(const string& name) const; bool isHub() const { return !get("HU").empty(); } bool isOp() const { return !get("OP").empty(); } + bool isRegistered() const { return !get("RG").empty(); } bool isHidden() const { return !get("HI").empty(); } bool isBot() const { return !get("BO").empty(); } + bool isAway() const { return !get("AW").empty(); } bool isTcpActive() const { return !getIp().empty() || (user->isSet(User::NMDC) && !user->isSet(User::PASSIVE)); } bool isUdpActive() const { return !getIp().empty() && !getUdpPort().empty(); } @@ -151,12 +153,10 @@ void getParams(StringMap& map, const string& prefix, bool compatibility) const; User::Ptr& getUser() { return user; } GETSET(User::Ptr, user, User); - GETSET(string, hubUrl, HubUrl); GETSET(u_int32_t, sid, SID); private: typedef map<short, string> InfMap; typedef InfMap::iterator InfIter; - InfMap info; }; @@ -170,15 +170,15 @@ OnlineUser(const User::Ptr& ptr, Client& client_, u_int32_t sid_); - operator User::Ptr&() { return user; } - operator const User::Ptr&() const { return user; } + operator User::Ptr&() { return getUser(); } + operator const User::Ptr&() const { return getUser(); } - User::Ptr& getUser() { return user; } + User::Ptr& getUser() { return getIdentity().getUser(); } + const User::Ptr& getUser() const { return getIdentity().getUser(); } Identity& getIdentity() { return identity; } Client& getClient() { return *client; } const Client& getClient() const { return *client; } - GETSET(User::Ptr, user, User); GETSET(Identity, identity, Identity); private: friend class NmdcHub; Modified: dcplusplus/trunk/client/Util.cpp =================================================================== --- dcplusplus/trunk/client/Util.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/Util.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -173,67 +173,6 @@ #endif // _WIN32 } -string Util::validateMessage(string tmp, bool reverse, bool checkNewLines) { - string::size_type i = 0; - - if(reverse) { - while( (i = tmp.find("$", i)) != string::npos) { - tmp.replace(i, 5, "$"); - i++; - } - i = 0; - while( (i = tmp.find("|", i)) != string::npos) { - tmp.replace(i, 6, "|"); - i++; - } - i = 0; - while( (i = tmp.find("&", i)) != string::npos) { - tmp.replace(i, 5, "&"); - i++; - } - if(checkNewLines) { - // Check all '<' and '[' after newlines... - i = 0; - while( (i = tmp.find('\n', i)) != string::npos) { - if(i + 1 < tmp.length()) { - if(tmp[i+1] == '[' || tmp[i+1] == '<') { - tmp.insert(i+1, "- "); - i += 2; - } - } - i++; - } - } - } else { - i = 0; - while( (i = tmp.find("&", i)) != string::npos) { - tmp.replace(i, 1, "&"); - i += 4; - } - i = 0; - while( (i = tmp.find("$", i)) != string::npos) { - tmp.replace(i, 1, "&"); - i += 4; - } - i = 0; - while( (i = tmp.find("|", i)) != string::npos) { - tmp.replace(i, 1, "&"); - i += 4; - } - i = 0; - while( (i = tmp.find('$', i)) != string::npos) { - tmp.replace(i, 1, "$"); - i += 4; - } - i = 0; - while( (i = tmp.find('|', i)) != string::npos) { - tmp.replace(i, 1, "|"); - i += 5; - } - } - return tmp; -} - #ifdef _WIN32 static const char badChars[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, Modified: dcplusplus/trunk/client/Util.h =================================================================== --- dcplusplus/trunk/client/Util.h 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/client/Util.h 2006-06-17 22:24:01 UTC (rev 617) @@ -489,8 +489,6 @@ static int stricmp(const wstring& a, const wstring& b) { return stricmp(a.c_str(), b.c_str()); } static int strnicmp(const wstring& a, const wstring& b, size_t n) { return strnicmp(a.c_str(), b.c_str(), n); } - static string validateMessage(string tmp, bool reverse, bool checkNewLines = true); - static string getOsVersion(); static string getIpCountry (string IP); Modified: dcplusplus/trunk/windows/CommandDlg.cpp =================================================================== --- dcplusplus/trunk/windows/CommandDlg.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/windows/CommandDlg.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -84,7 +84,7 @@ dcassert(i != string::npos); tstring to = command.substr(5, i-5); string::size_type cmd_pos = command.find(_T('>'), 5) + 2; - tstring cmd = Text::toT(Util::validateMessage(Text::fromT(command.substr(cmd_pos, command.length()-cmd_pos-1)), true, false)); + tstring cmd = Text::toT(NmdcHub::validateMessage(Text::fromT(command.substr(cmd_pos, command.length()-cmd_pos-1)), true, false)); ctrlPM.SetCheck(BST_CHECKED); ctrlNick.SetWindowText(to.c_str()); ctrlCommand.SetWindowText(cmd.c_str()); @@ -94,7 +94,7 @@ { // Looks like a chat thing... string::size_type cmd_pos = command.find(_T('>')) + 2; - tstring cmd = Text::toT(Util::validateMessage(Text::fromT(command.substr(cmd_pos, command.length()-cmd_pos-1)), true, false)); + tstring cmd = Text::toT(NmdcHub::validateMessage(Text::fromT(command.substr(cmd_pos, command.length()-cmd_pos-1)), true, false)); ctrlChat.SetCheck(BST_CHECKED); ctrlCommand.SetWindowText(cmd.c_str()); } else { Modified: dcplusplus/trunk/windows/CommandDlg.h =================================================================== --- dcplusplus/trunk/windows/CommandDlg.h 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/windows/CommandDlg.h 2006-06-17 22:24:01 UTC (rev 617) @@ -103,12 +103,12 @@ command = buf; } else if(type == 2) { ctrlCommand.GetWindowText(buf, BUF_LEN - 1); - command = Text::toT("<%[myNI]> " + Util::validateMessage(Text::fromT(buf), false) + "|"); + command = Text::toT("<%[myNI]> " + NmdcHub::validateMessage(Text::fromT(buf), false) + "|"); } else if(type == 3) { ctrlNick.GetWindowText(buf, BUF_LEN - 1); tstring to(buf); ctrlCommand.GetWindowText(buf, BUF_LEN - 1); - command = _T("$To: ") + to + _T(" From: %[myNI] $<%[myNI]> ") + Text::toT(Util::validateMessage(Text::fromT(buf), false)) + _T("|"); + command = _T("$To: ") + to + _T(" From: %[myNI] $<%[myNI]> ") + Text::toT(NmdcHub::validateMessage(Text::fromT(buf), false)) + _T("|"); } } void updateControls() { Modified: dcplusplus/trunk/windows/HubFrame.cpp =================================================================== --- dcplusplus/trunk/windows/HubFrame.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/windows/HubFrame.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -960,10 +960,7 @@ } LRESULT HubFrame::onFileReconnect(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { - client->disconnect(false); - clearUserList(); - clearTaskList(); - client->connect(); + client->reconnect(); return 0; } @@ -1190,7 +1187,7 @@ } } -void HubFrame::on(TimerManagerListener::Second, DWORD /*aTick*/) throw() { +void HubFrame::on(Second, DWORD /*aTick*/) throw() { updateStatusBar(); if(updateUsers) { updateUsers = false; @@ -1245,7 +1242,12 @@ speak(GET_PASSWORD); } void HubFrame::on(HubUpdated, Client*) throw() { - speak(SET_WINDOW_TITLE, Util::validateMessage(client->getHubName() + " " + client->getHubDescription(), true, false) + " (" + client->getHubUrl() + ")"); + string hubName = client->getHubName(); + if(!client->getHubDescription().empty()) { + hubName += " - " + client->getHubDescription(); + } + hubName += " (" + client->getHubUrl() + ")"; + speak(SET_WINDOW_TITLE, hubName); } void HubFrame::on(Message, Client*, const OnlineUser& from, const string& msg) throw() { speak(ADD_CHAT_LINE, Util::toDOS("<" + from.getIdentity().getNick() + "> " + msg)); Modified: dcplusplus/trunk/windows/MainFrm.cpp =================================================================== --- dcplusplus/trunk/windows/MainFrm.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/windows/MainFrm.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -554,8 +554,8 @@ { PropertiesDlg dlg(m_hWnd, SettingsManager::getInstance()); - short lastPort = (short)SETTING(TCP_PORT); - short lastUDP = (short)SETTING(UDP_PORT); + unsigned short lastPort = (unsigned short)SETTING(TCP_PORT); + unsigned short lastUDP = (unsigned short)SETTING(UDP_PORT); int lastConn = SETTING(INCOMING_CONNECTIONS); if(dlg.DoModal(m_hWnd) == IDOK) Modified: dcplusplus/trunk/windows/QueuePage.cpp =================================================================== --- dcplusplus/trunk/windows/QueuePage.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/windows/QueuePage.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -78,6 +78,7 @@ { SettingsManager::ANTI_FRAG, ResourceManager::SETTINGS_ANTI_FRAG }, { SettingsManager::ADVANCED_RESUME, ResourceManager::SETTINGS_ADVANCED_RESUME }, { SettingsManager::ONLY_DL_TTH_FILES, ResourceManager::SETTINGS_ONLY_DL_TTH_FILES }, + { SettingsManager::DONT_DL_ALREADY_QUEUED, ResourceManager::SETTINGS_DONT_DL_ALREADY_QUEUED }, { 0, ResourceManager::SETTINGS_AUTO_AWAY } }; Modified: dcplusplus/trunk/windows/UPnP.cpp =================================================================== --- dcplusplus/trunk/windows/UPnP.cpp 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/windows/UPnP.cpp 2006-06-17 22:24:01 UTC (rev 617) @@ -24,7 +24,7 @@ #include <atlconv.h> #include "../client/Util.h" -UPnP::UPnP(const string theIPAddress, const string theProtocol, const string theDescription, const short thePort) { +UPnP::UPnP(const string theIPAddress, const string theProtocol, const string theDescription, const unsigned short thePort) { // need some messy string conversions in here // to convert STL::string to BSTR type strings // required for the UPnP code. Modified: dcplusplus/trunk/windows/UPnP.h =================================================================== --- dcplusplus/trunk/windows/UPnP.h 2006-06-17 15:40:35 UTC (rev 616) +++ dcplusplus/trunk/windows/UPnP.h 2006-06-17 22:24:01 UTC (rev 617) @@ -28,7 +28,7 @@ class UPnP { public: - UPnP( const string, const string, const string, const short ); + UPnP( const string, const string, const string, const unsigned short ); ~UPnP(); HRESULT OpenPorts(); HRESULT ClosePorts(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-06-17 15:41:25
|
Revision: 616 Author: arnetheduck Date: 2006-06-17 08:40:35 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=616&view=rev Log Message: ----------- Patches Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/ConnectionManager.cpp dcplusplus/trunk/client/ConnectionManager.h dcplusplus/trunk/client/HashManager.cpp dcplusplus/trunk/client/QueueManager.cpp dcplusplus/trunk/client/SearchManager.cpp dcplusplus/trunk/client/SearchManager.h dcplusplus/trunk/client/SettingsManager.cpp dcplusplus/trunk/client/SettingsManager.h dcplusplus/trunk/windows/ADLSProperties.cpp dcplusplus/trunk/windows/ADLSProperties.h dcplusplus/trunk/windows/HubFrame.cpp dcplusplus/trunk/windows/HubFrame.h dcplusplus/trunk/windows/SpyFrame.cpp dcplusplus/trunk/windows/SpyFrame.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-06-13 20:03:56 UTC (rev 615) +++ dcplusplus/trunk/changelog.txt 2006-06-17 15:40:35 UTC (rev 616) @@ -8,7 +8,14 @@ * [bug 944] Fixed unix string conversion bug (thanks tobias nygren) * [bug 945] Fixed unix mutex initialiser (thanks tobias nygren) * [bug 946] Tiger hash supports big endian and 64-bit architectures (thanks tobias nygren) +* [bug 941] Updated usercount display (thanks pothead) +* [bug 951] Fixed issue with high port numbers (thanks tpo) +* [bug 958] Search spy tth option automagically saved (thanks ullner) +* [bug 959] Code cleanup (thanks pothead) +* [bug 966] Max hash speed fixed when fast hashing method is not used (thanks steven sheehy) +* [bug 967] Fixed path case-sensitivity issue (thanks steven sheehy) + -- 0.691 2006-06-03 -- * Links to bugzilla in html changelog * [bug 122] Added userlist filter (thanks trem) Modified: dcplusplus/trunk/client/ConnectionManager.cpp =================================================================== --- dcplusplus/trunk/client/ConnectionManager.cpp 2006-06-13 20:03:56 UTC (rev 615) +++ dcplusplus/trunk/client/ConnectionManager.cpp 2006-06-17 15:40:35 UTC (rev 616) @@ -43,12 +43,12 @@ } // @todo clean this up void ConnectionManager::listen() throw(Exception){ - short lastPort = (short)SETTING(TCP_PORT); + unsigned short lastPort = (unsigned short)SETTING(TCP_PORT); if(lastPort == 0) - lastPort = (short)Util::rand(1025, 32000); + lastPort = (unsigned short)Util::rand(1025, 32000); - short firstPort = lastPort; + unsigned short firstPort = lastPort; disconnect(); Modified: dcplusplus/trunk/client/ConnectionManager.h =================================================================== --- dcplusplus/trunk/client/ConnectionManager.h 2006-06-13 20:03:56 UTC (rev 615) +++ dcplusplus/trunk/client/ConnectionManager.h 2006-06-17 15:40:35 UTC (rev 616) @@ -138,8 +138,8 @@ friend class Server; CriticalSection cs; - short port; - short securePort; + unsigned short port; + unsigned short securePort; /** All ConnectionQueueItems */ ConnectionQueueItem::List downloads; Modified: dcplusplus/trunk/client/HashManager.cpp =================================================================== --- dcplusplus/trunk/client/HashManager.cpp 2006-06-13 20:03:56 UTC (rev 615) +++ dcplusplus/trunk/client/HashManager.cpp 2006-06-17 15:40:35 UTC (rev 616) @@ -624,6 +624,9 @@ if(lastRead + minTime > now) { Thread::sleep(minTime - (now - lastRead)); } + lastRead = lastRead + minTime; + } else { + lastRead = GET_TICK(); } n = f.read(buf, bufSize); tth->update(buf, n); Modified: dcplusplus/trunk/client/QueueManager.cpp =================================================================== --- dcplusplus/trunk/client/QueueManager.cpp 2006-06-13 20:03:56 UTC (rev 615) +++ dcplusplus/trunk/client/QueueManager.cpp 2006-06-17 15:40:35 UTC (rev 616) @@ -37,12 +37,6 @@ #include <limits> -#ifdef _WIN32 -#define FILELISTS_DIR "FileLists\\" -#else -#define FILELISTS_DIR "filelists/" -#endif - #ifdef ff #undef ff #endif @@ -330,7 +324,7 @@ SearchManager::getInstance()->addListener(this); ClientManager::getInstance()->addListener(this); - File::ensureDirectory(Util::getConfigPath() + FILELISTS_DIR); + File::ensureDirectory(Util::getListPath()); } QueueManager::~QueueManager() throw() { @@ -341,7 +335,7 @@ saveQueue(); if(!BOOLSETTING(KEEP_LISTS)) { - string path = Util::getConfigPath() + FILELISTS_DIR; + string path = Util::getListPath(); #ifdef _WIN32 WIN32_FIND_DATA data; @@ -420,7 +414,7 @@ } void QueueManager::addList(const User::Ptr& aUser, int aFlags) throw(QueueException, FileException) { - string target = Util::getConfigPath() + FILELISTS_DIR + Util::validateFileName(aUser->getFirstNick()) + "." + aUser->getCID().toBase32(); + string target = Util::getListPath() + Util::validateFileName(aUser->getFirstNick()) + "." + aUser->getCID().toBase32(); add(target, -1, NULL, aUser, USER_LIST_NAME, true, QueueItem::FLAG_USER_LIST | aFlags); } Modified: dcplusplus/trunk/client/SearchManager.cpp =================================================================== --- dcplusplus/trunk/client/SearchManager.cpp 2006-06-13 20:03:56 UTC (rev 615) +++ dcplusplus/trunk/client/SearchManager.cpp 2006-06-17 15:40:35 UTC (rev 616) @@ -103,12 +103,12 @@ } void SearchManager::listen() throw(Exception) { - short lastPort = (short)SETTING(UDP_PORT); + unsigned short lastPort = (unsigned short)SETTING(UDP_PORT); if(lastPort == 0) - lastPort = (short)Util::rand(1025, 32000); + lastPort = (unsigned short)Util::rand(1025, 32000); - short firstPort = lastPort; + unsigned short firstPort = lastPort; disconnect(); Modified: dcplusplus/trunk/client/SearchManager.h =================================================================== --- dcplusplus/trunk/client/SearchManager.h 2006-06-13 20:03:56 UTC (rev 615) +++ dcplusplus/trunk/client/SearchManager.h 2006-06-17 15:40:35 UTC (rev 616) @@ -143,7 +143,7 @@ void respond(const AdcCommand& cmd, const CID& cid); - short getPort() + unsigned short getPort() { return port; } @@ -167,7 +167,7 @@ private: Socket* socket; - short port; + unsigned short port; bool stop; u_int32_t lastSearch; friend class Singleton<SearchManager>; Modified: dcplusplus/trunk/client/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/client/SettingsManager.cpp 2006-06-13 20:03:56 UTC (rev 615) +++ dcplusplus/trunk/client/SettingsManager.cpp 2006-06-17 15:40:35 UTC (rev 616) @@ -73,7 +73,7 @@ "NoIpOverride", "SearchOnlyFreeSlots", "LastSearchType", "BoldFinishedDownloads", "BoldFinishedUploads", "BoldQueue", "BoldHub", "BoldPm", "BoldSearch", "SocketInBuffer", "SocketOutBuffer", "OnlyDlTthFiles", "OpenWaitingUsers", "BoldWaitingUsers", "OpenSystemLog", "BoldSystemLog", "AutoRefreshTime", - "UseSsl", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", "PromptPassword", + "UseSsl", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", "PromptPassword", "SpyFrameIgnoreTthSearches", "SENTRY", // Int64 "TotalUpload", "TotalDownload", @@ -257,6 +257,7 @@ setDefault(ALT_SORT_ORDER, false); setDefault(AUTO_KICK_NO_FAVS, false); setDefault(PROMPT_PASSWORD, false); + setDefault(SPY_FRAME_IGNORE_TTH_SEARCHES, false); #ifdef _WIN32 setDefault(MAIN_WINDOW_STATE, SW_SHOWNORMAL); Modified: dcplusplus/trunk/client/SettingsManager.h =================================================================== --- dcplusplus/trunk/client/SettingsManager.h 2006-06-13 20:03:56 UTC (rev 615) +++ dcplusplus/trunk/client/SettingsManager.h 2006-06-17 15:40:35 UTC (rev 616) @@ -89,7 +89,7 @@ NO_IP_OVERRIDE, SEARCH_ONLY_FREE_SLOTS, LAST_SEARCH_TYPE, BOLD_FINISHED_DOWNLOADS, BOLD_FINISHED_UPLOADS, BOLD_QUEUE, BOLD_HUB, BOLD_PM, BOLD_SEARCH, SOCKET_IN_BUFFER, SOCKET_OUT_BUFFER, ONLY_DL_TTH_FILES, OPEN_WAITING_USERS, BOLD_WAITING_USERS, OPEN_SYSTEM_LOG, BOLD_SYSTEM_LOG, AUTO_REFRESH_TIME, - USE_SSL, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, PROMPT_PASSWORD, + USE_SSL, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, PROMPT_PASSWORD, SPY_FRAME_IGNORE_TTH_SEARCHES, INT_LAST }; enum Int64Setting { INT64_FIRST = INT_LAST + 1, Modified: dcplusplus/trunk/windows/ADLSProperties.cpp =================================================================== --- dcplusplus/trunk/windows/ADLSProperties.cpp 2006-06-13 20:03:56 UTC (rev 615) +++ dcplusplus/trunk/windows/ADLSProperties.cpp 2006-06-17 15:40:35 UTC (rev 616) @@ -26,8 +26,7 @@ #include "WinUtil.h" // Initialize dialog -LRESULT ADLSProperties::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&) -{ +LRESULT ADLSProperties::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&) { // Translate the texts SetWindowText(CTSTRING(ADLS_PROPERTIES)); SetDlgItemText(IDC_ADLSP_SEARCH, CTSTRING(ADLS_SEARCH_STRING)); @@ -39,32 +38,34 @@ SetDlgItemText(IDC_IS_ACTIVE, CTSTRING(ADLS_ENABLED)); SetDlgItemText(IDC_AUTOQUEUE, CTSTRING(ADLS_DOWNLOAD)); - // Initialize combo boxes - ::SendMessage(GetDlgItem(IDC_SOURCE_TYPE), CB_ADDSTRING, 0, - (LPARAM)search->SourceTypeToDisplayString(ADLSearch::OnlyFile).c_str()); - ::SendMessage(GetDlgItem(IDC_SOURCE_TYPE), CB_ADDSTRING, 0, - (LPARAM)search->SourceTypeToDisplayString(ADLSearch::OnlyDirectory).c_str()); - ::SendMessage(GetDlgItem(IDC_SOURCE_TYPE), CB_ADDSTRING, 0, - (LPARAM)search->SourceTypeToDisplayString(ADLSearch::FullPath).c_str()); + // Initialize dialog items + ctrlSearch.Attach(GetDlgItem(IDC_SEARCH_STRING)); + ctrlDestDir.Attach(GetDlgItem(IDC_DEST_DIR)); + ctrlMinSize.Attach(GetDlgItem(IDC_MIN_FILE_SIZE)); + ctrlMaxSize.Attach(GetDlgItem(IDC_MAX_FILE_SIZE)); + ctrlActive.Attach(GetDlgItem(IDC_IS_ACTIVE)); + ctrlAutoQueue.Attach(GetDlgItem(IDC_AUTOQUEUE)); - ::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_ADDSTRING, 0, - (LPARAM)search->SizeTypeToDisplayString(ADLSearch::SizeBytes).c_str()); - ::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_ADDSTRING, 0, - (LPARAM)search->SizeTypeToDisplayString(ADLSearch::SizeKibiBytes).c_str()); - ::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_ADDSTRING, 0, - (LPARAM)search->SizeTypeToDisplayString(ADLSearch::SizeMebiBytes).c_str()); - ::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_ADDSTRING, 0, - (LPARAM)search->SizeTypeToDisplayString(ADLSearch::SizeGibiBytes).c_str()); + ctrlSearchType.Attach(GetDlgItem(IDC_SOURCE_TYPE)); + ctrlSearchType.AddString(CTSTRING(FILENAME)); + ctrlSearchType.AddString(CTSTRING(DIRECTORY)); + ctrlSearchType.AddString(CTSTRING(ADLS_FULL_PATH)); + ctrlSizeType.Attach(GetDlgItem(IDC_SIZE_TYPE)); + ctrlSizeType.AddString(CTSTRING(B)); + ctrlSizeType.AddString(CTSTRING(KiB)); + ctrlSizeType.AddString(CTSTRING(MiB)); + ctrlSizeType.AddString(CTSTRING(GiB)); + // Load search data - SetDlgItemText(IDC_SEARCH_STRING, Text::toT(search->searchString).c_str()); - SetDlgItemText(IDC_DEST_DIR, Text::toT(search->destDir).c_str()); - SetDlgItemText(IDC_MIN_FILE_SIZE, Text::toT(search->minFileSize > 0 ? Util::toString(search->minFileSize) : "").c_str()); - SetDlgItemText(IDC_MAX_FILE_SIZE, Text::toT(search->maxFileSize > 0 ? Util::toString(search->maxFileSize) : "").c_str()); - ::SendMessage(GetDlgItem(IDC_IS_ACTIVE), BM_SETCHECK, search->isActive ? 1 : 0, 0L); - ::SendMessage(GetDlgItem(IDC_SOURCE_TYPE), CB_SETCURSEL, search->sourceType, 0L); - ::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_SETCURSEL, search->typeFileSize, 0L); - ::SendMessage(GetDlgItem(IDC_AUTOQUEUE), BM_SETCHECK, search->isAutoQueue ? 1 : 0, 0L); + ctrlSearch.SetWindowText(Text::toT(search->searchString).c_str()); + ctrlDestDir.SetWindowText(Text::toT(search->destDir).c_str()); + ctrlMinSize.SetWindowText(Text::toT(search->minFileSize > 0 ? Util::toString(search->minFileSize) : "").c_str()); + ctrlMaxSize.SetWindowText(Text::toT(search->maxFileSize > 0 ? Util::toString(search->maxFileSize) : "").c_str()); + ctrlActive.SetCheck(search->isActive ? 1 : 0); + ctrlAutoQueue.SetCheck(search->isAutoQueue ? 1 : 0); + ctrlSearchType.SetCurSel(search->sourceType); + ctrlSizeType.SetCurSel(search->typeFileSize); // Center dialog CenterWindow(GetParent()); @@ -75,25 +76,25 @@ // Exit dialog LRESULT ADLSProperties::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { - if(wID == IDOK) - { + if(wID == IDOK) { // Update search TCHAR buf[256]; - GetDlgItemText(IDC_SEARCH_STRING, buf, 256); + ctrlSearch.GetWindowText(buf, 256); search->searchString = Text::fromT(buf); - GetDlgItemText(IDC_DEST_DIR, buf, 256); + ctrlDestDir.GetWindowText(buf, 256); search->destDir = Text::fromT(buf); - GetDlgItemText(IDC_MIN_FILE_SIZE, buf, 256); + ctrlMinSize.GetWindowText(buf, 256); search->minFileSize = (_tcslen(buf) == 0 ? -1 : Util::toInt64(Text::fromT(buf))); - GetDlgItemText(IDC_MAX_FILE_SIZE, buf, 256); + ctrlMaxSize.GetWindowText(buf, 256); search->maxFileSize = (_tcslen(buf) == 0 ? -1 : Util::toInt64(Text::fromT(buf))); - search->sourceType = (ADLSearch::SourceType)::SendMessage(GetDlgItem(IDC_SOURCE_TYPE), CB_GETCURSEL, 0, 0L); - search->typeFileSize = (ADLSearch::SizeType)::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_GETCURSEL, 0, 0L); - search->isActive = (::SendMessage(GetDlgItem(IDC_IS_ACTIVE), BM_GETCHECK, 0, 0L) != 0); - search->isAutoQueue = (::SendMessage(GetDlgItem(IDC_AUTOQUEUE), BM_GETCHECK, 0, 0L) != 0); + search->isActive = (ctrlActive.GetCheck() == 1); + search->isAutoQueue = (ctrlAutoQueue.GetCheck() == 1); + + search->sourceType = (ADLSearch::SourceType)ctrlSearchType.GetCurSel(); + search->typeFileSize = (ADLSearch::SizeType)ctrlSizeType.GetCurSel(); } EndDialog(wID); Modified: dcplusplus/trunk/windows/ADLSProperties.h =================================================================== --- dcplusplus/trunk/windows/ADLSProperties.h 2006-06-13 20:03:56 UTC (rev 615) +++ dcplusplus/trunk/windows/ADLSProperties.h 2006-06-17 15:40:35 UTC (rev 616) @@ -56,6 +56,15 @@ // Current search ADLSearch* search; + + CEdit ctrlSearch; + CEdit ctrlDestDir; + CEdit ctrlMinSize; + CEdit ctrlMaxSize; + CButton ctrlActive; + CButton ctrlAutoQueue; + CComboBox ctrlSearchType; + CComboBox ctrlSizeType; }; #endif // !defined(ADLS_PROPERTIES_H) Modified: dcplusplus/trunk/windows/HubFrame.cpp =================================================================== --- dcplusplus/trunk/windows/HubFrame.cpp 2006-06-13 20:03:56 UTC (rev 615) +++ dcplusplus/trunk/windows/HubFrame.cpp 2006-06-17 15:40:35 UTC (rev 616) @@ -357,7 +357,7 @@ string nicks; while( (i = ctrlUsers.GetNextItem(i, LVNI_SELECTED)) != -1) { - nicks += (ctrlUsers.getItemData(i))->getIdentity().getNick(); + nicks += ctrlUsers.getItemData(i)->getNick(); nicks += ' '; } if(!nicks.empty()) { @@ -382,7 +382,7 @@ if(i == userMap.end()) { UserInfo* ui = new UserInfo(u); userMap.insert(make_pair(u.user, ui)); - if(!ui->getIdentity().isHidden() && showUsers) + if(!ui->isHidden() && showUsers) ctrlUsers.insertItem(ui, getImage(u.identity)); if(!filter.empty()) @@ -391,7 +391,7 @@ return true; } else { UserInfo* ui = i->second; - if(!ui->getIdentity().isHidden() && u.identity.isHidden() && showUsers) { + if(!ui->isHidden() && u.identity.isHidden() && showUsers) { ctrlUsers.deleteItem(ui); } @@ -419,7 +419,7 @@ } UserInfo* ui = i->second; - if(!ui->getIdentity().isHidden() && showUsers) + if(!ui->isHidden() && showUsers) ctrlUsers.deleteItem(ui); userMap.erase(i); @@ -500,8 +500,7 @@ } else if(task->speaker == SET_WINDOW_TITLE) { SetWindowText(static_cast<StringTask*>(task)->msg.c_str()); } else if(task->speaker == STATS) { - ctrlStatus.SetText(1, Text::toT(Util::toString(showUsers ? ctrlUsers.GetItemCount() : getUserCount()) + - "/" + Util::toString(getUserCount()) + " " + STRING(HUB_USERS)).c_str()); + ctrlStatus.SetText(1, Text::toT(getUsersTextForStatusBar()).c_str()); ctrlStatus.SetText(2, Text::toT(Util::formatBytes(getAvailable())).c_str()); } else if(task->speaker == GET_PASSWORD) { if(client->getPassword().size() > 0) { @@ -1090,7 +1089,7 @@ for(UserMapIter i = userMap.begin(); i != userMap.end(); ++i) { UserInfo* ui = i->second; - if(!ui->getIdentity().isHidden()) + if(!ui->isHidden()) ctrlUsers.insertItem(ui, getImage(ui->getIdentity())); } @@ -1308,8 +1307,8 @@ } bool HubFrame::parseFilter(FilterModes& mode, int64_t& size) { - tstring::size_type start = tstring::npos; - tstring::size_type end = tstring::npos; + tstring::size_type start = static_cast<tstring::size_type>(tstring::npos); + tstring::size_type end = static_cast<tstring::size_type>(tstring::npos); int64_t multiplier = 1; if(filter.compare(0, 2, _T(">=")) == 0) { @@ -1360,7 +1359,6 @@ multiplier = 1; } - if(end == tstring::npos) { end = filter.length(); } @@ -1383,6 +1381,9 @@ //avoid refreshing the whole list and just update the current item //instead if(ui != NULL) { + if(ui->isHidden()) { + return; + } if(filter.empty()) { if(ctrlUsers.findItem(ui) == -1) { ctrlUsers.insertItem(ui, getImage(ui->getIdentity())); @@ -1404,15 +1405,14 @@ if(filter.empty()) { for(UserMapIter i = userMap.begin(); i != userMap.end(); ++i){ - if(i->second != NULL) + UserInfo* ui = i->second; + if(!ui->isHidden()) ctrlUsers.insertItem(i->second, getImage(i->second->getIdentity())); } } else { for(UserMapIter i = userMap.begin(); i != userMap.end(); ++i){ - if( i->second != NULL ) { - if(matchFilter(*i->second, sel, doSizeCompare, mode, size)) { - ctrlUsers.insertItem(i->second, getImage(i->second->getIdentity())); - } + if(!ui->isHidden() && matchFilter(*i->second, sel, doSizeCompare, mode, size)) { + ctrlUsers.insertItem(i->second, getImage(i->second->getIdentity())); } } } @@ -1482,3 +1482,18 @@ return insert; } +string HubFrame::getUsersTextForStatusBar() const { + size_t userCount = 0; + for(UserMap::const_iterator i = userMap.begin(); i != userMap.end(); ++i){ + UserInfo* ui = i->second; + if(!ui->isHidden()) + userCount++; + } + + string textForUsers; + if (ctrlUsers.GetSelectedCount() > 1) + textForUsers += Util::toString(ctrlUsers.GetSelectedCount()) + "/"; + if (showUsers && (size_t)ctrlUsers.GetItemCount() < userCount) + textForUsers += Util::toString(ctrlUsers.GetItemCount()) + "/"; + return textForUsers + Util::toString(userCount) + " " + STRING(HUB_USERS); +} Modified: dcplusplus/trunk/windows/HubFrame.h =================================================================== --- dcplusplus/trunk/windows/HubFrame.h 2006-06-13 20:03:56 UTC (rev 615) +++ dcplusplus/trunk/windows/HubFrame.h 2006-06-17 15:40:35 UTC (rev 616) @@ -240,6 +240,9 @@ bool update(const Identity& identity, int sortCol); + const string& getNick() const { return identity.getNick(); } + bool isHidden() const { return identity.isHidden(); } + tstring columns[COLUMN_LAST]; GETSET(Identity, identity, Identity); }; @@ -302,10 +305,7 @@ } }; - size_t getUserCount() const { - size_t sel = ctrlUsers.GetSelectedCount(); - return sel > 1 ? sel : userMap.size(); - } + string getUsersTextForStatusBar() const; int64_t getAvailable() { if (ctrlUsers.GetSelectedCount() > 1) { Modified: dcplusplus/trunk/windows/SpyFrame.cpp =================================================================== --- dcplusplus/trunk/windows/SpyFrame.cpp 2006-06-13 20:03:56 UTC (rev 615) +++ dcplusplus/trunk/windows/SpyFrame.cpp 2006-06-17 15:40:35 UTC (rev 616) @@ -46,7 +46,7 @@ ctrlIgnoreTth.Create(ctrlStatus.m_hWnd, rcDefault, CTSTRING(IGNORE_TTH_SEARCHES), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); ctrlIgnoreTth.SetButtonStyle(BS_AUTOCHECKBOX, false); ctrlIgnoreTth.SetFont(WinUtil::systemFont); - ctrlIgnoreTth.SetCheck(false); + ctrlIgnoreTth.SetCheck(ignoreTth); ignoreTthContainer.SubclassWindow(ctrlIgnoreTth.m_hWnd); WinUtil::splitTokens(columnIndexes, SETTING(SPYFRAME_ORDER), COLUMN_LAST); @@ -75,6 +75,8 @@ return 0; } else { WinUtil::saveHeaderOrder(ctrlSearches, SettingsManager::SPYFRAME_ORDER, SettingsManager::SPYFRAME_WIDTHS, COLUMN_LAST, columnIndexes, columnSizes); + if (ignoreTth != BOOLSETTING(SPY_FRAME_IGNORE_TTH_SEARCHES)) + SettingsManager::getInstance()->set(SettingsManager::SPY_FRAME_IGNORE_TTH_SEARCHES, ignoreTth); bHandled = FALSE; return 0; Modified: dcplusplus/trunk/windows/SpyFrame.h =================================================================== --- dcplusplus/trunk/windows/SpyFrame.h 2006-06-13 20:03:56 UTC (rev 615) +++ dcplusplus/trunk/windows/SpyFrame.h 2006-06-17 15:40:35 UTC (rev 616) @@ -35,7 +35,7 @@ private ClientManagerListener, private TimerManagerListener { public: - SpyFrame() : total(0), cur(0), closed(false), ignoreTth(false), ignoreTthContainer(WC_BUTTON, this, IGNORETTH_MESSAGE_MAP) { + SpyFrame() : total(0), cur(0), closed(false), ignoreTth(BOOLSETTING(SPY_FRAME_IGNORE_TTH_SEARCHES)), ignoreTthContainer(WC_BUTTON, this, IGNORETTH_MESSAGE_MAP) { ZeroMemory(perSecond, sizeof(perSecond)); ClientManager::getInstance()->addListener(this); TimerManager::getInstance()->addListener(this); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-06-13 20:04:19
|
Revision: 615 Author: arnetheduck Date: 2006-06-13 13:03:56 -0700 (Tue, 13 Jun 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=615&view=rev Log Message: ----------- Tiger patch Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/TigerHash.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-06-10 09:48:17 UTC (rev 614) +++ dcplusplus/trunk/changelog.txt 2006-06-13 20:03:56 UTC (rev 615) @@ -7,8 +7,8 @@ * [bug 943] Fixed unix utsname compile issue (thanks tobias nygren) * [bug 944] Fixed unix string conversion bug (thanks tobias nygren) * [bug 945] Fixed unix mutex initialiser (thanks tobias nygren) +* [bug 946] Tiger hash supports big endian and 64-bit architectures (thanks tobias nygren) - -- 0.691 2006-06-03 -- * Links to bugzilla in html changelog * [bug 122] Added userlist filter (thanks trem) Modified: dcplusplus/trunk/client/TigerHash.cpp =================================================================== --- dcplusplus/trunk/client/TigerHash.cpp 2006-06-10 09:48:17 UTC (rev 614) +++ dcplusplus/trunk/client/TigerHash.cpp 2006-06-13 20:03:56 UTC (rev 615) @@ -21,6 +21,22 @@ #include "TigerHash.h" +#ifdef _WIN32 +#if defined(_M_X64) +#define TIGER_ARCH64 +#endif +#if !(defined(_M_IX86) || defined(_M_X64)) +#define TIGER_BIG_ENDIAN +#endif +#else // _WIN32 +#if defined(__x86_64__) || defined(__alpha) +#define TIGER_ARCH64 +#endif +#if !(defined(__i386__) || defined(__x86_64__) || defined(__alpha)) +#define TIGER_BIG_ENDIAN +#endif +#endif // _WIN32 + #define PASSES 3 #define t1 (table) @@ -33,8 +49,17 @@ bb = b; \ cc = c; +#ifdef TIGER_ARCH64 #define round(a,b,c,x,mul) \ c ^= x; \ + a -= t1[((c)>>(0*8))&0xFF] ^ t2[((c)>>(2*8))&0xFF] ^ \ + t3[((c)>>(4*8))&0xFF] ^ t4[((c)>>(6*8))&0xFF] ; \ + b += t4[((c)>>(1*8))&0xFF] ^ t3[((c)>>(3*8))&0xFF] ^ \ + t2[((c)>>(5*8))&0xFF] ^ t1[((c)>>(7*8))&0xFF] ; \ + b *= mul; +#else +#define round(a,b,c,x,mul) \ + c ^= x; \ a -= t1[(u_int8_t)(c)] ^ \ t2[(u_int8_t)(((u_int32_t)(c))>>(2*8))] ^ \ t3[(u_int8_t)((c)>>(4*8))] ^ \ @@ -44,6 +69,7 @@ t2[(u_int8_t)(((u_int32_t)((c)>>(4*8)))>>(1*8))] ^ \ t1[(u_int8_t)(((u_int32_t)((c)>>(4*8)))>>(3*8))]; \ b *= mul; +#endif #define pass(a,b,c,mul) \ round(a,b,c,x0,mul) \ @@ -78,13 +104,28 @@ b -= bb; \ c += cc; +#ifdef TIGER_ARCH64 #define compress \ save_abc \ + pass(a,b,c,5) \ + key_schedule \ + pass(c,a,b,7) \ + key_schedule \ + pass(b,c,a,9) \ + for(pass_no=3; pass_no<PASSES; pass_no++) { \ + key_schedule \ + pass(a,b,c,9) \ + tmpa=a; a=c; c=b; b=tmpa;} \ + feedforward +#else +#define compress \ + save_abc \ for(pass_no=0; pass_no<PASSES; pass_no++) { \ if(pass_no != 0) {key_schedule} \ pass(a,b,c,(pass_no==0?5:pass_no==1?7:9)); \ tmpa=a; a=c; c=b; b=tmpa;} \ feedforward +#endif #define tiger_compress_macro(str, state) \ { \ @@ -114,6 +155,10 @@ void TigerHash::update(const void* data, size_t length) { size_t tmppos = (u_int32_t)(pos & BLOCK_SIZE-1); +#ifdef TIGER_BIG_ENDIAN + u_int8_t buf[BLOCK_SIZE]; + int j; +#endif const u_int8_t* str = (const u_int8_t*)data; // First empty tmp buffer if possible if(tmppos > 0) { @@ -124,7 +169,13 @@ length -= n; if((tmppos + n) == BLOCK_SIZE) { - tigerCompress((u_int64_t*)tmp, res); +#ifdef TIGER_BIG_ENDIAN + for(j=0; j<BLOCK_SIZE; j++) + buf[j^7]=((u_int8_t*)tmp)[j]; + tiger_compress_macro(((u_int64_t*)buf), res); +#else + tiger_compress_macro(((u_int64_t*)tmp), res); +#endif tmppos = 0; } } @@ -134,7 +185,13 @@ // Process the bulk of data while(length>=BLOCK_SIZE) { - tigerCompress((u_int64_t*)str, res); +#ifdef TIGER_BIG_ENDIAN + for(j=0; j<BLOCK_SIZE; j++) + buf[j^7]=((u_int8_t*)str)[j]; + tiger_compress_macro(((u_int64_t*)buf), res); +#else + tiger_compress_macro(((u_int64_t*)str), res); +#endif str += BLOCK_SIZE; pos += BLOCK_SIZE; length -= BLOCK_SIZE; @@ -147,6 +204,10 @@ u_int8_t* TigerHash::finalize() { size_t tmppos = (size_t)(pos & BLOCK_SIZE-1); +#ifdef TIGER_BIG_ENDIAN + u_int8_t buf[BLOCK_SIZE]; + int j; +#endif // Tmp buffer always has at least one pos, otherwise it would have // been processed in update() @@ -154,14 +215,30 @@ if(tmppos > (BLOCK_SIZE - sizeof(u_int64_t))) { memset(tmp + tmppos, 0, BLOCK_SIZE - tmppos); - tigerCompress(((u_int64_t*)tmp), res); +#ifdef TIGER_BIG_ENDIAN + for(j=0; j<BLOCK_SIZE; j++) + buf[j^7]=((u_int8_t*)tmp)[j]; + tiger_compress_macro(((u_int64_t*)buf), res); +#else + tiger_compress_macro(((u_int64_t*)tmp), res); +#endif memset(tmp, 0, BLOCK_SIZE); } else { memset(tmp + tmppos, 0, BLOCK_SIZE - tmppos - sizeof(u_int64_t)); +#ifdef TIGER_BIG_ENDIAN + for(j=0; j<BLOCK_SIZE; j++) + buf[j^7]=((u_int8_t*)tmp)[j]; + memcpy(tmp, buf, BLOCK_SIZE); +#endif } ((u_int64_t*)(&(tmp[56])))[0] = pos<<3; - tigerCompress((u_int64_t*)tmp, res); + tiger_compress_macro(((u_int64_t*)tmp), res); +#ifdef TIGER_BIG_ENDIAN + for(j=0; j<HASH_SIZE; j++) + buf[j^7]=((u_int8_t*)res)[j]; + memcpy(res, buf, HASH_SIZE); +#endif return getResult(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-06-10 09:48:53
|
Revision: 614 Author: arnetheduck Date: 2006-06-10 02:48:17 -0700 (Sat, 10 Jun 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=614&view=rev Log Message: ----------- patches Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/AdcHub.cpp dcplusplus/trunk/client/ClientManager.cpp dcplusplus/trunk/client/CriticalSection.h dcplusplus/trunk/client/HashManager.cpp dcplusplus/trunk/client/Text.cpp dcplusplus/trunk/client/Thread.cpp dcplusplus/trunk/client/Thread.h dcplusplus/trunk/client/Util.cpp dcplusplus/trunk/windows/AboutDlg.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/changelog.txt 2006-06-10 09:48:17 UTC (rev 614) @@ -1,4 +1,15 @@ --- 0.691 2006-06-03 -- +-- 0.692 -- +* [bug 927] Fixed OP detection bug really (thanks pothead) +* [bug 938] Added a few more ADC info fields (thanks ullner) +* [bug 939] Fixed hub info update (thanks ullner) +* [bug 940] Fixed a 64-bit compile error (thanks steven sheehy) +* [bug 942] Fixed atomic operations on unices (thanks tobias nygren) +* [bug 943] Fixed unix utsname compile issue (thanks tobias nygren) +* [bug 944] Fixed unix string conversion bug (thanks tobias nygren) +* [bug 945] Fixed unix mutex initialiser (thanks tobias nygren) + + +-- 0.691 2006-06-03 -- * Links to bugzilla in html changelog * [bug 122] Added userlist filter (thanks trem) * [bug 578] Added search for alternates to transfers menu (thanks trem) Modified: dcplusplus/trunk/client/AdcHub.cpp =================================================================== --- dcplusplus/trunk/client/AdcHub.cpp 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/client/AdcHub.cpp 2006-06-10 09:48:17 UTC (rev 614) @@ -133,17 +133,18 @@ u->getUser()->setFlag(User::SSL); } - if(u->getIdentity().isHub()) { - setHubIdentity(u->getIdentity()); - fire(ClientListener::HubUpdated(), this); - } - if(u->getUser() == ClientManager::getInstance()->getMe()) { state = STATE_NORMAL; setMyIdentity(u->getIdentity()); updateCounts(false); } - fire(ClientListener::UserUpdated(), this, *u); + + if(u->getIdentity().isHub()) { + setHubIdentity(u->getIdentity()); + fire(ClientListener::HubUpdated(), this); + } else { + fire(ClientListener::UserUpdated(), this, *u); + } } void AdcHub::handle(AdcCommand::SUP, AdcCommand& c) throw() { @@ -462,7 +463,20 @@ ADDPARAM("HR", Util::toString(counts.registered)); ADDPARAM("HO", Util::toString(counts.op)); ADDPARAM("VE", "++ " VERSIONSTRING); + ADDPARAM("US", Util::toString((long)(Util::toDouble(SETTING(UPLOAD_SPEED))*1024*1024))); + if(SETTING(MAX_DOWNLOAD_SPEED) > 0) { + ADDPARAM("DS", Util::toString((SETTING(MAX_DOWNLOAD_SPEED)*1024*8))); + } else { + ADDPARAM("DS", Util::emptyString); + } + + if(Util::getAway()){ + ADDPARAM("AW", '1'); + } else { + ADDPARAM("AW", Util::emptyString); + } + string su; if(SSLSocketFactory::getInstance()->hasCerts()) { su += ADCS_FEATURE + ","; Modified: dcplusplus/trunk/client/ClientManager.cpp =================================================================== --- dcplusplus/trunk/client/ClientManager.cpp 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/client/ClientManager.cpp 2006-06-10 09:48:17 UTC (rev 614) @@ -238,7 +238,7 @@ pair<OnlineIter, OnlineIter> p = onlineUsers.equal_range(user->getCID()); for(OnlineIter i = p.first; i != p.second; ++i) { if(i->second->getClient().getHubUrl() == aHubUrl) { - return i->second->getClient().getMyIdentity().isOp(); + return i->second->getIdentity().isOp(); } } return false; Modified: dcplusplus/trunk/client/CriticalSection.h =================================================================== --- dcplusplus/trunk/client/CriticalSection.h 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/client/CriticalSection.h 2006-06-10 09:48:17 UTC (rev 614) @@ -51,19 +51,20 @@ #else public: CriticalSection() throw() { -#if HAVE_DECL_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP - static pthread_mutex_t recmtx = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; - mtx = recmtx; -#else -#error Can not find mutex type attribute. -#endif + pthread_mutexattr_init(&ma); + pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&mtx, &ma); } - ~CriticalSection() throw() { pthread_mutex_destroy(&mtx); } + ~CriticalSection() throw() { + pthread_mutex_destroy(&mtx); + pthread_mutexattr_destroy(&ma); + } void enter() throw() { pthread_mutex_lock(&mtx); } void leave() throw() { pthread_mutex_unlock(&mtx); } pthread_mutex_t& getMutex() { return mtx; } private: pthread_mutex_t mtx; + pthread_mutexattr_t ma; #endif CriticalSection(const CriticalSection&); CriticalSection& operator=(const CriticalSection&); Modified: dcplusplus/trunk/client/HashManager.cpp =================================================================== --- dcplusplus/trunk/client/HashManager.cpp 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/client/HashManager.cpp 2006-06-10 09:48:17 UTC (rev 614) @@ -631,7 +631,7 @@ { Lock l(cs); - currentSize = max(currentSize - n, _LL(0)); + currentSize = max(static_cast<u_int64_t>(currentSize - n), static_cast<u_int64_t>(0)); } sizeLeft -= n; } while (n > 0 && !stop); Modified: dcplusplus/trunk/client/Text.cpp =================================================================== --- dcplusplus/trunk/client/Text.cpp 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/client/Text.cpp 2006-06-10 09:48:17 UTC (rev 614) @@ -148,6 +148,7 @@ if (n < 1) { return tmp; } + src = str.c_str(); tmp.resize(n); n = mbsrtowcs(&tmp[0], &src, n, NULL); if (n < 1) { @@ -188,6 +189,7 @@ if(n < 1) { return tmp; } + src = str.c_str(); tmp.resize(n); n = wcsrtombs(&tmp[0], &src, n, NULL); if(n < 1) { Modified: dcplusplus/trunk/client/Thread.cpp =================================================================== --- dcplusplus/trunk/client/Thread.cpp 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/client/Thread.cpp 2006-06-10 09:48:17 UTC (rev 614) @@ -23,6 +23,10 @@ #include "ResourceManager.h" +#ifndef _WIN32 +pthread_mutex_t Thread::mtx = PTHREAD_MUTEX_INITIALIZER; +#endif + #ifdef _WIN32 void Thread::start() throw(ThreadException) { join(); Modified: dcplusplus/trunk/client/Thread.h =================================================================== --- dcplusplus/trunk/client/Thread.h 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/client/Thread.h 2006-06-10 09:48:17 UTC (rev 614) @@ -29,10 +29,6 @@ #include <sys/resource.h> #endif -#ifdef HAVE_ASM_ATOMIC_H -#include <asm/atomic.h> -#endif - #include "Exception.h" STANDARD_EXCEPTION(ThreadException); @@ -98,24 +94,16 @@ static void sleep(u_int32_t millis) { ::usleep(millis*1000); } static void yield() { ::sched_yield(); } static long safeInc(volatile long& v) { -#ifdef HAVE_ASM_ATOMIC_H - atomic_t t = ATOMIC_INIT(v); - atomic_inc(&t); - return (v=t.counter); -#else -#warning FIXME - return ++v; -#endif + pthread_mutex_lock(&mtx); + long ret = ++v; + pthread_mutex_unlock(&mtx); + return ret; } static long safeDec(volatile long& v) { -#ifdef HAVE_ASM_ATOMIC_H - atomic_t t = ATOMIC_INIT(v); - atomic_dec(&t); - return (v=t.counter); -#else -#warning FIXME - return --v; -#endif + pthread_mutex_lock(&mtx); + long ret = --v; + pthread_mutex_unlock(&mtx); + return ret; } #endif @@ -135,6 +123,7 @@ return 0; } #else + static pthread_mutex_t mtx; pthread_t threadHandle; static void* starter(void* p) { Thread* t = (Thread*)p; Modified: dcplusplus/trunk/client/Util.cpp =================================================================== --- dcplusplus/trunk/client/Util.cpp 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/client/Util.cpp 2006-06-10 09:48:17 UTC (rev 614) @@ -915,7 +915,7 @@ return os; #else // _WIN32 - utsname n; + struct utsname n; if(uname(&n) != 0) { return "unix (unknown version)"; Modified: dcplusplus/trunk/windows/AboutDlg.h =================================================================== --- dcplusplus/trunk/windows/AboutDlg.h 2006-06-03 21:53:22 UTC (rev 613) +++ dcplusplus/trunk/windows/AboutDlg.h 2006-06-10 09:48:17 UTC (rev 614) @@ -41,7 +41,8 @@ _T("theparanoidone, gadget, naga, tremor, joakim tosteberg, pofis, psf8500, lauris ievins, ") _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, steven. ") +_T("krzysztof tyszecki, poison, pothead, pur, bigmuscle, martin, jove, bart vullings, steven, ") +_T("steven sheehy, tobias nygren. ") _T("Keep it coming!"); class AboutDlg : public CDialogImpl<AboutDlg>, private HttpConnectionListener This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-06-06 02:30:44
|
Revision: 612 Author: arnetheduck Date: 2006-06-03 14:38:06 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=612&view=rev Log Message: ----------- bot detection fix Modified Paths: -------------- dcplusplus/trunk/Example.xml dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/AdcHub.cpp dcplusplus/trunk/client/NmdcHub.cpp dcplusplus/trunk/client/User.cpp dcplusplus/trunk/client/User.h dcplusplus/trunk/help/changelog.html Modified: dcplusplus/trunk/Example.xml =================================================================== --- dcplusplus/trunk/Example.xml 2006-06-03 14:17:47 UTC (rev 611) +++ dcplusplus/trunk/Example.xml 2006-06-03 21:38:06 UTC (rev 612) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> -<Language Name="Example Language" Author="arnetheduck" Version="0.69" Revision="1" RightToLeft="0"> +<Language Name="Example Language" Author="arnetheduck" Version="0.691" Revision="1" RightToLeft="0"> <Strings> <String Name="Active">Active</String> <String Name="ActiveSearchString">Enabled / Search String</String> Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-06-03 14:17:47 UTC (rev 611) +++ dcplusplus/trunk/changelog.txt 2006-06-03 21:38:06 UTC (rev 612) @@ -1,4 +1,4 @@ --- 0.691 -- +-- 0.691 2006-06-03 -- * Links to bugzilla in html changelog * [bug 122] Added userlist filter (thanks trem) * [bug 578] Added search for alternates to transfers menu (thanks trem) @@ -12,7 +12,8 @@ * Added "all" to hub list field search (thanks trem) * Fixed bug when sending active ADC search results * Updated to ADC 0.11 -* Passive users now also get search results +* Passive users now also get ADC search results +* Changed nmdc bot-detection to what it was before, should fix pm-to-bot bug -- 0.69 2006-05-21 -- * Small linux / old gcc fixes (thanks jens oknelid) Modified: dcplusplus/trunk/client/AdcHub.cpp =================================================================== --- dcplusplus/trunk/client/AdcHub.cpp 2006-06-03 14:17:47 UTC (rev 611) +++ dcplusplus/trunk/client/AdcHub.cpp 2006-06-03 21:38:06 UTC (rev 612) @@ -119,6 +119,12 @@ u->getIdentity().set(i->c_str(), i->substr(2)); } + if(u->getIdentity().isBot()) { + u->getUser()->setFlag(User::BOT); + } else { + u->getUser()->unsetFlag(User::BOT); + } + if(u->getUser()->getFirstNick().empty()) { u->getUser()->setFirstNick(u->getIdentity().getNick()); } Modified: dcplusplus/trunk/client/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/client/NmdcHub.cpp 2006-06-03 14:17:47 UTC (rev 611) +++ dcplusplus/trunk/client/NmdcHub.cpp 2006-06-03 21:38:06 UTC (rev 612) @@ -93,8 +93,6 @@ getMyIdentity().setHubUrl(getHubUrl()); } else { p = ClientManager::getInstance()->getUser(aNick, getHubUrl()); - // In NMDC, everyone's a bot until they show a good myinfo - p->setFlag(User::BOT); } { @@ -319,8 +317,6 @@ OnlineUser& u = getUser(nick); - u.getUser()->unsetFlag(User::BOT); - j = param.find('$', i); if(j == string::npos) return; @@ -342,7 +338,15 @@ if(j == string::npos) return; - u.getIdentity().setConnection(param.substr(i, j-i-1)); + string connection = param.substr(i, j-i-1); + if(connection.empty()) { + // No connection = bot... + u.getUser()->setFlag(User::BOT); + } else { + u.getUser()->unsetFlag(User::BOT); + } + + u.getIdentity().setConnection(connection); i = j + 1; j = param.find('$', i); Modified: dcplusplus/trunk/client/User.cpp =================================================================== --- dcplusplus/trunk/client/User.cpp 2006-06-03 14:17:47 UTC (rev 611) +++ dcplusplus/trunk/client/User.cpp 2006-06-03 21:38:06 UTC (rev 612) @@ -55,8 +55,8 @@ } } -const bool Identity::supports(const string& name) const { - string su = get("SU"); +bool Identity::supports(const string& name) const { + const string& su = get("SU"); StringTokenizer<string> st(su, ','); for(StringIter i = st.getTokens().begin(); i != st.getTokens().end(); ++i) { if(*i == name) Modified: dcplusplus/trunk/client/User.h =================================================================== --- dcplusplus/trunk/client/User.h 2006-06-03 14:17:47 UTC (rev 611) +++ dcplusplus/trunk/client/User.h 2006-06-03 21:38:06 UTC (rev 612) @@ -124,12 +124,13 @@ get("HR") + "/" + get("HO") + ",S:" + get("SL") + ">"; } - const bool supports(const string& name) const; - const bool isHub() const { return !get("HU").empty(); } - const bool isOp() const { return !get("OP").empty(); } - const bool isHidden() const { return !get("HI").empty(); } - const bool isTcpActive() const { return !getIp().empty() || (user->isSet(User::NMDC) && !user->isSet(User::PASSIVE)); } - const bool isUdpActive() const { return !getIp().empty() && !getUdpPort().empty(); } + bool supports(const string& name) const; + bool isHub() const { return !get("HU").empty(); } + bool isOp() const { return !get("OP").empty(); } + bool isHidden() const { return !get("HI").empty(); } + bool isBot() const { return !get("BO").empty(); } + bool isTcpActive() const { return !getIp().empty() || (user->isSet(User::NMDC) && !user->isSet(User::PASSIVE)); } + bool isUdpActive() const { return !getIp().empty() && !getUdpPort().empty(); } const string& get(const char* name) const { InfMap::const_iterator i = info.find(*(short*)name); Modified: dcplusplus/trunk/help/changelog.html =================================================================== --- dcplusplus/trunk/help/changelog.html 2006-06-03 14:17:47 UTC (rev 611) +++ dcplusplus/trunk/help/changelog.html 2006-06-03 21:38:06 UTC (rev 612) @@ -13,6 +13,25 @@ <h1>DC++ Changelog</h1> See the version history of DC++ below. +<h2>0.691 <span style="color: gray;">(2006-06-03)</span></h2> +<ul> + <li>Links to bugzilla in html changelog</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=122">[bug 122]</a> Added userlist filter (thanks trem)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=578">[bug 578]</a> Added search for alternates to transfers menu (thanks trem)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=861">[bug 861]</a> Fixed auto-prio not being set correctly (thanks trem)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=878">[bug 878]</a> Added close all ... to window menu (thanks trem)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=903">[bug 903]</a> Holding shift while minimizing will use opposite tray setting (thanks joakim tosteberg)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=923">[bug 923]</a> PM history always read (thanks trem)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=927">[bug 927]</a> Fixed OP detection bug (thanks pothead)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=929">[bug 929]</a> Fixed list view flicker issues (thanks trem)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=931">[bug 931]</a> Improved keyboard navigation (thanks trem)</li> + <li>Added "all" to hub list field search (thanks trem)</li> + <li>Fixed bug when sending active ADC search results</li> + <li>Updated to ADC 0.11</li> + <li>Passive users now also get ADC search results</li> + <li>Changed nmdc bot-detection to what it was before, should fix pm-to-bot bug</li> +</ul> + <h2>0.69 <span style="color: gray;">(2006-05-21)</span></h2> <ul> <li>Small linux / old gcc fixes (thanks jens oknelid)</li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-06-03 14:18:19
|
Revision: 611 Author: arnetheduck Date: 2006-06-03 07:17:47 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=611&view=rev Log Message: ----------- Fixed user list filter Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/windows/HubFrame.cpp dcplusplus/trunk/windows/HubFrame.h dcplusplus/trunk/windows/PublicHubsFrm.cpp dcplusplus/trunk/windows/PublicHubsFrm.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-06-03 13:47:39 UTC (rev 610) +++ dcplusplus/trunk/changelog.txt 2006-06-03 14:17:47 UTC (rev 611) @@ -9,8 +9,10 @@ * [bug 927] Fixed OP detection bug (thanks pothead) * [bug 929] Fixed list view flicker issues (thanks trem) * [bug 931] Improved keyboard navigation (thanks trem) +* Added "all" to hub list field search (thanks trem) * Fixed bug when sending active ADC search results * Updated to ADC 0.11 +* Passive users now also get search results -- 0.69 2006-05-21 -- * Small linux / old gcc fixes (thanks jens oknelid) Modified: dcplusplus/trunk/windows/HubFrame.cpp =================================================================== --- dcplusplus/trunk/windows/HubFrame.cpp 2006-06-03 13:47:39 UTC (rev 610) +++ dcplusplus/trunk/windows/HubFrame.cpp 2006-06-03 14:17:47 UTC (rev 611) @@ -126,7 +126,8 @@ for(int j=0; j<COLUMN_LAST; j++) { ctrlFilterSel.AddString(CTSTRING_I(columnNames[j])); } - ctrlFilterSel.SetCurSel(0); + ctrlFilterSel.AddString(CTSTRING(ANY)); + ctrlFilterSel.SetCurSel(COLUMN_LAST); bHandled = FALSE; client->connect(); @@ -1306,31 +1307,31 @@ return 0; } -bool HubFrame::parseFilter(int& mode, int64_t& size) { +bool HubFrame::parseFilter(FilterModes& mode, int64_t& size) { tstring::size_type start = tstring::npos; tstring::size_type end = tstring::npos; int64_t multiplier = 1; if(filter.compare(0, 2, _T(">=")) == 0) { - mode = 1; + mode = FilterModes::GREATER_EQUAL; start = 2; } else if(filter.compare(0, 2, _T("<=")) == 0) { - mode = 2; + mode = FilterModes::LESS_EQUAL; start = 2; } else if(filter.compare(0, 2, _T("==")) == 0) { - mode = 0; + mode = FilterModes::EQUAL; start = 2; } else if(filter.compare(0, 2, _T("!=")) == 0) { - mode = 5; + mode = FilterModes::NOT_EQUAL; start = 2; } else if(filter[0] == _T('<')) { - mode = 4; + mode = FilterModes::LESS; start = 1; } else if(filter[0] == _T('>')) { - mode = 3; + mode = FilterModes::GREATER; start = 1; } else if(filter[0] == _T('=')) { - mode = 1; + mode = FilterModes::EQUAL; start = 1; } @@ -1372,7 +1373,7 @@ void HubFrame::updateUserList(UserInfo* ui) { int64_t size = -1; - int mode = -1; + FilterModes mode = FilterModes::NONE; int sel = ctrlFilterSel.GetCurSel(); @@ -1449,14 +1450,7 @@ } } -bool HubFrame::matchFilter(const UserInfo& ui, int sel, bool doSizeCompare, int mode, int64_t size) { - //mode - //0 - == - //1 - >= - //2 - <= - //3 - > - //4 - < - //5 - != +bool HubFrame::matchFilter(const UserInfo& ui, int sel, bool doSizeCompare, FilterModes mode, int64_t size) { if(filter.empty()) return true; @@ -1464,16 +1458,25 @@ bool insert = false; if(doSizeCompare) { switch(mode) { - case 0: insert = (size == ui.getIdentity().getBytesShared()); break; - case 1: insert = (size <= ui.getIdentity().getBytesShared()); break; - case 2: insert = (size >= ui.getIdentity().getBytesShared()); break; - case 3: insert = (size < ui.getIdentity().getBytesShared()); break; - case 4: insert = (size > ui.getIdentity().getBytesShared()); break; - case 5: insert = (size != ui.getIdentity().getBytesShared()); break; + case FilterModes::EQUAL: insert = (size == ui.getIdentity().getBytesShared()); break; + case FilterModes::GREATER_EQUAL: insert = (size <= ui.getIdentity().getBytesShared()); break; + case FilterModes::LESS_EQUAL: insert = (size >= ui.getIdentity().getBytesShared()); break; + case FilterModes::GREATER: insert = (size < ui.getIdentity().getBytesShared()); break; + case FilterModes::LESS: insert = (size > ui.getIdentity().getBytesShared()); break; + case FilterModes::NOT_EQUAL: insert = (size != ui.getIdentity().getBytesShared()); break; } } else { - if(Util::findSubString(ui.getText(sel), filter) != string::npos) - insert = true; + if(sel >= COLUMN_LAST) { + for(int i = COLUMN_FIRST; i < COLUMN_LAST; ++i) { + if(Util::findSubString(ui.getText(i), filter) != string::npos) { + insert = true; + break; + } + } + } else { + if(Util::findSubString(ui.getText(sel), filter) != string::npos) + insert = true; + } } return insert; Modified: dcplusplus/trunk/windows/HubFrame.h =================================================================== --- dcplusplus/trunk/windows/HubFrame.h 2006-06-03 13:47:39 UTC (rev 610) +++ dcplusplus/trunk/windows/HubFrame.h 2006-06-03 14:17:47 UTC (rev 611) @@ -178,6 +178,16 @@ COLUMN_LAST }; + enum FilterModes{ + NONE, + EQUAL, + GREATER_EQUAL, + LESS_EQUAL, + GREATER, + LESS, + NOT_EQUAL + }; + struct Task { Task(Speakers speaker_) : speaker(speaker_) { } virtual ~Task() { } @@ -354,8 +364,8 @@ void removeUser(const User::Ptr& aUser); void updateUserList(UserInfo* ui = NULL); - bool parseFilter(int& mode, int64_t& size); - bool matchFilter(const UserInfo& ui, int sel, bool doSizeCompare = false, int mode = 0, int64_t size = 0); + bool parseFilter(FilterModes& mode, int64_t& size); + bool matchFilter(const UserInfo& ui, int sel, bool doSizeCompare = false, FilterModes mode = FilterModes::NONE, int64_t size = 0); UserInfo* findUser(const tstring& nick); void addAsFavorite(); Modified: dcplusplus/trunk/windows/PublicHubsFrm.cpp =================================================================== --- dcplusplus/trunk/windows/PublicHubsFrm.cpp 2006-06-03 13:47:39 UTC (rev 610) +++ dcplusplus/trunk/windows/PublicHubsFrm.cpp 2006-06-03 14:17:47 UTC (rev 611) @@ -126,8 +126,8 @@ for(int j=0; j<COLUMN_LAST; j++) { ctrlFilterSel.AddString(CTSTRING_I(columnNames[j])); } - - ctrlFilterSel.SetCurSel(0); + ctrlFilterSel.AddString(CTSTRING(ANY)); + ctrlFilterSel.SetCurSel(COLUMN_LAST); ctrlFilterDesc.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | BS_GROUPBOX, WS_EX_TRANSPARENT); @@ -383,7 +383,7 @@ ctrlHubs.SetRedraw(FALSE); double size = -1; - int mode = -1; + FilterModes mode = FilterModes::NONE; int sel = ctrlFilterSel.GetCurSel(); @@ -489,31 +489,31 @@ ctrlPubLists.SetCurSel(FavoriteManager::getInstance()->getSelectedHubList()); } -bool PublicHubsFrame::parseFilter(int& mode, double& size) { +bool PublicHubsFrame::parseFilter(FilterModes& mode, double& size) { string::size_type start = (string::size_type)string::npos; string::size_type end = (string::size_type)string::npos; int64_t multiplier = 1; - if(Util::strnicmp(filter.c_str(), ">=", 2) == 0) { - mode = 1; + if(filter.compare(0, 2, ">=") == 0) { + mode = FilterModes::GREATER_EQUAL; start = 2; - } else if(Util::strnicmp(filter.c_str(), "<=", 2) == 0) { - mode = 2; + } else if(filter.compare(0, 2, "<=") == 0) { + mode = FilterModes::LESS_EQUAL; start = 2; - } else if(Util::strnicmp(filter.c_str(), "==", 2) == 0) { - mode = 0; + } else if(filter.compare(0, 2, "==") == 0) { + mode = FilterModes::EQUAL; start = 2; - } else if(Util::strnicmp(filter.c_str(), "!=", 2) == 0) { - mode = 5; + } else if(filter.compare(0, 2, "!=") == 0) { + mode = FilterModes::NOT_EQUAL; start = 2; - } else if(filter[0] == '<') { - mode = 4; + } else if(filter[0] == _T('<')) { + mode = FilterModes::LESS; start = 1; - } else if(filter[0] == '>') { - mode = 3; + } else if(filter[0] == _T('>')) { + mode = FilterModes::GREATER; start = 1; - } else if(filter[0] == '=') { - mode = 1; + } else if(filter[0] == _T('=')) { + mode = FilterModes::EQUAL; start = 1; } @@ -553,15 +553,7 @@ return true; } -bool PublicHubsFrame::matchFilter(const HubEntry& entry, const int& sel, bool doSizeCompare, const int& mode, const double& size) { - //mode - //0 - == - //1 - >= - //2 - <= - //3 - > - //4 - < - //5 - != - +bool PublicHubsFrame::matchFilter(const HubEntry& entry, const int& sel, bool doSizeCompare, const FilterModes& mode, const double& size) { if(filter.empty()) return true; @@ -587,14 +579,23 @@ bool insert = false; if(doSizeCompare) { switch(mode) { - case 0: insert = (size == entrySize); break; - case 1: insert = (size <= entrySize); break; - case 2: insert = (size >= entrySize); break; - case 3: insert = (size < entrySize); break; - case 4: insert = (size > entrySize); break; - case 5: insert = (size != entrySize); break; + case FilterModes::EQUAL: insert = (size == entrySize); break; + case FilterModes::GREATER_EQUAL: insert = (size <= entrySize); break; + case FilterModes::LESS_EQUAL: insert = (size >= entrySize); break; + case FilterModes::GREATER: insert = (size < entrySize); break; + case FilterModes::LESS: insert = (size > entrySize); break; + case FilterModes::NOT_EQUAL: insert = (size != entrySize); break; } } else { + if(sel >= COLUMN_LAST) { + if( Util::findSubString(entry.getName(), filter) != string::npos || + Util::findSubString(entry.getDescription(), filter) != string::npos || + Util::findSubString(entry.getServer(), filter) != string::npos || + Util::findSubString(entry.getCountry(), filter) != string::npos || + Util::findSubString(entry.getRating(), filter) != string::npos ) { + insert = true; + } + } if(Util::findSubString(entryString, filter) != string::npos) insert = true; } Modified: dcplusplus/trunk/windows/PublicHubsFrm.h =================================================================== --- dcplusplus/trunk/windows/PublicHubsFrm.h 2006-06-03 13:47:39 UTC (rev 610) +++ dcplusplus/trunk/windows/PublicHubsFrm.h 2006-06-03 14:17:47 UTC (rev 611) @@ -128,6 +128,16 @@ FAILED }; + enum FilterModes{ + NONE, + EQUAL, + GREATER_EQUAL, + LESS_EQUAL, + GREATER, + LESS, + NOT_EQUAL + }; + int visibleHubs; int users; CStatusBarCtrl ctrlStatus; @@ -163,8 +173,8 @@ void updateList(); void updateDropDown(); - bool parseFilter(int& mode, double& size); - bool matchFilter(const HubEntry& entry, const int& sel, bool doSizeCompare, const int& mode, const double& size); + bool parseFilter(FilterModes& mode, double& size); + bool matchFilter(const HubEntry& entry, const int& sel, bool doSizeCompare, const FilterModes& mode, const double& size); }; #endif // !defined(PUBLIC_HUBS_FRM_H) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-06-03 13:48:11
|
Revision: 610 Author: arnetheduck Date: 2006-06-03 06:47:39 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=610&view=rev Log Message: ----------- Passive adc search results Modified Paths: -------------- dcplusplus/trunk/DCPlusPlus.rc dcplusplus/trunk/client/AdcHub.cpp dcplusplus/trunk/client/AdcHub.h dcplusplus/trunk/client/DownloadManager.cpp dcplusplus/trunk/client/MerkleCheckOutputStream.h dcplusplus/trunk/client/SearchManager.cpp dcplusplus/trunk/client/SearchManager.h dcplusplus/trunk/client/version.h dcplusplus/trunk/windows/resource.h Modified: dcplusplus/trunk/DCPlusPlus.rc =================================================================== --- dcplusplus/trunk/DCPlusPlus.rc 2006-06-03 11:12:22 UTC (rev 609) +++ dcplusplus/trunk/DCPlusPlus.rc 2006-06-03 13:47:39 UTC (rev 610) @@ -933,8 +933,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,6,9,0 - PRODUCTVERSION 0,6,9,0 + FILEVERSION 0,6,9,1 + PRODUCTVERSION 0,6,9,1 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -951,12 +951,12 @@ BEGIN VALUE "Comments", "http://dcplusplus.sourceforge.net" VALUE "FileDescription", "DC++" - VALUE "FileVersion", "0, 6, 9, 0" + VALUE "FileVersion", "0, 6, 9, 1" VALUE "InternalName", "DC++" VALUE "LegalCopyright", "Copyright 2001-2006 Jacek Sieka" VALUE "OriginalFilename", "DCPlusPlus.exe" VALUE "ProductName", "DC++" - VALUE "ProductVersion", "0, 6, 9, 0" + VALUE "ProductVersion", "0, 6, 9, 1" END END BLOCK "VarFileInfo" Modified: dcplusplus/trunk/client/AdcHub.cpp =================================================================== --- dcplusplus/trunk/client/AdcHub.cpp 2006-06-03 11:12:22 UTC (rev 609) +++ dcplusplus/trunk/client/AdcHub.cpp 2006-06-03 13:47:39 UTC (rev 610) @@ -47,16 +47,11 @@ } OnlineUser& AdcHub::getUser(const u_int32_t aSID, const CID& aCID) { - OnlineUser* u = NULL; - { - Lock l(cs); - - SIDIter i = users.find(aSID); - if(i != users.end()) - return *i->second; + OnlineUser* u = findUser(aSID); + if(u) { + return *u; } - User::Ptr p = ClientManager::getInstance()->getUser(aCID); { @@ -69,9 +64,9 @@ return *u; } -OnlineUser* AdcHub::findUser(const u_int32_t aSID) { +OnlineUser* AdcHub::findUser(const u_int32_t aSID) const { Lock l(cs); - SIDIter i = users.find(aSID); + SIDMap::const_iterator i = users.find(aSID); return i == users.end() ? NULL : i->second; } @@ -315,15 +310,24 @@ } void AdcHub::handle(AdcCommand::SCH, AdcCommand& c) throw() { - SIDMap::const_iterator i = users.find(c.getFrom()); - if(i == users.end()) { + OnlineUser* ou = findUser(c.getFrom()); + if(!ou) { dcdebug("Invalid user in AdcHub::onSCH\n"); return; } - fire(ClientListener::AdcSearch(), this, c, i->second->getUser()->getCID()); + fire(ClientListener::AdcSearch(), this, c, ou->getUser()->getCID()); } +void AdcHub::handle(AdcCommand::RES, AdcCommand& c) throw() { + OnlineUser* ou = findUser(c.getFrom()); + if(!ou) { + dcdebug("Invalid user in AdcHub::onRES\n"); + return; + } + SearchManager::getInstance()->onRES(c, ou->getUser()); +} + void AdcHub::connect(const OnlineUser& user) { u_int32_t r = Util::rand(); connect(user, Util::toString(r), BOOLSETTING(USE_SSL) && user.getUser()->isSet(User::SSL)); Modified: dcplusplus/trunk/client/AdcHub.h =================================================================== --- dcplusplus/trunk/client/AdcHub.h 2006-06-03 11:12:22 UTC (rev 609) +++ dcplusplus/trunk/client/AdcHub.h 2006-06-03 13:47:39 UTC (rev 610) @@ -91,7 +91,7 @@ virtual string checkNick(const string& nick); OnlineUser& getUser(const u_int32_t aSID, const CID& aCID); - OnlineUser* findUser(const u_int32_t sid); + OnlineUser* findUser(const u_int32_t sid) const; void putUser(const u_int32_t sid); void clearUsers(); @@ -107,6 +107,7 @@ void handle(AdcCommand::STA, AdcCommand& c) throw(); void handle(AdcCommand::SCH, AdcCommand& c) throw(); void handle(AdcCommand::CMD, AdcCommand& c) throw(); + void handle(AdcCommand::RES, AdcCommand& c) throw(); template<typename T> void handle(T, AdcCommand&) { //Speaker<AdcHubListener>::fire(t, this, c); Modified: dcplusplus/trunk/client/DownloadManager.cpp =================================================================== --- dcplusplus/trunk/client/DownloadManager.cpp 2006-06-03 11:12:22 UTC (rev 609) +++ dcplusplus/trunk/client/DownloadManager.cpp 2006-06-03 13:47:39 UTC (rev 610) @@ -268,7 +268,8 @@ if(BOOLSETTING(ADVANCED_RESUME) && d->getTreeValid() && start > 0 && (d->getTigerTree().getLeaves().size() > 32 || // 32 leaves is 5 levels - d->getTigerTree().getBlockSize() * 10 < d->getSize())) { + d->getTigerTree().getBlockSize() * 10 < d->getSize())) + { d->setStartPos(getResumePos(d->getDownloadTarget(), d->getTigerTree(), start)); } else { int rollback = SETTING(ROLLBACK); @@ -326,19 +327,21 @@ int64_t DownloadManager::getResumePos(const string& file, const TigerTree& tt, int64_t startPos) { // Always discard data until the last block - startPos = startPos - (startPos % tt.getBlockSize()); if(startPos < tt.getBlockSize()) return 0; + startPos -= (startPos % tt.getBlockSize()); + DummyOutputStream dummy; vector<u_int8_t> buf((size_t)min((int64_t)1024*1024, tt.getBlockSize())); do { int64_t blockPos = startPos - tt.getBlockSize(); - MerkleCheckOutputStream<TigerTree, false> check(tt, &dummy, blockPos); try { + MerkleCheckOutputStream<TigerTree, false> check(tt, &dummy, blockPos); + File inFile(file, File::READ, File::OPEN); inFile.setPos(blockPos); int64_t bytesLeft = tt.getBlockSize(); Modified: dcplusplus/trunk/client/MerkleCheckOutputStream.h =================================================================== --- dcplusplus/trunk/client/MerkleCheckOutputStream.h 2006-06-03 11:12:22 UTC (rev 609) +++ dcplusplus/trunk/client/MerkleCheckOutputStream.h 2006-06-03 13:47:39 UTC (rev 610) @@ -32,10 +32,14 @@ MerkleCheckOutputStream(const TreeType& aTree, OutputStream* aStream, int64_t start) : s(aStream), real(aTree), cur(aTree.getBlockSize()), verified(0), bufPos(0) { // Only start at block boundaries dcassert(start % aTree.getBlockSize() == 0); - // Sanity check - dcassert(aTree.getLeaves().size() > (size_t)(start / aTree.getBlockSize())); cur.setFileSize(start); - cur.getLeaves().insert(cur.getLeaves().begin(), aTree.getLeaves().begin(), aTree.getLeaves().begin() + (size_t)(start / aTree.getBlockSize())); + + size_t nBlocks = static_cast<size_t>(start / aTree.getBlockSize()); + if(nBlocks > aTree.getLeaves().size()) { + dcdebug("Invalid tree / parameters"); + return; + } + cur.getLeaves().insert(cur.getLeaves().begin(), aTree.getLeaves().begin(), aTree.getLeaves().begin() + nBlocks); } virtual ~MerkleCheckOutputStream() throw() { if(managed) delete s; } Modified: dcplusplus/trunk/client/SearchManager.cpp =================================================================== --- dcplusplus/trunk/client/SearchManager.cpp 2006-06-03 11:12:22 UTC (rev 609) +++ dcplusplus/trunk/client/SearchManager.cpp 2006-06-03 13:47:39 UTC (rev 610) @@ -268,7 +268,7 @@ } SearchResult* sr = new SearchResult(user, type, slots, freeSlots, size, - file, hubName, url, remoteIp, tth.empty() ? NULL : new TTHValue(tth), false); + file, hubName, url, remoteIp, tth.empty() ? NULL : new TTHValue(tth), false, Util::emptyString); fire(SearchManagerListener::SR(), sr); sr->decRef(); } else if(x.compare(1, 4, "RES ") == 0 && x[x.length() - 1] == 0x0a) { @@ -283,38 +283,11 @@ if(!user) return; - int freeSlots = -1; - int64_t size = -1; - string file; - string tth; + // This should be handled by AdcCommand really... + c.getParameters().erase(c.getParameters().begin()); - for(StringIter i = c.getParameters().begin() + 1; i != c.getParameters().end(); ++i) { - string& str = *i; - if(str.compare(0, 2, "FN") == 0) { - file = Util::toNmdcFile(str.substr(2)); - } else if(str.compare(0, 2, "SL") == 0) { - freeSlots = Util::toInt(str.substr(2)); - } else if(str.compare(0, 2, "SI") == 0) { - size = Util::toInt64(str.substr(2)); - } else if(str.compare(0, 2, "TR") == 0) { - tth = str.substr(2); - } - } + onRES(c, user, remoteIp); - if(!file.empty() && freeSlots != -1 && size != -1) { - - StringList names = ClientManager::getInstance()->getHubNames(user->getCID()); - string hubName = names.empty() ? STRING(OFFLINE) : Util::toString(names); - StringList hubs = ClientManager::getInstance()->getHubs(user->getCID()); - string hub = hubs.empty() ? STRING(OFFLINE) : Util::toString(hubs); - - SearchResult::Types type = (file[file.length() - 1] == '\\' ? SearchResult::TYPE_DIRECTORY : SearchResult::TYPE_FILE); - /// @todo Something about the slots - SearchResult* sr = new SearchResult(user, type, 0, freeSlots, size, - file, hubName, hub, remoteIp, tth.empty() ? NULL : new TTHValue(tth), true); - fire(SearchManagerListener::SR(), sr); - sr->decRef(); - } } /*else if(x.compare(1, 4, "SCH ") == 0 && x[x.length() - 1] == 0x0a) { try { respond(AdcCommand(x.substr(0, x.length()-1))); @@ -323,6 +296,44 @@ }*/ // Needs further DoS investigation } +void SearchManager::onRES(const AdcCommand& cmd, const User::Ptr& from, const string& remoteIp) { + int freeSlots = -1; + int64_t size = -1; + string file; + string tth; + string token; + + for(StringIterC i = cmd.getParameters().begin(); i != cmd.getParameters().end(); ++i) { + const string& str = *i; + if(str.compare(0, 2, "FN") == 0) { + file = Util::toNmdcFile(str.substr(2)); + } else if(str.compare(0, 2, "SL") == 0) { + freeSlots = Util::toInt(str.substr(2)); + } else if(str.compare(0, 2, "SI") == 0) { + size = Util::toInt64(str.substr(2)); + } else if(str.compare(0, 2, "TR") == 0) { + tth = str.substr(2); + } else if(str.compare(0, 2, "TO") == 0) { + token = str.substr(2); + } + } + + if(!file.empty() && freeSlots != -1 && size != -1) { + + StringList names = ClientManager::getInstance()->getHubNames(from->getCID()); + string hubName = names.empty() ? STRING(OFFLINE) : Util::toString(names); + StringList hubs = ClientManager::getInstance()->getHubs(from->getCID()); + string hub = hubs.empty() ? STRING(OFFLINE) : Util::toString(hubs); + + SearchResult::Types type = (file[file.length() - 1] == '\\' ? SearchResult::TYPE_DIRECTORY : SearchResult::TYPE_FILE); + /// @todo Something about the slots + SearchResult* sr = new SearchResult(from, type, 0, freeSlots, size, + file, hubName, hub, remoteIp, tth.empty() ? NULL : new TTHValue(tth), true, token); + fire(SearchManagerListener::SR(), sr); + sr->decRef(); + } +} + void SearchManager::respond(const AdcCommand& adc, const CID& from) { // Filter own searches if(from == ClientManager::getInstance()->getMe()->getCID()) Modified: dcplusplus/trunk/client/SearchManager.h =================================================================== --- dcplusplus/trunk/client/SearchManager.h 2006-06-03 11:12:22 UTC (rev 609) +++ dcplusplus/trunk/client/SearchManager.h 2006-06-03 13:47:39 UTC (rev 610) @@ -55,10 +55,10 @@ SearchResult(const User::Ptr& aUser, Types aType, int aSlots, int aFreeSlots, int64_t aSize, const string& aFile, const string& aHubName, - const string& aHubURL, const string& ip, TTHValue* aTTH, bool aUtf8) : + const string& aHubURL, const string& ip, TTHValue* aTTH, bool aUtf8, const string& aToken) : file(aFile), hubName(aHubName), hubURL(aHubURL), user(aUser), size(aSize), type(aType), slots(aSlots), freeSlots(aFreeSlots), IP(ip), - tth((aTTH != NULL) ? new TTHValue(*aTTH) : NULL), utf8(aUtf8), ref(1) { } + tth((aTTH != NULL) ? new TTHValue(*aTTH) : NULL), token(aToken), utf8(aUtf8), ref(1) { } string getFileName() const; string toSR(const Client& client) const; @@ -77,6 +77,7 @@ TTHValue* getTTH() const { return tth; } bool getUtf8() const { return utf8; } const string& getIP() const { return IP; } + const string& getToken() const { return token; } void incRef() { Thread::safeInc(ref); } void decRef() { @@ -102,6 +103,7 @@ int freeSlots; string IP; TTHValue* tth; + string token; bool utf8; volatile long ref; @@ -151,6 +153,8 @@ void onSearchResult(const string& aLine) { onData((const u_int8_t*)aLine.data(), aLine.length(), Util::emptyString); } + + void onRES(const AdcCommand& cmd, const User::Ptr& from, const string& removeIp = Util::emptyString); int32_t timeToSearch() { return (int32_t)(((((int64_t)lastSearch) + 5000) - GET_TICK() ) / 1000); Modified: dcplusplus/trunk/client/version.h =================================================================== --- dcplusplus/trunk/client/version.h 2006-06-03 11:12:22 UTC (rev 609) +++ dcplusplus/trunk/client/version.h 2006-06-03 13:47:39 UTC (rev 610) @@ -17,8 +17,8 @@ */ #define APPNAME "DC++" -#define VERSIONSTRING "0.69" -#define VERSIONFLOAT 0.69 +#define VERSIONSTRING "0.691" +#define VERSIONFLOAT 0.691 /* Update the .rc file as well... */ Modified: dcplusplus/trunk/windows/resource.h =================================================================== --- dcplusplus/trunk/windows/resource.h 2006-06-03 11:12:22 UTC (rev 609) +++ dcplusplus/trunk/windows/resource.h 2006-06-03 13:47:39 UTC (rev 610) @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by f:\Programmering\C++\dcplusplus\DCPlusPlus.rc +// Used by c:\Documents\VCProjects\DCPlusPlus\DCPlusPlus.rc // #define IDD_ABOUTBOX 100 #define IDC_TRAY_QUIT 102 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-06-03 11:15:04
|
Revision: 609 Author: arnetheduck Date: 2006-06-03 04:12:22 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=609&view=rev Log Message: ----------- Patches & adc fixes Modified Paths: -------------- dcplusplus/trunk/DCPlusPlus.vcproj dcplusplus/trunk/Example.xml dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/AdcCommand.cpp dcplusplus/trunk/client/AdcCommand.h dcplusplus/trunk/client/AdcHub.cpp dcplusplus/trunk/client/CID.h dcplusplus/trunk/client/ClientManager.cpp dcplusplus/trunk/client/QueueManager.cpp dcplusplus/trunk/client/SearchManager.cpp dcplusplus/trunk/client/StringDefs.cpp dcplusplus/trunk/client/StringDefs.h dcplusplus/trunk/client/Util.cpp dcplusplus/trunk/client/Util.h dcplusplus/trunk/help/changelog.html dcplusplus/trunk/help/gen_changelog.py dcplusplus/trunk/windows/ADLSearchFrame.cpp dcplusplus/trunk/windows/ADLSearchFrame.h dcplusplus/trunk/windows/DirectoryListingFrm.cpp dcplusplus/trunk/windows/DirectoryListingFrm.h dcplusplus/trunk/windows/FavoriteDirsPage.cpp dcplusplus/trunk/windows/FavoriteDirsPage.h dcplusplus/trunk/windows/FavoritesFrm.cpp dcplusplus/trunk/windows/FavoritesFrm.h dcplusplus/trunk/windows/HubFrame.cpp dcplusplus/trunk/windows/HubFrame.h dcplusplus/trunk/windows/MainFrm.cpp dcplusplus/trunk/windows/MainFrm.h dcplusplus/trunk/windows/PrivateFrame.cpp dcplusplus/trunk/windows/PrivateFrame.h dcplusplus/trunk/windows/PropertiesDlg.cpp dcplusplus/trunk/windows/SearchFrm.cpp dcplusplus/trunk/windows/SearchFrm.h dcplusplus/trunk/windows/TransferView.cpp dcplusplus/trunk/windows/TransferView.h dcplusplus/trunk/windows/TypedListViewCtrl.h dcplusplus/trunk/windows/UCPage.cpp dcplusplus/trunk/windows/UCPage.h dcplusplus/trunk/windows/UploadPage.cpp dcplusplus/trunk/windows/UploadPage.h dcplusplus/trunk/windows/UsersFrame.cpp dcplusplus/trunk/windows/UsersFrame.h dcplusplus/trunk/windows/WinUtil.cpp dcplusplus/trunk/windows/resource.h Added Paths: ----------- dcplusplus/trunk/windows/MemDC.h Modified: dcplusplus/trunk/DCPlusPlus.vcproj =================================================================== --- dcplusplus/trunk/DCPlusPlus.vcproj 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/DCPlusPlus.vcproj 2006-06-03 11:12:22 UTC (rev 609) @@ -487,6 +487,9 @@ RelativePath=".\windows\MainFrm.h"> </File> <File + RelativePath=".\windows\memdc.h"> + </File> + <File RelativePath=".\windows\NetworkPage.h"> </File> <File Modified: dcplusplus/trunk/Example.xml =================================================================== --- dcplusplus/trunk/Example.xml 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/Example.xml 2006-06-03 11:12:22 UTC (rev 609) @@ -226,6 +226,10 @@ <String Name="MenuArrange">Arrange icons</String> <String Name="MenuCascade">Cascade</String> <String Name="MenuChangelog">Change Log</String> + <String Name="MenuCloseAllDirList">Close all file list windows</String> + <String Name="MenuCloseAllOfflinePm">Close all offline PM windows</String> + <String Name="MenuCloseAllPm">Close all PM windows</String> + <String Name="MenuCloseAllSearchframe">Close all search windows</String> <String Name="MenuCloseDisconnected">Close disconnected</String> <String Name="MenuContents">Help &Contents F1</String> <String Name="MenuDiscuss">DC++ discussion forum</String> Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/changelog.txt 2006-06-03 11:12:22 UTC (rev 609) @@ -1,4 +1,18 @@ --- 0.69 2006-05-21 -- +-- 0.691 -- +* Links to bugzilla in html changelog +* [bug 122] Added userlist filter (thanks trem) +* [bug 578] Added search for alternates to transfers menu (thanks trem) +* [bug 861] Fixed auto-prio not being set correctly (thanks trem) +* [bug 878] Added close all ... to window menu (thanks trem) +* [bug 903] Holding shift while minimizing will use opposite tray setting (thanks joakim tosteberg) +* [bug 923] PM history always read (thanks trem) +* [bug 927] Fixed OP detection bug (thanks pothead) +* [bug 929] Fixed list view flicker issues (thanks trem) +* [bug 931] Improved keyboard navigation (thanks trem) +* Fixed bug when sending active ADC search results +* Updated to ADC 0.11 + +-- 0.69 2006-05-21 -- * Small linux / old gcc fixes (thanks jens oknelid) * Fixed an issue where client could be crashed from remote * Fixed an issue bad nicks could cause directories to be created in log / file list download folder @@ -10,7 +24,7 @@ * Fixed ADC hubname display (thanks ullner) * Advanced TTH rollback no longer performed if tree is invalid (thanks garg) * Option not to auto-disconnect favorite users (thanks ullner) -* Fixed auto-disconnect delay (thanks uller) +* Fixed auto-disconnect delay (thanks ullner) * Another fix for opencow * Fixed user command parameters not being remembered * Fixed ADC op commands Modified: dcplusplus/trunk/client/AdcCommand.cpp =================================================================== --- dcplusplus/trunk/client/AdcCommand.cpp 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/client/AdcCommand.cpp 2006-06-03 11:12:22 UTC (rev 609) @@ -25,7 +25,7 @@ AdcCommand::AdcCommand(u_int32_t aCmd, char aType /* = TYPE_CLIENT */) : cmdInt(aCmd), from(0), type(aType) { } AdcCommand::AdcCommand(u_int32_t aCmd, const u_int32_t aTarget) : cmdInt(aCmd), from(0), to(aTarget), type(TYPE_DIRECT) { } AdcCommand::AdcCommand(Severity sev, Error err, const string& desc, char aType /* = TYPE_CLIENT */) : cmdInt(CMD_STA), from(0), type(aType) { - addParam(Util::toString(sev) + Util::toString(err)); + addParam(Util::toString(sev * 100 + err)); addParam(desc); } AdcCommand::AdcCommand(const string& aLine, bool nmdc /* = false */) throw(ParseException) : cmdInt(0), type(TYPE_CLIENT) { Modified: dcplusplus/trunk/client/AdcCommand.h =================================================================== --- dcplusplus/trunk/client/AdcCommand.h 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/client/AdcCommand.h 2006-06-03 11:12:22 UTC (rev 609) @@ -49,6 +49,7 @@ ERROR_CID_TAKEN = 24, ERROR_COMMAND_ACCESS = 25, ERROR_REGGED_ONLY = 26, + ERROR_INVALID_PID = 27, ERROR_BANNED_GENERIC = 30, ERROR_PERM_BANNED = 31, ERROR_TEMP_BANNED = 32, @@ -56,6 +57,8 @@ ERROR_PROTOCOL_UNSUPPORTED = 41, ERROR_INF_MISSING = 42, ERROR_BAD_STATE = 43, + ERROR_FEATURE_MISSING = 44, + ERROR_BAD_IP = 45, ERROR_TRANSFER_GENERIC = 50, ERROR_FILE_NOT_AVAILABLE = 51, ERROR_FILE_PART_NOT_AVAILABLE = 52, Modified: dcplusplus/trunk/client/AdcHub.cpp =================================================================== --- dcplusplus/trunk/client/AdcHub.cpp 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/client/AdcHub.cpp 2006-06-03 11:12:22 UTC (rev 609) @@ -404,8 +404,8 @@ AutoArray<u_int8_t> buf(saltBytes); Encoder::fromBase32(salt.c_str(), buf, saltBytes); TigerHash th; - string cid = getMyIdentity().getUser()->getCID().toBase32(); - th.update(cid.c_str(), cid.length()); + CID cid = getMyIdentity().getUser()->getCID(); + th.update(cid.data(), CID::SIZE); th.update(pwd.data(), pwd.length()); th.update(buf, saltBytes); send(AdcCommand(AdcCommand::CMD_PAS, AdcCommand::TYPE_HUB).addParam(Encoder::toBase32(th.finalize(), TigerHash::HASH_SIZE))); Modified: dcplusplus/trunk/client/CID.h =================================================================== --- dcplusplus/trunk/client/CID.h 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/client/CID.h 2006-06-03 11:12:22 UTC (rev 609) @@ -44,7 +44,7 @@ string& toBase32(string& tmp) const { return Encoder::toBase32(cid, sizeof(cid), tmp); } size_t toHash() const { return *reinterpret_cast<const size_t*>(cid); } - const u_int8_t* getData() const { return cid; } + const u_int8_t* data() const { return cid; } bool isZero() const { return find_if(cid, cid+SIZE, bind2nd(not_equal_to<u_int8_t>(), 0)) == (cid+SIZE); } Modified: dcplusplus/trunk/client/ClientManager.cpp =================================================================== --- dcplusplus/trunk/client/ClientManager.cpp 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/client/ClientManager.cpp 2006-06-03 11:12:22 UTC (rev 609) @@ -312,12 +312,18 @@ Lock l(cs); OnlineIter i = onlineUsers.find(cid); if(i != onlineUsers.end()) { - OnlineUser* u = i->second; - if(cmd.getType() == AdcCommand::TYPE_UDP && !u->getIdentity().isUdpActive()) { + OnlineUser& u = *i->second; + if(cmd.getType() == AdcCommand::TYPE_UDP && !u.getIdentity().isUdpActive()) { cmd.setType(AdcCommand::TYPE_DIRECT); + cmd.setTo(u.getIdentity().getSID()); + u.getClient().send(cmd); + } else { + try { + s.writeTo(u.getIdentity().getIp(), static_cast<short>(Util::toInt(u.getIdentity().getUdpPort())), cmd.toString(getMe()->getCID())); + } catch(const SocketException&) { + dcdebug("Socket exception sending ADC UDP command\n"); + } } - cmd.setTo(u->getIdentity().getSID()); - u->getClient().send(cmd); } } @@ -509,7 +515,7 @@ CID ClientManager::getMyCID() { TigerHash tiger; - tiger.update(getMyPID().getData(), CID::SIZE); + tiger.update(getMyPID().data(), CID::SIZE); return CID(tiger.finalize()); } Modified: dcplusplus/trunk/client/QueueManager.cpp =================================================================== --- dcplusplus/trunk/client/QueueManager.cpp 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/client/QueueManager.cpp 2006-06-03 11:12:22 UTC (rev 609) @@ -484,7 +484,7 @@ QueueItem* q = fileQueue.find(target); if(q == NULL) { - q = fileQueue.add(target, aSize, aFlags, QueueItem::NORMAL, Util::emptyString, 0, GET_TIME(), root); + q = fileQueue.add(target, aSize, aFlags, QueueItem::DEFAULT, Util::emptyString, 0, GET_TIME(), root); fire(QueueManagerListener::Added(), q); } else { if(q->getSize() != aSize) { Modified: dcplusplus/trunk/client/SearchManager.cpp =================================================================== --- dcplusplus/trunk/client/SearchManager.cpp 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/client/SearchManager.cpp 2006-06-03 11:12:22 UTC (rev 609) @@ -344,7 +344,6 @@ for(SearchResult::Iter i = results.begin(); i != results.end(); ++i) { AdcCommand cmd = (*i)->toRES(AdcCommand::TYPE_UDP); - cmd.setTo(adc.getFrom()); if(!token.empty()) cmd.addParam("TO", token); ClientManager::getInstance()->send(cmd, from); Modified: dcplusplus/trunk/client/StringDefs.cpp =================================================================== --- dcplusplus/trunk/client/StringDefs.cpp 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/client/StringDefs.cpp 2006-06-03 11:12:22 UTC (rev 609) @@ -227,6 +227,10 @@ "Arrange icons", "Cascade", "Change Log", +"Close all file list windows", +"Close all offline PM windows", +"Close all PM windows", +"Close all search windows", "Close disconnected", "Help &Contents\tF1", "DC++ discussion forum", @@ -832,6 +836,10 @@ "MenuArrange", "MenuCascade", "MenuChangelog", +"MenuCloseAllDirList", +"MenuCloseAllOfflinePm", +"MenuCloseAllPm", +"MenuCloseAllSearchframe", "MenuCloseDisconnected", "MenuContents", "MenuDiscuss", Modified: dcplusplus/trunk/client/StringDefs.h =================================================================== --- dcplusplus/trunk/client/StringDefs.h 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/client/StringDefs.h 2006-06-03 11:12:22 UTC (rev 609) @@ -230,6 +230,10 @@ MENU_ARRANGE, // "Arrange icons" MENU_CASCADE, // "Cascade" MENU_CHANGELOG, // "Change Log" + MENU_CLOSE_ALL_DIR_LIST, // "Close all file list windows" + MENU_CLOSE_ALL_OFFLINE_PM, // "Close all offline PM windows" + MENU_CLOSE_ALL_PM, // "Close all PM windows" + MENU_CLOSE_ALL_SEARCHFRAME, // "Close all search windows" MENU_CLOSE_DISCONNECTED, // "Close disconnected" MENU_CONTENTS, // "Help &Contents\tF1" MENU_DISCUSS, // "DC++ discussion forum" Modified: dcplusplus/trunk/client/Util.cpp =================================================================== --- dcplusplus/trunk/client/Util.cpp 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/client/Util.cpp 2006-06-03 11:12:22 UTC (rev 609) @@ -571,6 +571,38 @@ return (string::size_type)string::npos; } +wstring::size_type Util::findSubString(const wstring& aString, const wstring& aSubString, wstring::size_type pos) throw() { + if(aString.length() < pos) + return static_cast<wstring::size_type>(wstring::npos); + + if(aString.length() - pos < aSubString.length()) + return static_cast<wstring::size_type>(wstring::npos); + + if(aSubString.empty()) + return 0; + + wstring::size_type j = 0; + wstring::size_type end = aString.length() - aSubString.length() + 1; + + for(; pos < end; ++pos) { + if(Text::toLower(aString[pos]) == Text::toLower(aSubString[j])) { + wstring::size_type tmp = pos+1; + bool found = true; + for(++j; j < aSubString.length(); ++j, ++tmp) { + if(Text::toLower(aString[tmp]) != Text::toLower(aSubString[j])) { + j = 0; + found = false; + break; + } + } + + if(found) + return pos; + } + } + return static_cast<wstring::size_type>(wstring::npos); +} + int Util::stricmp(const char* a, const char* b) { while(*a) { wchar_t ca = 0, cb = 0; Modified: dcplusplus/trunk/client/Util.h =================================================================== --- dcplusplus/trunk/client/Util.h 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/client/Util.h 2006-06-03 11:12:22 UTC (rev 609) @@ -466,6 +466,7 @@ * @return First position found or string::npos */ static string::size_type findSubString(const string& aString, const string& aSubString, string::size_type start = 0) throw(); + static wstring::size_type findSubString(const wstring& aString, const wstring& aSubString, wstring::size_type start = 0) throw(); /* Utf-8 versions of strnicmp and stricmp, unicode char code order (!) */ static int stricmp(const char* a, const char* b); Modified: dcplusplus/trunk/help/changelog.html =================================================================== --- dcplusplus/trunk/help/changelog.html 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/help/changelog.html 2006-06-03 11:12:22 UTC (rev 609) @@ -26,17 +26,17 @@ <li>Fixed ADC hubname display (thanks ullner)</li> <li>Advanced TTH rollback no longer performed if tree is invalid (thanks garg)</li> <li>Option not to auto-disconnect favorite users (thanks ullner)</li> - <li>Fixed auto-disconnect delay (thanks uller)</li> + <li>Fixed auto-disconnect delay (thanks ullner)</li> <li>Another fix for opencow</li> <li>Fixed user command parameters not being remembered</li> <li>Fixed ADC op commands</li> - <li>[bug 464] Added option for masked password prompt (thanks ullner)</li> - <li>[bug 922] Updated help links (thanks xan)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=464">[bug 464]</a> Added option for masked password prompt (thanks ullner)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=922">[bug 922]</a> Updated help links (thanks xan)</li> <li>Fixed op count</li> - <li>[bug 230] Added settings to tray menu</li> - <li>[bug 403] Unfinished file lists deleted since they're never resumed anyway</li> - <li>[bug 639] Separated remove user from queue menu option</li> - <li>[bug 766] Fixed broken app titlebar</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=230">[bug 230]</a> Added settings to tray menu</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=403">[bug 403]</a> Unfinished file lists deleted since they're never resumed anyway</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=639">[bug 639]</a> Separated remove user from queue menu option</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=766">[bug 766]</a> Fixed broken app titlebar</li> <li>Removed support for generating NMDC-style file lists (old clients won't be able to download from you)</li> </ul> @@ -45,18 +45,18 @@ <li>Fixed displaying of available bytes when user list is off</li> <li>Fixed a potential crash when not showing user list</li> <li>Fixed 100% CPU bug on upload</li> - <li>[bug 853] Fixed missing function in opencow</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=853">[bug 853]</a> Fixed missing function in opencow</li> </ul> <h2>0.688 <span style="color: gray;">(2006-03-18)</span></h2> <ul> <li>Fixed public hubs sorting (thanks pothead)</li> <li>Fixed a ZPipe issue (thanks jove)</li> - <li>[bug 858] Fixed a 100% cpu / crash bug</li> - <li>[bug 872] Fixed a pm issue hopefully</li> - <li>[bug 812] Fixed pm's being sent to bots</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=858">[bug 858]</a> Fixed a 100% cpu / crash bug</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=872">[bug 872]</a> Fixed a pm issue hopefully</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=812">[bug 812]</a> Fixed pm's being sent to bots</li> <li>Files with invalid crc-32, as per their sfv file, are no longer shared</li> - <li>[bug 873] Added connect to hub option (thanks joakim tosteberg)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=873">[bug 873]</a> Added connect to hub option (thanks joakim tosteberg)</li> <li>Fixed an issue with linux file reading (thanks bart vullings and steven)</li> <li>Added back/forward mouse/keyboard navigation to directory listing frame</li> </ul> @@ -91,15 +91,15 @@ <li>Fixed "browse list" being available for NMDC users</li> <li>[ADC] Removed obsolete CI field</li> <li>Fixed missing upload progress</li> - <li>[bug 89] Readded dynamic compression disabling</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=89">[bug 89]</a> Readded dynamic compression disabling</li> <li>Added filelist download speed to filelist browser status bar</li> <li>Added advanced hublist filter (thanks trem)</li> - <li>[bug 579] Fixed 0-byte files not being created if directory doesn't exist</li> - <li>[bug 804] Cleaned up project files (thanks pothead)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=579">[bug 579]</a> Fixed 0-byte files not being created if directory doesn't exist</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=804">[bug 804]</a> Cleaned up project files (thanks pothead)</li> <li>Socket buffer size = 0 now means use system default</li> - <li>[bug 789] Fixed wrong nick being copied (thanks ullner)</li> - <li>[bug 794] [ADC] Fixed automatic reconnect (thanks ullner)</li> - <li>[bug 806] Fixed description for favorite hubs (thanks ullner)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=789">[bug 789]</a> Fixed wrong nick being copied (thanks ullner)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=794">[bug 794]</a> [ADC] Fixed automatic reconnect (thanks ullner)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=806">[bug 806]</a> Fixed description for favorite hubs (thanks ullner)</li> <li>Updated to latest ADC specs, this will break 0.68/0.681/0.6811 queue sources and fav users (for NMDC as well)</li> <li>Fixed a bufferedsocket crash</li> <li>[ADC] Fixed quitting user processing (thanks ullner)</li> @@ -110,8 +110,8 @@ <li>Fixed an issue with nick names disappearing from hub</li> <li>Added customizable maximum user count when autosearching</li> <li>Changed to open source version unicows for win9x users, perhaps this one will work better for you (see it as a last attempt; if it doesn't work, w9x support will be phased out completely unless someone else solves the win9x issues)</li> - <li>[bug 774] Fixed invalid description being sent if hub modifies it</li> - <li>[bug 818] Fixed default exit mnemonic</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=774">[bug 774]</a> Fixed invalid description being sent if hub modifies it</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=818">[bug 818]</a> Fixed default exit mnemonic</li> <li>Fixed some more crashes (thanks bigmuscle)</li> <li>Fixed some shutdown issues</li> <li>Updated country database</li> @@ -129,12 +129,12 @@ <li>Minor user command fix (thanks garg)</li> <li>Removed some duplicate code (thanks trem)</li> <li>Ctrl-a to select all items in a list (thanks garg)</li> - <li>[bug 484] Added a check for multiple refreshes running at the same time (thanks trem)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=484">[bug 484]</a> Added a check for multiple refreshes running at the same time (thanks trem)</li> <li>Fixed a few crashes here and there</li> <li>Fixed no-slots message not being sent out always</li> <li>Fixed yassl build locations (thanks pothead)</li> <li>Added ip resolve cache when searching (thanks trem)</li> - <li>[bug 413] Failed file moves are now reported to the system log</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=413">[bug 413]</a> Failed file moves are now reported to the system log</li> </ul> <h2>0.68 <span style="color: gray;">(2006-01-08)</span></h2> @@ -143,7 +143,7 @@ <li>Removed saving of directories scheduled for download, since the individual files should appear in the queue fast enough that this will rarely be used (since file lists are free and downloaded almost instantly)</li> <li>Fixed international timestamps (thanks ullner)</li> <li>Fixed targetdrive docs (thanks ullner)</li> - <li>[bug 485] Fixed transfer list view flicker on WinXP</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=485">[bug 485]</a> Fixed transfer list view flicker on WinXP</li> <li>New connection settings, please check settings page</li> <li>Connection type strings changed</li> <li>No longer falls back to passive mode on failed UPnP</li> @@ -151,35 +151,35 @@ <li>Removed some old favorite file format compatibility code</li> <li>Added country to search frame (thanks paka)</li> <li>Strftime fix (thanks garg)</li> - <li>[bug 521] Help instead of readme shown on first startup (thanks paka)</li> - <li>[bug 553] Minimize to tray and confirm appexit default to true (thanks paka)</li> - <li>[bug 452] Fixed example.xml language file generation (thanks tpo)</li> - <li>[bug 556] Fixed last searches purge (thanks sulan)</li> - <li>[bug 73] Added option to disconnect slow sources (thanks paka)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=521">[bug 521]</a> Help instead of readme shown on first startup (thanks paka)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=553">[bug 553]</a> Minimize to tray and confirm appexit default to true (thanks paka)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=452">[bug 452]</a> Fixed example.xml language file generation (thanks tpo)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=556">[bug 556]</a> Fixed last searches purge (thanks sulan)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=73">[bug 73]</a> Added option to disconnect slow sources (thanks paka)</li> <li>ADC hub counts updated correctly (thanks ullner)</li> - <li>[bug 325] Added error message when adding dupe fav hub (thanks ullner)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=325">[bug 325]</a> Added error message when adding dupe fav hub (thanks ullner)</li> <li>Updated bzip2 to 1.0.3 (thanks garg)</li> <li>Some small *nix fixes (thanks poison)</li> <li>Source path no longer saved for TTH enabled clients (saves memory and queue file space)</li> - <li>[bug 335] Search window settings saved automatically (thanks pothead)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=335">[bug 335]</a> Search window settings saved automatically (thanks pothead)</li> <li>Open folder selects file in explorer (thanks pothead)</li> <li>Local echo in pm window formatted as the other side should see it (thanks paka)</li> <li>Fixed debug assertion (thanks tpo)</li> <li>Dirty tabs settings improved (thanks ullner)</li> <li>ZLib upgraded to 1.2.3, possibly fixing security issues (thanks garg)</li> <li>Slot grants now last one connection instead of 10 minutes</li> - <li>[bug 632] Subtotals shown when selecting users in hub frame (thanks cologic)</li> - <li>[bug 625] /u chat command opens url (thanks pur)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=632">[bug 632]</a> Subtotals shown when selecting users in hub frame (thanks cologic)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=625">[bug 625]</a> /u chat command opens url (thanks pur)</li> <li>[NMDC] The first word of hub name is taken as short name for displaying purposes when space is limited</li> - <li>[bug 629] Waiting users frame added (thanks cologic)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=629">[bug 629]</a> Waiting users frame added (thanks cologic)</li> <li>Removed old versions check (thanks cologic)</li> - <li>[bug 635] Added option to limit maximum file list size to open (thanks paka)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=635">[bug 635]</a> Added option to limit maximum file list size to open (thanks paka)</li> <li>Filelist transfer logging default to off (thanks paka)</li> <li>Added some checks when creating fav hubs (thanks tpo)</li> <li>More settings screen updates (thanks ullner)</li> <li>Fixed linux file moving (thanks naga)</li> - <li>[bug 260] Added option to only download files with TTH (thanks ullner)</li> - <li>[bug 708] Fixed registry creation functions used (thanks ullner)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=260">[bug 260]</a> Added option to only download files with TTH (thanks ullner)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=708">[bug 708]</a> Fixed registry creation functions used (thanks ullner)</li> <li>Updated WTL</li> <li>Rewrote socket code to remove some old hacks and add some new (major change)</li> <li>Now using standard windows error messages for socket errors</li> @@ -197,12 +197,12 @@ <li>Improved hashing error reporting</li> <li>Fixed hash database rebuild</li> <li>Added /removefav command to remove a favorite hub (thanks ullner)</li> - <li>[bug 717] Fixed search combo box (thanks pothead)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=717">[bug 717]</a> Fixed search combo box (thanks pothead)</li> <li>Added option to change auto-refresh interval (thanks ullner)</li> - <li>[bug 740] Removed tab completion option (thanks ullner)</li> - <li>[bug 743] Added registry key creation failure notification (thanks ullner)</li> - <li>[bug 717] Fixed dropdown sizes (thanks pothead)</li> - <li>[bug 760] Fixed list subtraction issue (thanks cologic)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=740">[bug 740]</a> Removed tab completion option (thanks ullner)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=743">[bug 743]</a> Added registry key creation failure notification (thanks ullner)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=717">[bug 717]</a> Fixed dropdown sizes (thanks pothead)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=760">[bug 760]</a> Fixed list subtraction issue (thanks cologic)</li> <li>Added some right-to-left support, but it probably needs more work</li> <li>[NMDC] Minislots are no longer given to old DC++ clients (<0.304)</li> <li>[ADC] Directory size returned with search results</li> @@ -219,7 +219,7 @@ <li>Fixed context menu open for multi-screen setups (thanks trem)</li> <li>Changed country database to the original format so that users can update by themselves (thanks paka)</li> <li>Fixed some registry issues (thanks trem)</li> - <li>[bug 443] Fixed localised number encodings (thanks trem)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=443">[bug 443]</a> Fixed localised number encodings (thanks trem)</li> <li>Updated sorting to use a more windows-like order (thanks trem)</li> <li>Fixed an issue with restore all (thanks krzysztof tyszecki)</li> <li>Added list view tooltips</li> @@ -245,10 +245,10 @@ <h2>0.671 <span style="color: gray;">(2005-03-19)</span></h2> <ul> <li>Added possibility to set minislot size (thanks ullner)</li> - <li>[bug 22] Added possibility for multiline away messages and user commands (thanks ullner)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=22">[bug 22]</a> Added possibility for multiline away messages and user commands (thanks ullner)</li> <li>Added file type to queue frame (thanks ullner)</li> <li>Changed stats frame to use standard colors (thanks yoji)</li> - <li>[bug 439] Fixed purge button (thanks ullner)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=439">[bug 439]</a> Fixed purge button (thanks ullner)</li> <li>Fixed search frame only tth issue (thanks naga)</li> <li>Updated to ADC 0.9</li> <li>Fixed a crash bug (thanks trem)</li> @@ -264,8 +264,8 @@ <li>Basic ADC transfers now work</li> <li>Added option to specify bind address for sockets (thanks sed)</li> <li>Made the connection flood trigger slighly less sensitive</li> - <li>[bug 58] Fixed strange user list behaviour</li> - <li>[bug 83] Consolidated auto-open window options</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=58">[bug 58]</a> Fixed strange user list behaviour</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=83">[bug 83]</a> Consolidated auto-open window options</li> <li>Fixed some context menu stuff</li> </ul> @@ -274,30 +274,30 @@ <li>Fixed an issue with international formats of float numbers (also fixes UDP port setting)</li> <li>Fixed a minor crash log output address issue</li> <li>Split off color and sound to a new page (thanks ullner)</li> - <li>[bug 359] Fixed an issue with negative search terms (thanks naga)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=359">[bug 359]</a> Fixed an issue with negative search terms (thanks naga)</li> <li>Added option to filter TTH results in search spy (thanks joakim tosteberg)</li> - <li>[bug 184] Updated log functionality to allow users to customize log filenames (thanks naga)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=184">[bug 184]</a> Updated log functionality to allow users to customize log filenames (thanks naga)</li> <li>Fixes to log edit function (thanks naga)</li> <li>Added possibility to filter all searches without tth (thanks naga)</li> <li>More preferences splitting (thanks ullner)</li> <li>Small socket fix (thanks tremor)</li> <li>Search tab goes bold if set to (thanks naga)</li> <li>Hopefully fixed an UPnP crash</li> - <li>[bug 302] User commands in file lists (thanks joakim tosteberg)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=302">[bug 302]</a> User commands in file lists (thanks joakim tosteberg)</li> <li>ADC url's clickable (thanks naga)</li> <li>[Bug 117] Improved search timer to avoid spamming hub (thanks naga)</li> <li>Redid some of the hash storage code, should be slighly more efficient</li> - <li>[bug 94] Share is cached for faster startup</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=94">[bug 94]</a> Share is cached for faster startup</li> <li>Temporary targetnames are now filled in when download starts, not when item is added to queue, which makes temp target dir changes happen for current queue items as well, plus we get a huge memory save on huge queues.</li> - <li>[bug 363] Added "Remove All Sources" to queue (thanks izzzo & garg)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=363">[bug 363]</a> Added "Remove All Sources" to queue (thanks izzzo & garg)</li> <li>Queue menu items greyed out when there are no items (thanks izzzo)</li> <li>Fixed a crash with certain empty lists (thanks garg)</li> <li>Added "restore all" to undo "minimize all" (thanks guitarm)</li> <li>Added optional pm history (thanks trem and ullner)</li> <li>Better log file managment (thanks trem)</li> - <li>[bug 412] Fixed a queue count issue on removal (thanks ullner)</li> - <li>[bug 9] Fixed a queue move issue (thanks paka)</li> - <li>[bug 20] Fixed upload auto-slot granting (thanks naga)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=412">[bug 412]</a> Fixed a queue count issue on removal (thanks ullner)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=9">[bug 9]</a> Fixed a queue move issue (thanks paka)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=20">[bug 20]</a> Fixed upload auto-slot granting (thanks naga)</li> <li>Redid adl search to accomodate for partial list browsing (thanks garg)</li> <li>Added initial ADC file transfers support</li> <li>ADC hub connectivity improved</li> @@ -323,10 +323,10 @@ <li>Added exact file size to directory listings (thanks paka)</li> <li>Remove confirm fix (thanks trem)</li> <li>Added option for the new tab select behaviour (thanks trem)</li> - <li>[bug 116] Added possibility to download to temp folder on the same drive as target (thanks sed)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=116">[bug 116]</a> Added possibility to download to temp folder on the same drive as target (thanks sed)</li> <li>Fixed user command string for file list context (thanks sed)</li> - <li>[bug 290] Added more correct escaping of search strings (thanks sed)</li> - <li>[bug 432] Fixed download directory for adlsearch matches (thanks ullner)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=290">[bug 290]</a> Added more correct escaping of search strings (thanks sed)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=432">[bug 432]</a> Fixed download directory for adlsearch matches (thanks ullner)</li> <li>Some UPnP fixes (thanks nils maier)</li> <li>ADL Search byte prefix fixes, might screw up your adl search settings on first load (thanks ullner)</li> <li>Linux download path fix (thanks jens oknelid)</li> @@ -337,7 +337,7 @@ <h2>0.668 <span style="color: gray;">(2004-11-30)</span></h2> <ul> - <li>[bug 311] Fixed crash on open own filelist (thanks sulan)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=311">[bug 311]</a> Fixed crash on open own filelist (thanks sulan)</li> <li>Added option to make /join open a new window (thanks ullner)</li> <li>Added mailto: to link-clicking (thanks ullner)</li> <li>Fixed stack overflow with excessive xml nesting (thanks farcry)</li> @@ -347,9 +347,9 @@ <li>PgUp/PgDn now scroll the chat window (thanks jonathan stone)</li> <li>Small fix with line history (thanks jonathan stone)</li> <li>Added option to use separate TCP and UDP ports</li> - <li>[bug 303] Fixed a raw command guessing bug (thanks garg)</li> - <li>[bug 345] Fixed an xml listing parsing bug</li> - <li>[bug 309] Hopefully fixed nt4 startup</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=303">[bug 303]</a> Fixed a raw command guessing bug (thanks garg)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=345">[bug 345]</a> Fixed an xml listing parsing bug</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=309">[bug 309]</a> Hopefully fixed nt4 startup</li> <li>Hopefully fixed an issue with downloading international search results from old clients</li> </ul> @@ -358,9 +358,9 @@ <li>Improved multiple hublist support (thanks garg)</li> <li>Fixed some favdirs issues (thanks naga)</li> <li>Fixed a status logging issue (thanks naga)</li> - <li>[bug 289] Fixed annoying login issue</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=289">[bug 289]</a> Fixed annoying login issue</li> <li>Added possibility to rename shares (thanks naga and tremor)</li> - <li>[bug 106] Fixed show joins for fav users (thanks ullner)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=106">[bug 106]</a> Fixed show joins for fav users (thanks ullner)</li> <li>Fixed some unnecessary connects when download slots are full</li> <li>Fixed magnet registration issue (thanks garg)</li> <li>Some code documentation work (thanks jonathan jansson)</li> @@ -379,63 +379,63 @@ <h2>0.666 <span style="color: gray;">(2004-11-03)</span></h2> <ul> - <li>[bug 173] Fixed copy nick to clipboard (thanks trem)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=173">[bug 173]</a> Fixed copy nick to clipboard (thanks trem)</li> <li>Removed some old code (thanks garg)</li> <li>Added tth to log codes (thanks garg)</li> <li>Added # of locally filtered results to search frame (thanks garg)</li> <li>Fixed a crash in the upnp code</li> <li>Fixed wide formatting of time (thanks garg)</li> - <li>[bug 166] Added local filtering of searches with "-" in front of the search term (thanks cologic)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=166">[bug 166]</a> Added local filtering of searches with "-" in front of the search term (thanks cologic)</li> <li>Fixed a missing hubframe stats bug (thanks trem)</li> - <li>[bug 87] TTH's are now correctly searched for in search spy (thanks trem)</li> - <li>[bug 256] Fixed an issue with utf8 user commands (thanks trem)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=87">[bug 87]</a> TTH's are now correctly searched for in search spy (thanks trem)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=256">[bug 256]</a> Fixed an issue with utf8 user commands (thanks trem)</li> <li>Moved to a less intrusive build procedure where stlport and wtl are local to the DC++ build (see compile.txt)</li> <li>Added /log to show log for current hub / user (thanks garg)</li> <li>More internationalization (thanks garg)</li> <li>Updated some template code (thanks farcry)</li> <li>Extended log command (thanks ullner)</li> - <li>[bug 212] Fixed issue with utf-8 nicks during login to some hubs (thanks garg)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=212">[bug 212]</a> Fixed issue with utf-8 nicks during login to some hubs (thanks garg)</li> <li>Fixed issue with utf-8 time formatting for certain languages in certain locales</li> <li>Removed search optimisation obsoleted by tth's and bloom filters (those of you with a large number of files in your share, post on the forum if you notice any big increase in CPU usage)</li> - <li>[bug 69] Added option not to download files already in share (by TTH) (thanks TPO)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=69">[bug 69]</a> Added option not to download files already in share (by TTH) (thanks TPO)</li> <li>Help file work (garg, ullner)</li> <li>Added petabytes (PiB) (thanks garg)</li> <li>Clicking on active tab will deactivate it (thanks garg)</li> - <li>[bug 227] Fixed an issue with loading invalid virtual names when upgrading (thanks garg)</li> - <li>[bug 256] Fixed another issue with user commands (thanks garg)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=227">[bug 227]</a> Fixed an issue with loading invalid virtual names when upgrading (thanks garg)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=256">[bug 256]</a> Fixed another issue with user commands (thanks garg)</li> <li>Updated to WTL 7.5.4291</li> - <li>[bug 183] Hopefully fixed a few issues with w9x and Unicode</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=183">[bug 183]</a> Hopefully fixed a few issues with w9x and Unicode</li> <li>Fixed common control initialization</li> <li>Unix makefile now generates a shared lib (thanks jeremy huddleston)</li> <li>Slight memory save for hash database</li> - <li>[bug 130] Added favorite hub removal confirmation option (thanks ullner)</li> - <li>[bug 5] Fixed broken redirect (thanks garg)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=130">[bug 130]</a> Added favorite hub removal confirmation option (thanks ullner)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=5">[bug 5]</a> Fixed broken redirect (thanks garg)</li> <li>Added spy frame column saving (thanks garg)</li> <li>ADL Search autoqueue saved now (thanks garg)</li> <li>Window minimization issue fix (thanks garg)</li> - <li>[bug 129] Fixed some issues with downloading >4GiB files</li> - <li>[bug 15] ADL Search goto directory fixed (thanks garg)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=129">[bug 129]</a> Fixed some issues with downloading >4GiB files</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=15">[bug 15]</a> ADL Search goto directory fixed (thanks garg)</li> <li>Some fixes for compiling on osx (thanks jonathan jansson)</li> <li>Removed Makedefs in favour of a python script</li> <li>FastAlloc disabled in debug builds</li> - <li>[bug 266] Fixed a crash with offline users and user commands (thanks naga)</li> - <li>[bug 165] Fixed a case insensitivity issue (thanks farcry)</li> - <li>[bug 18] Added favorite download directories (thanks naga)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=266">[bug 266]</a> Fixed a crash with offline users and user commands (thanks naga)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=165">[bug 165]</a> Fixed a case insensitivity issue (thanks farcry)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=18">[bug 18]</a> Added favorite download directories (thanks naga)</li> <li>Fixed MyINFO spam when hashing</li> </ul> <h2>0.4034 <span style="color: gray;">(2004-10-03)</span></h2> <ul> <li>Help file additions (thanks naga & ullner)</li> - <li>[bug 170] Fixed a few issues with files not being hashed correctly (thanks garg)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=170">[bug 170]</a> Fixed a few issues with files not being hashed correctly (thanks garg)</li> <li>More ADC fixes (thanks sed)</li> <li>Fixed some ADLSearch stuff (thanks garg)</li> <li>Added item count to finished frames (thanks garg)</li> <li>Fixed user commands encoding (thanks garg)</li> <li>Added last search time to search spy (thanks ullner)</li> - <li>[bug 3] Fixed queue size growing on queue item move</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=3">[bug 3]</a> Fixed queue size growing on queue item move</li> <li>Fixed missing file list on 0 byte share</li> - <li>[bug 185] Fixed missing search results (thanks garg)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=185">[bug 185]</a> Fixed missing search results (thanks garg)</li> </ul> <h2>0.4033 <span style="color: gray;">(2004-09-27)</span></h2> @@ -452,7 +452,7 @@ <li>Fixed directory sorting in the file listings (thanks trem)</li> <li>Files that can't be moved to the target drive from the temp folder are now renamed to their real name</li> <li>Text with unix and mac line end encodings should now be correctly displayed</li> - <li>[bug 35] TTH Values are used for right click download menus when available</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=35">[bug 35]</a> TTH Values are used for right click download menus when available</li> <li>Upgraded to WTL 7.5.4196</li> <li>Updated license to allow others to release legal binaries compiled against WTL</li> <li>Moved the core structures to UTF-8 to allow correct internationalisation (major change)</li> @@ -462,7 +462,7 @@ <li>Removed autosearch string, it's not used any more</li> <li>Fixed a tth hash speed bug (hashing should be much faster now)</li> <li>File listings are now generated on the fly when someone needs them</li> - <li>[bug 127] Added UPnP support (thanks mark gillespie)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=127">[bug 127]</a> Added UPnP support (thanks mark gillespie)</li> <li>Ctrl-L now opens file lists (thanks garg)</li> <li>Various ADC patches (thanks sedulus)</li> <li>Slightly changed temporary download name</li> @@ -473,7 +473,7 @@ <li>Fixed a bug with autosearch repeating the same search needlessly (this should result in fewer autosearches, good for the hubs)</li> <li>Files scheduled for viewing are always set to highest prio</li> <li>Added rudimentary automake and autoconf support for the client part, perhaps this will encourage someone to finish a nice linux port</li> - <li>[bug 162] Fixed dupe usercommands on reconnect (thanks sed)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=162">[bug 162]</a> Fixed dupe usercommands on reconnect (thanks sed)</li> <li>Links now clickable in PM's and notepad as well (thanks naga)</li> <li>Files are no longer hashed if the shared directory is removed while hashing</li> <li>Added hash progress dialog, hashing is run at a higher priority when dialog is shown</li> @@ -481,7 +481,7 @@ <li>Better strategy for removing old filelists on exit (thanks garg)</li> <li>Added Geo-IP license and fixes (thanks garg)</li> <li>Added Help file - make sure you read it (thanks garg)</li> - <li>[bug 169] Fixed a memory leak with rollback buffers under certain conditions</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=169">[bug 169]</a> Fixed a memory leak with rollback buffers under certain conditions</li> <li>ADC INF updates only send the necessary info (thanks sed)</li> </ul> Modified: dcplusplus/trunk/help/gen_changelog.py =================================================================== --- dcplusplus/trunk/help/gen_changelog.py 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/help/gen_changelog.py 2006-06-03 11:12:22 UTC (rev 609) @@ -1,21 +1,14 @@ #!/usr/bin/env python - import os, re, cgi - - filetext = "../changelog.txt" - filehtml = "changelog.html" #os.rename(filehtml,"%s.old" % filehtml) fp_txt = open(filetext,'r') - fp_html = open(filehtml,'w') - - start_head = """<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> <html> <head> @@ -33,148 +26,85 @@ """ - - end_html = "</body>\n</html>" - - start_change = " <li>%(change)s" - +bug_text = " <li><a href=\"http://dcpp.net/bugzilla/show_bug.cgi?id=%(bug_id)s\">[bug %(bug_id)s]</a> %(change)s" change = " %(change)s" - end_change = "</li>\n" - - start_version = "<h2>%(version)s <span style=\"color: gray;\">(%(date)s)</span></h2>\n<ul>\n" - end_version = "</ul>\n\n" - - start_warning_end = " <li><span style=\"color: red;\">%(change)s</span></li>\n" - - new_version_pattern = re.compile("^.*?-- (?P<version>.*?) (?P<date>.*?) --") - -new_change = re.compile("^\* (?P<change>.*?)$") - +new_change = re.compile(r"^\* (?P<change>.*?)$") +bug_change = re.compile(r"^\* \[bug (?P<bug_id>\d+?)\] (?P<change>.*?)$") continue_change = re.compile("^\w*?(?P<change>.*?)$") - warning_change = re.compile("^(?P<change>[^ ].*?)$") - fp_html.write(start_head) - - open_change_state = False - close_version = False - start = False - - for line in fp_txt: - line = cgi.escape(line.strip()) - if not line: - if open_change_state: - fp_html.write(end_change) - open_change_state = False - continue - - mObj = new_version_pattern.match(line) - if mObj and mObj.groupdict()["date"] : - if close_version: - if open_change_state: - fp_html.write(end_change) - fp_html.write(end_version) - start = True - close_version = True - open_change_state = False - open_warning_state = False - fp_html.write(start_version % mObj.groupdict()) - continue - - if not start: - continue - + mObj = bug_change.match(line) + if mObj: + if open_change_state: + fp_html.write(end_change) + fp_html.write(bug_text % mObj.groupdict()) + open_change_state = True + continue mObj = new_change.match(line) - if mObj: # A new change is found: Close Open Warning or Changes. - if open_change_state: - fp_html.write(end_change) - fp_html.write(start_change % mObj.groupdict()) - open_change_state = True - continue - - mObj = continue_change.match(line) - if mObj and open_change_state: #A continutaion of an change (multiline change). - fp_html.write(change % mObj.groupdict()) - continue - - mObj = warning_change.match(line) - if mObj: - if open_change_state: - fp_html.write(end_change_state) - fp_html.write(start_warning_end % mObj.groupdict()) - continue - - if open_change_state: - fp_html.write(end_change) - if close_version: - fp_html.write(end_version) - fp_html.write(end_html) - fp_html.close() - -fp_txt.close() \ No newline at end of file +fp_txt.close() Modified: dcplusplus/trunk/windows/ADLSearchFrame.cpp =================================================================== --- dcplusplus/trunk/windows/ADLSearchFrame.cpp 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/windows/ADLSearchFrame.cpp 2006-06-03 11:12:22 UTC (rev 609) @@ -63,7 +63,6 @@ ctrlList.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_HSCROLL | WS_VSCROLL | LVS_REPORT | LVS_SHOWSELALWAYS, WS_EX_CLIENTEDGE, IDC_ADLLIST); ctrlList.SetExtendedListViewStyle(LVS_EX_LABELTIP | LVS_EX_HEADERDRAGDROP | LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT); - listContainer.SubclassWindow(ctrlList.m_hWnd); // Set background color ctrlList.SetBkColor(WinUtil::bgColor); @@ -197,18 +196,19 @@ } // Keyboard shortcuts -LRESULT ADLSearchFrame::onChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) +LRESULT ADLSearchFrame::onKeyDown(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { - switch(wParam) + NMLVKEYDOWN* kd = (NMLVKEYDOWN*) pnmh; + switch(kd->wVKey) { case VK_INSERT: - onAdd(0, 0, 0, bHandled); + PostMessage(WM_COMMAND, IDC_ADD, 0); break; case VK_DELETE: - onRemove(0, 0, 0, bHandled); + PostMessage(WM_COMMAND, IDC_REMOVE, 0); break; case VK_RETURN: - onEdit(0, 0, 0, bHandled); + PostMessage(WM_COMMAND, IDC_EDIT, 0); break; default: bHandled = FALSE; @@ -466,18 +466,15 @@ } // Double-click on list control -LRESULT ADLSearchFrame::onDoubleClickList(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) +LRESULT ADLSearchFrame::onDoubleClickList(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) { NMITEMACTIVATE* item = (NMITEMACTIVATE*)pnmh; - // Hit-test - LVHITTESTINFO info; - info.pt = item->ptAction; - int iItem = ctrlList.SubItemHitTest(&info); - if(iItem >= 0) - { + if(item->iItem >= 0) { // Treat as onEdit command - onEdit(0, 0, 0, bHandled); + PostMessage(WM_COMMAND, IDC_EDIT, 0); + } else if(item->iItem == -1) { + PostMessage(WM_COMMAND, IDC_ADD, 0); } return 0; Modified: dcplusplus/trunk/windows/ADLSearchFrame.h =================================================================== --- dcplusplus/trunk/windows/ADLSearchFrame.h 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/windows/ADLSearchFrame.h 2006-06-03 11:12:22 UTC (rev 609) @@ -34,8 +34,6 @@ #include "../client/ADLSearch.h" -#define ADLLIST_MESSAGE_MAP 6 - /////////////////////////////////////////////////////////////////////////////// // // Class that represent an ADL search manager interface @@ -49,7 +47,7 @@ typedef MDITabChildWindowImpl<ADLSearchFrame> baseClass; // Constructor/destructor - ADLSearchFrame() : listContainer(WC_LISTBOX, this, ADLLIST_MESSAGE_MAP) {} + ADLSearchFrame() {} virtual ~ADLSearchFrame() { } // Frame window declaration @@ -71,9 +69,8 @@ COMMAND_ID_HANDLER(IDC_MOVE_DOWN, onMoveDown) NOTIFY_HANDLER(IDC_ADLLIST, NM_DBLCLK, onDoubleClickList) NOTIFY_HANDLER(IDC_ADLLIST, LVN_ITEMCHANGED, onItemChanged) + NOTIFY_HANDLER(IDC_ADLLIST, LVN_KEYDOWN, onKeyDown) CHAIN_MSG_MAP(baseClass) - ALT_MSG_MAP(ADLLIST_MESSAGE_MAP) - MESSAGE_HANDLER(WM_KEYDOWN, onChar) END_MSG_MAP() // Message handlers @@ -88,6 +85,7 @@ LRESULT onMoveDown(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); LRESULT onDoubleClickList(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); LRESULT onItemChanged(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/); + LRESULT onKeyDown(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/); LRESULT onContextMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled); LRESULT onChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled); @@ -125,7 +123,6 @@ CButton ctrlMoveDown; CButton ctrlHelp; CMenu contextMenu; - CContainedWindow listContainer; // Column order enum Modified: dcplusplus/trunk/windows/DirectoryListingFrm.cpp =================================================================== --- dcplusplus/trunk/windows/DirectoryListingFrm.cpp 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/windows/DirectoryListingFrm.cpp 2006-06-03 11:12:22 UTC (rev 609) @@ -33,6 +33,7 @@ #include "../client/User.h" #include "../client/ClientManager.h" +DirectoryListingFrame::FrameMap DirectoryListingFrame::frames; int DirectoryListingFrame::columnIndexes[] = { COLUMN_FILENAME, COLUMN_TYPE, COLUMN_EXACTSIZE, COLUMN_SIZE, COLUMN_TTH }; int DirectoryListingFrame::columnSizes[] = { 300, 60, 100, 100, 200 }; @@ -55,6 +56,7 @@ frame->CreateEx(WinUtil::mdiClient); } frame->loadFile(aFile); + frames.insert( FramePair( frame->m_hWnd, frame ) ); } } @@ -71,6 +73,7 @@ frame->CreateEx(WinUtil::mdiClient); } frame->loadXML(txt); + frames.insert( FramePair( frame->m_hWnd, frame ) ); } } @@ -779,7 +782,7 @@ string target = SETTING(DOWNLOAD_DIRECTORY); try { dcassert(newId < (int)WinUtil::lastDirs.size()); - dl->download(dir, Text::fromT(WinUtil::lastDirs[newId]), (GetKeyState(VK_SHIFT) & 0x8000) > 0); + dl->download(dir, Text::fromT(WinUtil::lastDirs[newId]), WinUtil::isShift()); } catch(const Exception& e) { ctrlStatus.SetText(STATUS_TEXT, Text::toT(e.getError()).c_str()); } @@ -1080,3 +1083,8 @@ ClientManager::getInstance()->userCommand(dl->getUser(), uc, tmp, true); } } + +void DirectoryListingFrame::closeAll(){ + for(FrameIter i = frames.begin(); i != frames.end(); ++i) + i->second->PostMessage(WM_CLOSE, 0, 0); +} Modified: dcplusplus/trunk/windows/DirectoryListingFrm.h =================================================================== --- dcplusplus/trunk/windows/DirectoryListingFrm.h 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/windows/DirectoryListingFrm.h 2006-06-03 11:12:22 UTC (rev 609) @@ -44,6 +44,7 @@ public: static void openWindow(const tstring& aFile, const User::Ptr& aUser, int64_t aSpeed); static void openWindow(const User::Ptr& aUser, const string& txt, int64_t aSpeed); + static void closeAll(); typedef MDITabChildWindowImpl<DirectoryListingFrame, RGB(255, 0, 255)> baseClass; typedef UCHandler<DirectoryListingFrame> ucBase; @@ -163,6 +164,7 @@ LRESULT onClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { ctrlList.SetRedraw(FALSE); clearList(); + frames.erase(m_hWnd); WinUtil::saveHeaderOrder(ctrlList, SettingsManager::DIRECTORLISTINGFRAME_ORDER, SettingsManager::DIRECTORLISTINGFRAME_WIDTHS, COLUMN_LAST, columnIndexes, columnSizes); bHandled = FALSE; return 0; @@ -354,6 +356,12 @@ static int columnIndexes[COLUMN_LAST]; static int columnSizes[COLUMN_LAST]; + + typedef map< HWND , DirectoryListingFrame* > FrameMap; + typedef pair< HWND , DirectoryListingFrame* > FramePair; + typedef FrameMap::iterator FrameIter; + + static FrameMap frames; }; #endif // !defined(DIRECTORY_LISTING_FRM_H) Modified: dcplusplus/trunk/windows/FavoriteDirsPage.cpp =================================================================== --- dcplusplus/trunk/windows/FavoriteDirsPage.cpp 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/windows/FavoriteDirsPage.cpp 2006-06-03 11:12:22 UTC (rev 609) @@ -88,6 +88,33 @@ return 0; } +LRESULT FavoriteDirsPage::onKeyDown(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { + NMLVKEYDOWN* kd = (NMLVKEYDOWN*) pnmh; + switch(kd->wVKey) { + case VK_INSERT: + PostMessage(WM_COMMAND, IDC_ADD, 0); + break; + case VK_DELETE: + PostMessage(WM_COMMAND, IDC_REMOVE, 0); + break; + default: + bHandled = FALSE; + } + return 0; +} + +LRESULT FavoriteDirsPage::onDoubleClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) { + NMITEMACTIVATE* item = (NMITEMACTIVATE*)pnmh; + + if(item->iItem >= 0) { + PostMessage(WM_COMMAND, IDC_RENAME, 0); + } else if(item->iItem == -1) { + PostMessage(WM_COMMAND, IDC_ADD, 0); + } + + return 0; +} + LRESULT FavoriteDirsPage::onClickedAdd(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { tstring target; Modified: dcplusplus/trunk/windows/FavoriteDirsPage.h =================================================================== --- dcplusplus/trunk/windows/FavoriteDirsPage.h 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/windows/FavoriteDirsPage.h 2006-06-03 11:12:22 UTC (rev 609) @@ -44,6 +44,8 @@ MESSAGE_HANDLER(WM_HELP, onHelp) MESSAGE_HANDLER(WM_DROPFILES, onDropFiles) NOTIFY_HANDLER(IDC_FAVORITE_DIRECTORIES, LVN_ITEMCHANGED, onItemchangedDirectories) + NOTIFY_HANDLER(IDC_FAVORITE_DIRECTORIES, LVN_KEYDOWN, onKeyDown) + NOTIFY_HANDLER(IDC_FAVORITE_DIRECTORIES, NM_DBLCLK, onDoubleClick) COMMAND_ID_HANDLER(IDC_ADD, onClickedAdd) COMMAND_ID_HANDLER(IDC_REMOVE, onClickedRemove) COMMAND_ID_HANDLER(IDC_RENAME, onClickedRename) @@ -54,6 +56,8 @@ LRESULT onDropFiles(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); LRESULT onHelp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); LRESULT onItemchangedDirectories(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/); + LRESULT onKeyDown(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled); + LRESULT onDoubleClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/); LRESULT onClickedAdd(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); LRESULT onClickedRemove(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); LRESULT onClickedRename(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); Modified: dcplusplus/trunk/windows/FavoritesFrm.cpp =================================================================== --- dcplusplus/trunk/windows/FavoritesFrm.cpp 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/windows/FavoritesFrm.cpp 2006-06-03 11:12:22 UTC (rev 609) @@ -152,19 +152,35 @@ } LRESULT FavoriteHubsFrame::onDoubleClickHublist(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) { - if(!checkNick()) - return 0; - NMITEMACTIVATE* item = (NMITEMACTIVATE*) pnmh; - if(item->iItem != -1) { - FavoriteHubEntry* entry = (FavoriteHubEntry*)ctrlHubs.GetItemData(item->iItem); - HubFrame::openWindow(Text::toT(entry->getServer())); + if(item->iItem == -1) { + PostMessage(WM_COMMAND, IDC_NEWFAV, 0); + } else { + PostMessage(WM_COMMAND, IDC_CONNECT, 0); } return 0; } +LRESULT FavoriteHubsFrame::onKeyDown(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { + NMLVKEYDOWN* kd = (NMLVKEYDOWN*) pnmh; + switch(kd->wVKey) { + case VK_INSERT: + PostMessage(WM_COMMAND, IDC_NEWFAV, 0); + break; + case VK_DELETE: + PostMessage(WM_COMMAND, IDC_REMOVE, 0); + break; + case VK_RETURN: + PostMessage(WM_COMMAND, IDC_CONNECT, 0); + break; + default: + bHandled = FALSE; + } + return 0; +} + LRESULT FavoriteHubsFrame::onRemove(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { int i = -1; if(!BOOLSETTING(CONFIRM_HUB_REMOVAL) || MessageBox(CTSTRING(REALLY_REMOVE), _T(APPNAME) _T(" ") _T(VERSIONSTRING), MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDYES) { Modified: dcplusplus/trunk/windows/FavoritesFrm.h =================================================================== --- dcplusplus/trunk/windows/FavoritesFrm.h 2006-05-21 21:46:16 UTC (rev 608) +++ dcplusplus/trunk/windows/FavoritesFrm.h 2006-06-03 11:12:22 UTC (rev 609) @@ -52,14 +52,15 @@ COMMAND_ID_HANDLER(IDC_MOVE_DOWN, onMoveDown); // NOTIFY_HANDLER(IDC_HUBLIST, LVN_COLUMNCLICK, onColumnClickHublist) NOTIFY_HANDLER(IDC_HUBLIST, NM_DBLCLK, onDoubleClickHublist) - NOTIFY_HANDLER(IDC_HUBLIST, NM_RETURN, onEnter) + NOTIFY_HANDLER(IDC_HUBLIST, LVN_KEYDOWN, onKeyDown) NOTIFY_HANDLER(IDC_HUBLIST, LVN_ITEMCHANGED, onItemChanged... [truncated message content] |
From: <arn...@us...> - 2006-05-21 21:42:45
|
Revision: 607 Author: arnetheduck Date: 2006-05-21 14:42:27 -0700 (Sun, 21 May 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=607&view=rev Log Message: ----------- changelog... Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/help/changelog.html Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-05-21 08:53:55 UTC (rev 606) +++ dcplusplus/trunk/changelog.txt 2006-05-21 21:42:27 UTC (rev 607) @@ -1,4 +1,4 @@ --- -- +-- 0.69 2006-05-21 -- * Small linux / old gcc fixes (thanks jens oknelid) * Fixed an issue where client could be crashed from remote * Fixed an issue bad nicks could cause directories to be created in log / file list download folder Modified: dcplusplus/trunk/help/changelog.html =================================================================== --- dcplusplus/trunk/help/changelog.html 2006-05-21 08:53:55 UTC (rev 606) +++ dcplusplus/trunk/help/changelog.html 2006-05-21 21:42:27 UTC (rev 607) @@ -13,6 +13,33 @@ <h1>DC++ Changelog</h1> See the version history of DC++ below. +<h2>0.69 <span style="color: gray;">(2006-05-21)</span></h2> +<ul> + <li>Small linux / old gcc fixes (thanks jens oknelid)</li> + <li>Fixed an issue where client could be crashed from remote</li> + <li>Fixed an issue bad nicks could cause directories to be created in log / file list download folder</li> + <li>Changed autodrop default to 2 for fewer unexpected autodrops (thanks paka)</li> + <li>Saved users file more often to have fewer missing nicks around</li> + <li>CID of user shown if nick is missing (in queue for example)</li> + <li>Added display of CID in a few places</li> + <li>Updated yaSSL to 1.2.2</li> + <li>Fixed ADC hubname display (thanks ullner)</li> + <li>Advanced TTH rollback no longer performed if tree is invalid (thanks garg)</li> + <li>Option not to auto-disconnect favorite users (thanks ullner)</li> + <li>Fixed auto-disconnect delay (thanks uller)</li> + <li>Another fix for opencow</li> + <li>Fixed user command parameters not being remembered</li> + <li>Fixed ADC op commands</li> + <li>[bug 464] Added option for masked password prompt (thanks ullner)</li> + <li>[bug 922] Updated help links (thanks xan)</li> + <li>Fixed op count</li> + <li>[bug 230] Added settings to tray menu</li> + <li>[bug 403] Unfinished file lists deleted since they're never resumed anyway</li> + <li>[bug 639] Separated remove user from queue menu option</li> + <li>[bug 766] Fixed broken app titlebar</li> + <li>Removed support for generating NMDC-style file lists (old clients won't be able to download from you)</li> +</ul> + <h2>0.689 <span style="color: gray;">(2006-04-01)</span></h2> <ul> <li>Fixed displaying of available bytes when user list is off</li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-05-21 08:54:02
|
Revision: 606 Author: arnetheduck Date: 2006-05-21 01:53:55 -0700 (Sun, 21 May 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=606&view=rev Log Message: ----------- This is nicer Modified Paths: -------------- dcplusplus/trunk/client/UserConnection.h Modified: dcplusplus/trunk/client/UserConnection.h =================================================================== --- dcplusplus/trunk/client/UserConnection.h 2006-05-21 08:45:42 UTC (rev 605) +++ dcplusplus/trunk/client/UserConnection.h 2006-05-21 08:53:55 UTC (rev 606) @@ -242,7 +242,7 @@ void error(const string& aError) { send("$Error " + aError + '|'); } void listLen(const string& aLength) { send("$ListLen " + aLength + '|'); } void maxedOut() { isSet(FLAG_NMDC) ? send("$MaxedOut|") : send(AdcCommand(AdcCommand::SEV_RECOVERABLE, AdcCommand::ERROR_SLOTS_FULL, "Slots full")); } - void fileNotAvail(const std::string& msg = Util::emptyString) { isSet(FLAG_NMDC) ? send("$Error " + (msg.empty() ? FILE_NOT_AVAILABLE : msg) + "|") : send(AdcCommand(AdcCommand::SEV_RECOVERABLE, AdcCommand::ERROR_FILE_NOT_AVAILABLE, FILE_NOT_AVAILABLE)); } + void fileNotAvail(const std::string& msg = FILE_NOT_AVAILABLE) { isSet(FLAG_NMDC) ? send("$Error " + msg + "|") : send(AdcCommand(AdcCommand::SEV_RECOVERABLE, AdcCommand::ERROR_FILE_NOT_AVAILABLE, msg)); } // ADC Stuff void sup(const StringList& features) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-05-21 08:46:08
|
Revision: 605 Author: arnetheduck Date: 2006-05-21 01:45:42 -0700 (Sun, 21 May 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=605&view=rev Log Message: ----------- Bugfixes, removed nmdc file list support Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/CryptoManager.cpp dcplusplus/trunk/client/CryptoManager.h dcplusplus/trunk/client/QueueManager.cpp dcplusplus/trunk/client/ShareManager.cpp dcplusplus/trunk/client/ShareManager.h dcplusplus/trunk/client/UploadManager.cpp dcplusplus/trunk/client/UserConnection.h dcplusplus/trunk/windows/MainFrm.cpp dcplusplus/trunk/windows/MainFrm.h dcplusplus/trunk/windows/QueueFrame.cpp dcplusplus/trunk/windows/QueueFrame.h dcplusplus/trunk/windows/TransferView.cpp dcplusplus/trunk/windows/WinUtil.h dcplusplus/trunk/windows/main.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-05-20 16:17:09 UTC (rev 604) +++ dcplusplus/trunk/changelog.txt 2006-05-21 08:45:42 UTC (rev 605) @@ -17,6 +17,11 @@ * [bug 464] Added option for masked password prompt (thanks ullner) * [bug 922] Updated help links (thanks xan) * Fixed op count +* [bug 230] Added settings to tray menu +* [bug 403] Unfinished file lists deleted since they're never resumed anyway +* [bug 639] Separated remove user from queue menu option +* [bug 766] Fixed broken app titlebar +* Removed support for generating NMDC-style file lists (old clients won't be able to download from you) -- 0.689 2006-04-01 -- * Fixed displaying of available bytes when user list is off Modified: dcplusplus/trunk/client/CryptoManager.cpp =================================================================== --- dcplusplus/trunk/client/CryptoManager.cpp 2006-05-20 16:17:09 UTC (rev 604) +++ dcplusplus/trunk/client/CryptoManager.cpp 2006-05-21 08:45:42 UTC (rev 605) @@ -229,168 +229,3 @@ delete[] leaves; delete root; } - -/** - * Counts the occurances of each characters, and adds the total number of - * different characters to the end of the array. - */ -int CryptoManager::countChars(const string& aString, int* c, u_int8_t& csum) { - int chars = 0; - const u_int8_t* a = (const u_int8_t*)aString.data(); - string::size_type len = aString.length(); - for(string::size_type i=0; i<len; i++) { - - if(c[a[i]] == 0) - chars++; - - c[a[i]]++; - csum^=a[i]; - } - return chars; -} - -void CryptoManager::walkTree(list<Node*>& aTree) { - while(aTree.size() > 1) { - // Merge the first two nodes - Node* node = new Node(aTree.front(), *(++aTree.begin())); - aTree.pop_front(); - aTree.pop_front(); - - bool done = false; - for(list<Node*>::iterator i=aTree.begin(); i != aTree.end(); ++i) { - if(*node <= *(*i)) { - aTree.insert(i, node); - done = true; - break; - } - } - - if(!done) - aTree.push_back(node); - - } -} - -void CryptoManager::recurseLookup(vector<u_int8_t>* table, Node* node, vector<u_int8_t>& u_int8_ts) { - if(node->chr != -1) { - table[node->chr] = u_int8_ts; - return; - } - - u_int8_ts.push_back(0); - recurseLookup(table, node->left, u_int8_ts); - u_int8_ts.pop_back(); - - u_int8_ts.push_back(1); - recurseLookup(table, node->right, u_int8_ts); - u_int8_ts.pop_back(); -} - -/** - * Builds a table over the characters available (for fast lookup). - * Stores each character as a set of u_int8_ts with values {0, 1}. - */ -void CryptoManager::buildLookup(vector<u_int8_t>* table, Node* aRoot) { - vector<u_int8_t> left; - vector<u_int8_t> right; - - left.push_back(0); - right.push_back(1); - - recurseLookup(table, aRoot->left, left); - recurseLookup(table, aRoot->right, right); -} - - -struct greaterNode { - bool operator() (const Node* a, const Node* b) const { - return *a < *b; - } -}; - -/** - * Encodes a set of data with DC's version of huffman encoding.. - * @todo Use real streams maybe? or something else than string (operator[] contains a compare, slow...) - */ -void CryptoManager::encodeHuffman(const string& is, string& os) { - - // We might as well expect this much data as huffman encoding doesn't go very far... - os.reserve(is.size()); - if(is.length() == 0) { - os.append("HE3\x0d"); - - // Nada... - os.append(7, '\0'); - return; - } - // First, we count all characters - u_int8_t csum = 0; - int count[256]; - memset(count, 0, sizeof(count)); - int chars = countChars(is, count, csum); - - // Next, we create a set of nodes and add it to a list, removing all characters that never occur. - - list<Node*> nodes; - - int i; - for(i=0; i<256; i++) { - if(count[i] > 0) { - nodes.push_back(new Node(i, count[i])); - } - } - - nodes.sort(greaterNode()); -#ifdef _DEBUG - for(list<Node*>::iterator it = nodes.begin(); it != nodes.end(); ++it) dcdebug("%.02x:%d, ", (*it)->chr, (*it)->weight); - dcdebug("\n"); -#endif - - walkTree(nodes); - dcassert(nodes.size() == 1); - - Node* root = nodes.front(); - vector<u_int8_t> lookup[256]; - - // Build a lookup table for fast character lookups - buildLookup(lookup, root); - delete root; - - // Reserve some memory to avoid all those copies when appending... - os.reserve(is.size() * 3 / 4); - - os.append("HE3\x0d"); - - // Checksum - os.append(1, csum); - string::size_type sz = is.size(); - os.append((char*)&sz, 4); - - // Character count - os.append((char*)&chars, 2); - - // The characters and their bitlengths - for(i=0; i<256; i++) { - if(count[i] > 0) { - os.append(1, (u_int8_t)i); - os.append(1, (u_int8_t)lookup[i].size()); - } - } - - BitOutputStream bos(os); - // The tree itself, ie the bits of each character - for(i=0; i<256; i++) { - if(count[i] > 0) { - bos.put(lookup[i]); - } - } - - dcdebug("u_int8_ts: %lu\n", os.size()); - bos.skipToByte(); - - for(string::size_type j=0; j<is.size(); j++) { - dcassert(lookup[(u_int8_t)is[j]].size() != 0); - bos.put(lookup[(u_int8_t)is[j]]); - } - bos.skipToByte(); -} Modified: dcplusplus/trunk/client/CryptoManager.h =================================================================== --- dcplusplus/trunk/client/CryptoManager.h 2006-05-20 16:17:09 UTC (rev 604) +++ dcplusplus/trunk/client/CryptoManager.h 2006-05-21 08:45:42 UTC (rev 605) @@ -78,7 +78,6 @@ bool isExtended(const string& aLock) { return strncmp(aLock.c_str(), "EXTENDEDPROTOCOL", 16) == 0; } void decodeHuffman(const u_int8_t* /*is*/, string& /*os*/, const size_t /*len*/) throw(CryptoException); - void encodeHuffman(const string& is, string& os); void decodeBZ2(const u_int8_t* is, size_t sz, string& os) throw(CryptoException); private: Modified: dcplusplus/trunk/client/QueueManager.cpp =================================================================== --- dcplusplus/trunk/client/QueueManager.cpp 2006-05-20 16:17:09 UTC (rev 604) +++ dcplusplus/trunk/client/QueueManager.cpp 2006-05-21 08:45:42 UTC (rev 605) @@ -53,7 +53,7 @@ #include <fnmatch.h> #endif -const string QueueManager::USER_LIST_NAME = "MyList.DcLst"; +const string QueueManager::USER_LIST_NAME = "files.xml"; namespace { const string TEMP_EXTENSION = ".dctmp"; @@ -899,7 +899,7 @@ } } } else if(!aDownload->isSet(Download::FLAG_TREE_DOWNLOAD)) { - if(!aDownload->getTempTarget().empty() && aDownload->getTempTarget() != aDownload->getTarget()) { + if(!aDownload->getTempTarget().empty() && (aDownload->isSet(Download::FLAG_USER_LIST) || aDownload->getTempTarget() != aDownload->getTarget())) { File::deleteFile(aDownload->getTempTarget() + Download::ANTI_FRAG_EXT); File::deleteFile(aDownload->getTempTarget()); } Modified: dcplusplus/trunk/client/ShareManager.cpp =================================================================== --- dcplusplus/trunk/client/ShareManager.cpp 2006-05-20 16:17:09 UTC (rev 604) +++ dcplusplus/trunk/client/ShareManager.cpp 2006-05-21 08:45:42 UTC (rev 605) @@ -44,8 +44,8 @@ #include <limits> ShareManager::ShareManager() : hits(0), listLen(0), bzXmlListLen(0), - xmlDirty(true), nmdcDirty(false), refreshDirs(false), update(false), initial(true), listN(0), refreshing(0), lFile(NULL), - xFile(NULL), lastXmlUpdate(0), lastNmdcUpdate(0), lastFullUpdate(GET_TICK()), bloom(1<<20) + xmlDirty(true), refreshDirs(false), update(false), initial(true), listN(0), refreshing(0), lFile(NULL), + xFile(NULL), lastXmlUpdate(0), lastFullUpdate(GET_TICK()), bloom(1<<20) { SettingsManager::getInstance()->addListener(this); TimerManager::getInstance()->addListener(this); @@ -80,21 +80,11 @@ FindClose(hFind); } - hFind = FindFirstFile(Text::toT(Util::getConfigPath() + "MyList*.DcLst").c_str(), &data); - if(hFind != INVALID_HANDLE_VALUE) { - do { - File::deleteFile(Util::getAppPath() + Text::fromT(data.cFileName)); - } while(FindNextFile(hFind, &data)); - - FindClose(hFind); - } - #else DIR* dir = opendir(Util::getAppName().c_str()); if (dir) { while (struct dirent* ent = readdir(dir)) { - if (fnmatch("files*.xml.bz2", ent->d_name, 0) == 0 || - fnmatch("MyList*.DcLst", ent->d_name, 0) == 0) { + if (fnmatch("files*.xml.bz2", ent->d_name, 0) == 0) { File::deleteFile(Util::getConfigPath() + ent->d_name); } } @@ -121,21 +111,20 @@ if(i != tthIndex.end()) { return i->second->getADCPath(); } else { - throw ShareException("File Not Available"); + throw ShareException(UserConnection::FILE_NOT_AVAILABLE); } } string ShareManager::translateFileName(const string& aFile) throw(ShareException) { RLock<> l(cs); if(aFile == "MyList.DcLst") { - generateNmdcList(); - return getListFile(); + throw ShareException("NMDC-style lists no longer supported, please upgrade your client"); } else if(aFile == "files.xml.bz2" || aFile == "files.xml") { generateXmlList(); return getBZXmlFile(); } else { if(aFile.length() < 3) - throw ShareException("File Not Available"); + throw ShareException(UserConnection::FILE_NOT_AVAILABLE); string file; @@ -143,25 +132,25 @@ if(aFile.compare(0, 4, "TTH/") == 0) { file = translateTTH(aFile.substr(4)); } else if(aFile[0] != '/') { - throw ShareException("File Not Available"); + throw ShareException(UserConnection::FILE_NOT_AVAILABLE); } else { file = aFile; } string::size_type i = file.find('/', 1); if(i == string::npos) - throw ShareException("File Not Available"); + throw ShareException(UserConnection::FILE_NOT_AVAILABLE); RLock<> l(cs); StringPairIter j = lookupVirtual(file.substr(1, i-1)); if(j == virtualMap.end()) { - throw ShareException("File Not Available"); + throw ShareException(UserConnection::FILE_NOT_AVAILABLE); } file = file.substr(i + 1); Directory::File::Iter it; if(!checkFile(j->second, file, it)) { - throw ShareException("File Not Available"); + throw ShareException(UserConnection::FILE_NOT_AVAILABLE); } #ifdef _WIN32 @@ -193,13 +182,13 @@ } if(aFile.compare(0, 4, "TTH/") != 0) - throw ShareException("File Not Available"); + throw ShareException(UserConnection::FILE_NOT_AVAILABLE); RLock<> l(cs); TTHValue val(aFile.substr(4)); HashFileIter i = tthIndex.find(&val); if(i == tthIndex.end()) { - throw ShareException("File Not Available"); + throw ShareException(UserConnection::FILE_NOT_AVAILABLE); } Directory::File::Iter f = i->second; @@ -888,47 +877,7 @@ lastXmlUpdate = GET_TICK(); } } -void ShareManager::generateNmdcList() { - Lock l(listGenLock); - if(nmdcDirty && (lastNmdcUpdate + 15 * 60 * 1000 < GET_TICK() || lastNmdcUpdate < lastFullUpdate)) { - listN++; - try { - string tmp; - string tmp2; - string indent; - - for(Directory::MapIter i = directories.begin(); i != directories.end(); ++i) { - i->second->toNmdc(tmp, indent, tmp2); - } - - string newName = Util::getConfigPath() + "MyList" + Util::toString(listN) + ".DcLst"; - tmp2.clear(); - CryptoManager::getInstance()->encodeHuffman(tmp, tmp2); - File(newName, File::WRITE, File::CREATE | File::TRUNCATE).write(tmp2); - - if(lFile != NULL) { - delete lFile; - lFile = NULL; - File::deleteFile(getListFile()); - } - try { - File::renameFile(newName, Util::getConfigPath() + "MyList.DcLst"); - newName = Util::getConfigPath() + "MyList.DcLst"; - } catch(const FileException&) { - } - lFile = new File(newName, File::READ, File::OPEN); - setListFile(newName); - listLen = File::getSize(newName); - } catch(const Exception&) { - // No new file lists... - } - - nmdcDirty = false; - lastNmdcUpdate = GET_TICK(); - } -} - MemoryInputStream* ShareManager::generatePartialList(const string& dir, bool recurse) { if(dir[0] != '/' || dir[dir.size()-1] != '/') return NULL; Modified: dcplusplus/trunk/client/ShareManager.h =================================================================== --- dcplusplus/trunk/client/ShareManager.h 2006-05-20 16:17:09 UTC (rev 604) +++ dcplusplus/trunk/client/ShareManager.h 2006-05-21 08:45:42 UTC (rev 605) @@ -61,7 +61,7 @@ string translateFileName(const string& aFile) throw(ShareException); bool getTTH(const string& aFile, TTHValue& tth) throw(); void refresh(bool dirs = false, bool aUpdate = true, bool block = false) throw(ThreadException, ShareException); - void setDirty() { xmlDirty = nmdcDirty = true; } + void setDirty() { xmlDirty = true; } void search(SearchResult::List& l, const string& aString, int aSearchType, int64_t aSize, int aFileType, Client* aClient, StringList::size_type maxResults); void search(SearchResult::List& l, const StringList& params, StringList::size_type maxResults); @@ -81,9 +81,6 @@ string getShareSizeString() { return Util::toString(getShareSize()); } string getShareSizeString(const string& aDir) { return Util::toString(getShareSize(aDir)); } - int64_t getListLen() { return generateNmdcList(), listLen; } - string getListLenString() { return Util::toString(getListLen()); } - SearchManager::TypeModes getType(const string& fileName); string validateVirtual(const string& /*aVirt*/); @@ -260,7 +257,6 @@ TTHValue xmlRoot; bool xmlDirty; - bool nmdcDirty; bool refreshDirs; bool update; bool initial; @@ -273,7 +269,6 @@ File* xFile; u_int32_t lastXmlUpdate; - u_int32_t lastNmdcUpdate; u_int32_t lastFullUpdate; mutable RWLock<> cs; @@ -297,7 +292,6 @@ Directory* buildTree(const string& aName, Directory* aParent); void addTree(Directory* aDirectory); void addFile(Directory* dir, Directory::File::Iter i); - void generateNmdcList(); void generateXmlList(); bool loadCache(); Modified: dcplusplus/trunk/client/UploadManager.cpp =================================================================== --- dcplusplus/trunk/client/UploadManager.cpp 2006-05-20 16:17:09 UTC (rev 604) +++ dcplusplus/trunk/client/UploadManager.cpp 2006-05-21 08:45:42 UTC (rev 605) @@ -138,8 +138,8 @@ aSource->fileNotAvail(); return false; } - } catch(const ShareException&) { - aSource->fileNotAvail(); + } catch(const ShareException& e) { + aSource->fileNotAvail(e.getError()); return false; } @@ -409,7 +409,7 @@ } void UploadManager::on(GetListLength, UserConnection* conn) throw() { - conn->listLen(ShareManager::getInstance()->getListLenString()); + conn->listLen("42"); } void UploadManager::on(AdcCommand::GET, UserConnection* aSource, const AdcCommand& c) throw() { Modified: dcplusplus/trunk/client/UserConnection.h =================================================================== --- dcplusplus/trunk/client/UserConnection.h 2006-05-20 16:17:09 UTC (rev 604) +++ dcplusplus/trunk/client/UserConnection.h 2006-05-21 08:45:42 UTC (rev 605) @@ -242,7 +242,7 @@ void error(const string& aError) { send("$Error " + aError + '|'); } void listLen(const string& aLength) { send("$ListLen " + aLength + '|'); } void maxedOut() { isSet(FLAG_NMDC) ? send("$MaxedOut|") : send(AdcCommand(AdcCommand::SEV_RECOVERABLE, AdcCommand::ERROR_SLOTS_FULL, "Slots full")); } - void fileNotAvail() { isSet(FLAG_NMDC) ? send("$Error " + FILE_NOT_AVAILABLE + "|") : send(AdcCommand(AdcCommand::SEV_RECOVERABLE, AdcCommand::ERROR_FILE_NOT_AVAILABLE, FILE_NOT_AVAILABLE)); } + void fileNotAvail(const std::string& msg = Util::emptyString) { isSet(FLAG_NMDC) ? send("$Error " + (msg.empty() ? FILE_NOT_AVAILABLE : msg) + "|") : send(AdcCommand(AdcCommand::SEV_RECOVERABLE, AdcCommand::ERROR_FILE_NOT_AVAILABLE, FILE_NOT_AVAILABLE)); } // ADC Stuff void sup(const StringList& features) { Modified: dcplusplus/trunk/windows/MainFrm.cpp =================================================================== --- dcplusplus/trunk/windows/MainFrm.cpp 2006-05-20 16:17:09 UTC (rev 604) +++ dcplusplus/trunk/windows/MainFrm.cpp 2006-05-21 08:45:42 UTC (rev 605) @@ -959,6 +959,7 @@ mnuTrayMenu.AppendMenu(MF_STRING, IDC_TRAY_SHOW, CTSTRING(MENU_SHOW)); mnuTrayMenu.AppendMenu(MF_STRING, IDC_TRAY_QUIT, CTSTRING(MENU_EXIT)); mnuTrayMenu.AppendMenu(MF_STRING, IDC_OPEN_DOWNLOADS, CTSTRING(MENU_OPEN_DOWNLOADS_DIR)); + mnuTrayMenu.AppendMenu(MF_STRING, ID_FILE_SETTINGS, CTSTRING(MENU_SETTINGS)); GetCursorPos(&pt); SetForegroundWindow(m_hWnd); mnuTrayMenu.TrackPopupMenu(TPM_BOTTOMALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,pt.x,pt.y,m_hWnd); Modified: dcplusplus/trunk/windows/MainFrm.h =================================================================== --- dcplusplus/trunk/windows/MainFrm.h 2006-05-20 16:17:09 UTC (rev 604) +++ dcplusplus/trunk/windows/MainFrm.h 2006-05-21 08:45:42 UTC (rev 605) @@ -349,7 +349,6 @@ } links; HWND createToolbar(); - void buildMenu(); void updateTray(bool add = true); void autoConnect(const FavoriteHubEntry::List& fl); Modified: dcplusplus/trunk/windows/QueueFrame.cpp =================================================================== --- dcplusplus/trunk/windows/QueueFrame.cpp 2006-05-20 16:17:09 UTC (rev 604) +++ dcplusplus/trunk/windows/QueueFrame.cpp 2006-05-21 08:45:42 UTC (rev 605) @@ -1217,6 +1217,17 @@ return 0; } +void QueueFrame::onTab() { + if(showTree) { + HWND focus = ::GetFocus(); + if(focus == ctrlDirs.m_hWnd) { + ctrlQueue.SetFocus(); + } else if(focus == ctrlQueue.m_hWnd) { + ctrlDirs.SetFocus(); + } + } +} + void QueueFrame::updateQueue() { Lock l(cs); Modified: dcplusplus/trunk/windows/QueueFrame.h =================================================================== --- dcplusplus/trunk/windows/QueueFrame.h 2006-05-20 16:17:09 UTC (rev 604) +++ dcplusplus/trunk/windows/QueueFrame.h 2006-05-21 08:45:42 UTC (rev 605) @@ -133,16 +133,7 @@ return 0; } - void onTab() { - if(showTree) { - HWND focus = ::GetFocus(); - if(focus == ctrlDirs.m_hWnd) { - ctrlQueue.SetFocus(); - } else if(focus == ctrlQueue.m_hWnd) { - ctrlDirs.SetFocus(); - } - } - } + void onTab(); LRESULT onShowTree(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { bHandled = FALSE; Modified: dcplusplus/trunk/windows/TransferView.cpp =================================================================== --- dcplusplus/trunk/windows/TransferView.cpp 2006-05-20 16:17:09 UTC (rev 604) +++ dcplusplus/trunk/windows/TransferView.cpp 2006-05-21 08:45:42 UTC (rev 605) @@ -65,6 +65,7 @@ transferMenu.CreatePopupMenu(); appendUserItems(transferMenu); + transferMenu.AppendMenu(MF_SEPARATOR); transferMenu.AppendMenu(MF_STRING, IDC_FORCE, CTSTRING(FORCE_ATTEMPT)); transferMenu.AppendMenu(MF_STRING, IDC_COPY_NICK, CTSTRING(COPY_NICK)); transferMenu.AppendMenu(MF_SEPARATOR); Modified: dcplusplus/trunk/windows/WinUtil.h =================================================================== --- dcplusplus/trunk/windows/WinUtil.h 2006-05-20 16:17:09 UTC (rev 604) +++ dcplusplus/trunk/windows/WinUtil.h 2006-05-21 08:45:42 UTC (rev 605) @@ -124,8 +124,9 @@ menu.AppendMenu(MF_STRING, IDC_PRIVATEMESSAGE, CTSTRING(SEND_PRIVATE_MESSAGE)); menu.AppendMenu(MF_STRING, IDC_ADD_TO_FAVORITES, CTSTRING(ADD_TO_FAVORITES)); menu.AppendMenu(MF_STRING, IDC_GRANTSLOT, CTSTRING(GRANT_EXTRA_SLOT)); + menu.AppendMenu(MF_STRING, IDC_CONNECT, CTSTRING(CONNECT_FAVUSER_HUB)); + menu.AppendMenu(MF_SEPARATOR); menu.AppendMenu(MF_STRING, IDC_REMOVEALL, CTSTRING(REMOVE_FROM_ALL)); - menu.AppendMenu(MF_STRING, IDC_CONNECT, CTSTRING(CONNECT_FAVUSER_HUB)); } }; Modified: dcplusplus/trunk/windows/main.cpp =================================================================== --- dcplusplus/trunk/windows/main.cpp 2006-05-20 16:17:09 UTC (rev 604) +++ dcplusplus/trunk/windows/main.cpp 2006-05-21 08:45:42 UTC (rev 605) @@ -266,7 +266,8 @@ } } - if(wndMain.CreateEx(NULL, rc, 0, WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_WINDOWEDGE) == NULL) { + int rtl = ResourceManager::getInstance()->isRTL() ? WS_EX_RTLREADING : 0; + if(wndMain.CreateEx(NULL, rc, 0, rtl | WS_EX_APPWINDOW | WS_EX_WINDOWEDGE) == NULL) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-05-20 16:17:29
|
Revision: 604 Author: arnetheduck Date: 2006-05-20 09:17:09 -0700 (Sat, 20 May 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=604&view=rev Log Message: ----------- Bugfixes, patches Modified Paths: -------------- dcplusplus/trunk/Example.xml dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/AdcHub.cpp dcplusplus/trunk/client/ClientManager.h dcplusplus/trunk/client/NmdcHub.cpp dcplusplus/trunk/client/SettingsManager.cpp dcplusplus/trunk/client/SettingsManager.h dcplusplus/trunk/client/StringDefs.cpp dcplusplus/trunk/client/StringDefs.h dcplusplus/trunk/windows/HubFrame.cpp dcplusplus/trunk/windows/MainFrm.cpp dcplusplus/trunk/windows/QueueFrame.cpp dcplusplus/trunk/windows/QueueFrame.h dcplusplus/trunk/windows/WindowsPage.cpp Modified: dcplusplus/trunk/Example.xml =================================================================== --- dcplusplus/trunk/Example.xml 2006-05-15 21:53:14 UTC (rev 603) +++ dcplusplus/trunk/Example.xml 2006-05-20 16:17:09 UTC (rev 604) @@ -462,6 +462,7 @@ <String Name="SettingsPopupOffline">Open private messages from offline users in their own window</String> <String Name="SettingsPopupPms">Open private messages in their own window</String> <String Name="SettingsPorts">Ports</String> + <String Name="SettingsPromptPassword">Popup box to input password for hubs</String> <String Name="SettingsPublicHubList">Public Hubs list</String> <String Name="SettingsPublicHubListHttpProxy">HTTP Proxy (for hublist only)</String> <String Name="SettingsPublicHubListUrl">Public Hubs list URL</String> Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-05-15 21:53:14 UTC (rev 603) +++ dcplusplus/trunk/changelog.txt 2006-05-20 16:17:09 UTC (rev 604) @@ -14,6 +14,9 @@ * Another fix for opencow * Fixed user command parameters not being remembered * Fixed ADC op commands +* [bug 464] Added option for masked password prompt (thanks ullner) +* [bug 922] Updated help links (thanks xan) +* Fixed op count -- 0.689 2006-04-01 -- * Fixed displaying of available bytes when user list is off Modified: dcplusplus/trunk/client/AdcHub.cpp =================================================================== --- dcplusplus/trunk/client/AdcHub.cpp 2006-05-15 21:53:14 UTC (rev 603) +++ dcplusplus/trunk/client/AdcHub.cpp 2006-05-20 16:17:09 UTC (rev 604) @@ -140,6 +140,7 @@ if(u->getUser() == ClientManager::getInstance()->getMe()) { state = STATE_NORMAL; setMyIdentity(u->getIdentity()); + updateCounts(false); } fire(ClientListener::UserUpdated(), this, *u); } Modified: dcplusplus/trunk/client/ClientManager.h =================================================================== --- dcplusplus/trunk/client/ClientManager.h 2006-05-15 21:53:14 UTC (rev 603) +++ dcplusplus/trunk/client/ClientManager.h 2006-05-20 16:17:09 UTC (rev 604) @@ -93,15 +93,6 @@ Client::List& getClients() { return clients; } - void removeClientListener(ClientListener* listener) { - Lock l(cs); - Client::Iter endIt = clients.end(); - for(Client::Iter it = clients.begin(); it != endIt; ++it) { - Client* client = *it; - client->removeListener(listener); - } - } - string getCachedIp() const { Lock l(cs); return cachedIp; } CID getMyCID(); Modified: dcplusplus/trunk/client/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/client/NmdcHub.cpp 2006-05-15 21:53:14 UTC (rev 603) +++ dcplusplus/trunk/client/NmdcHub.cpp 2006-05-20 16:17:09 UTC (rev 604) @@ -603,7 +603,9 @@ continue; OnlineUser& ou = getUser(*it); ou.getIdentity().setOp(true); - v.push_back(&getUser(*it)); + if(*it == getMyNick()) + getMyIdentity().setOp(true); + v.push_back(&ou); } fire(ClientListener::UsersUpdated(), this, v); Modified: dcplusplus/trunk/client/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/client/SettingsManager.cpp 2006-05-15 21:53:14 UTC (rev 603) +++ dcplusplus/trunk/client/SettingsManager.cpp 2006-05-20 16:17:09 UTC (rev 604) @@ -73,7 +73,7 @@ "NoIpOverride", "SearchOnlyFreeSlots", "LastSearchType", "BoldFinishedDownloads", "BoldFinishedUploads", "BoldQueue", "BoldHub", "BoldPm", "BoldSearch", "SocketInBuffer", "SocketOutBuffer", "OnlyDlTthFiles", "OpenWaitingUsers", "BoldWaitingUsers", "OpenSystemLog", "BoldSystemLog", "AutoRefreshTime", - "UseSsl", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", + "UseSsl", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", "PromptPassword", "SENTRY", // Int64 "TotalUpload", "TotalDownload", @@ -256,6 +256,7 @@ setDefault(AUTO_SEARCH_LIMIT, 5); setDefault(ALT_SORT_ORDER, false); setDefault(AUTO_KICK_NO_FAVS, false); + setDefault(PROMPT_PASSWORD, false); #ifdef _WIN32 setDefault(MAIN_WINDOW_STATE, SW_SHOWNORMAL); Modified: dcplusplus/trunk/client/SettingsManager.h =================================================================== --- dcplusplus/trunk/client/SettingsManager.h 2006-05-15 21:53:14 UTC (rev 603) +++ dcplusplus/trunk/client/SettingsManager.h 2006-05-20 16:17:09 UTC (rev 604) @@ -89,7 +89,7 @@ NO_IP_OVERRIDE, SEARCH_ONLY_FREE_SLOTS, LAST_SEARCH_TYPE, BOLD_FINISHED_DOWNLOADS, BOLD_FINISHED_UPLOADS, BOLD_QUEUE, BOLD_HUB, BOLD_PM, BOLD_SEARCH, SOCKET_IN_BUFFER, SOCKET_OUT_BUFFER, ONLY_DL_TTH_FILES, OPEN_WAITING_USERS, BOLD_WAITING_USERS, OPEN_SYSTEM_LOG, BOLD_SYSTEM_LOG, AUTO_REFRESH_TIME, - USE_SSL, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, + USE_SSL, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, PROMPT_PASSWORD, INT_LAST }; enum Int64Setting { INT64_FIRST = INT_LAST + 1, Modified: dcplusplus/trunk/client/StringDefs.cpp =================================================================== --- dcplusplus/trunk/client/StringDefs.cpp 2006-05-15 21:53:14 UTC (rev 603) +++ dcplusplus/trunk/client/StringDefs.cpp 2006-05-20 16:17:09 UTC (rev 604) @@ -463,6 +463,7 @@ "Open private messages from offline users in their own window", "Open private messages in their own window", "Ports", +"Popup box to input password for hubs", "Public Hubs list", "HTTP Proxy (for hublist only)", "Public Hubs list URL", @@ -1067,6 +1068,7 @@ "SettingsPopupOffline", "SettingsPopupPms", "SettingsPorts", +"SettingsPromptPassword", "SettingsPublicHubList", "SettingsPublicHubListHttpProxy", "SettingsPublicHubListUrl", Modified: dcplusplus/trunk/client/StringDefs.h =================================================================== --- dcplusplus/trunk/client/StringDefs.h 2006-05-15 21:53:14 UTC (rev 603) +++ dcplusplus/trunk/client/StringDefs.h 2006-05-20 16:17:09 UTC (rev 604) @@ -466,6 +466,7 @@ SETTINGS_POPUP_OFFLINE, // "Open private messages from offline users in their own window" SETTINGS_POPUP_PMS, // "Open private messages in their own window" SETTINGS_PORTS, // "Ports" + SETTINGS_PROMPT_PASSWORD, // "Popup box to input password for hubs" SETTINGS_PUBLIC_HUB_LIST, // "Public Hubs list" SETTINGS_PUBLIC_HUB_LIST_HTTP_PROXY, // "HTTP Proxy (for hublist only)" SETTINGS_PUBLIC_HUB_LIST_URL, // "Public Hubs list URL" Modified: dcplusplus/trunk/windows/HubFrame.cpp =================================================================== --- dcplusplus/trunk/windows/HubFrame.cpp 2006-05-15 21:53:14 UTC (rev 603) +++ dcplusplus/trunk/windows/HubFrame.cpp 2006-05-20 16:17:09 UTC (rev 604) @@ -482,10 +482,24 @@ client->password(client->getPassword()); addClientLine(TSTRING(STORED_PASSWORD_SENT)); } else { - ctrlMessage.SetWindowText(_T("/password ")); - ctrlMessage.SetFocus(); - ctrlMessage.SetSel(10, 10); - waitingForPW = true; + if(!BOOLSETTING(PROMPT_PASSWORD)) { + ctrlMessage.SetWindowText(_T("/password ")); + ctrlMessage.SetFocus(); + ctrlMessage.SetSel(10, 10); + waitingForPW = true; + } else { + LineDlg linePwd; + linePwd.title = CTSTRING(ENTER_PASSWORD); + linePwd.description = CTSTRING(ENTER_PASSWORD); + linePwd.password = true; + if(linePwd.DoModal(m_hWnd) == IDOK) { + client->setPassword(Text::fromT(linePwd.line)); + client->password(Text::fromT(linePwd.line)); + waitingForPW = false; + } else { + client->disconnect(true); + } + } } } else if(task->speaker == PRIVATE_MESSAGE) { PMTask& pm = *static_cast<PMTask*>(task); Modified: dcplusplus/trunk/windows/MainFrm.cpp =================================================================== --- dcplusplus/trunk/windows/MainFrm.cpp 2006-05-15 21:53:14 UTC (rev 603) +++ dcplusplus/trunk/windows/MainFrm.cpp 2006-05-20 16:17:09 UTC (rev 604) @@ -57,15 +57,15 @@ { memset(statusSizes, 0, sizeof(statusSizes)); - links.homepage = _T("http://dcplusplus.sourceforge.net/"); + links.homepage = _T("http://dcpp.net/"); links.downloads = links.homepage + _T("download/"); links.geoipfile = _T("http://www.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip"); links.translations = _T("http://sourceforge.net/tracker/?atid=460289&group_id=40287"); - links.faq = links.homepage + _T("faq/faq.php?list=all&prog=1&lang=en"); + links.faq = links.homepage + _T("faq/"); links.help = links.homepage + _T("forum/"); links.discuss = links.homepage + _T("forum/"); - links.features = links.homepage + _T("bugs/"); - links.bugs = links.homepage + _T("bugs/"); + links.features = links.homepage + _T("bugzilla/"); + links.bugs = links.homepage + _T("bugzilla/"); } MainFrame::~MainFrame() { Modified: dcplusplus/trunk/windows/QueueFrame.cpp =================================================================== --- dcplusplus/trunk/windows/QueueFrame.cpp 2006-05-15 21:53:14 UTC (rev 603) +++ dcplusplus/trunk/windows/QueueFrame.cpp 2006-05-20 16:17:09 UTC (rev 604) @@ -1241,6 +1241,15 @@ updateStatus(); } +void QueueFrame::clearTree(HTREEITEM item) { + HTREEITEM next = ctrlDirs.GetChildItem(item); + while(next != NULL) { + clearTree(next); + next = ctrlDirs.GetNextSiblingItem(next); + } + delete (tstring*)ctrlDirs.GetItemData(item); +} + // Put it here to avoid a copy for each recursion... static TCHAR tmpBuf[1024]; void QueueFrame::moveNode(HTREEITEM item, HTREEITEM parent) { Modified: dcplusplus/trunk/windows/QueueFrame.h =================================================================== --- dcplusplus/trunk/windows/QueueFrame.h 2006-05-15 21:53:14 UTC (rev 603) +++ dcplusplus/trunk/windows/QueueFrame.h 2006-05-20 16:17:09 UTC (rev 604) @@ -389,14 +389,7 @@ void moveNode(HTREEITEM item, HTREEITEM parent); - void clearTree(HTREEITEM item) { - HTREEITEM next = ctrlDirs.GetChildItem(item); - while(next != NULL) { - clearTree(next); - next = ctrlDirs.GetNextSiblingItem(next); - } - delete (tstring*)ctrlDirs.GetItemData(item); - } + void clearTree(HTREEITEM item); void removeSelected() { if(!BOOLSETTING(CONFIRM_ITEM_REMOVAL) || MessageBox(CTSTRING(REALLY_REMOVE), _T(APPNAME) _T(" ") _T(VERSIONSTRING), MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDYES) Modified: dcplusplus/trunk/windows/WindowsPage.cpp =================================================================== --- dcplusplus/trunk/windows/WindowsPage.cpp 2006-05-15 21:53:14 UTC (rev 603) +++ dcplusplus/trunk/windows/WindowsPage.cpp 2006-05-20 16:17:09 UTC (rev 604) @@ -58,6 +58,7 @@ { SettingsManager::JOIN_OPEN_NEW_WINDOW, ResourceManager::SETTINGS_OPEN_NEW_WINDOW }, { SettingsManager::IGNORE_OFFLINE, ResourceManager::SETTINGS_IGNORE_OFFLINE }, { SettingsManager::TOGGLE_ACTIVE_WINDOW, ResourceManager::SETTINGS_TOGGLE_ACTIVE_WINDOW }, + { SettingsManager::PROMPT_PASSWORD, ResourceManager::SETTINGS_PROMPT_PASSWORD }, { 0, ResourceManager::SETTINGS_AUTO_AWAY } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-05-15 21:53:37
|
Revision: 603 Author: arnetheduck Date: 2006-05-15 14:53:14 -0700 (Mon, 15 May 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=603&view=rev Log Message: ----------- User command fixes Modified Paths: -------------- dcplusplus/trunk/Example.xml dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/AdcHub.cpp dcplusplus/trunk/client/ClientManager.cpp dcplusplus/trunk/client/FavoriteManager.cpp dcplusplus/trunk/client/User.cpp dcplusplus/trunk/client/User.h dcplusplus/trunk/windows/DirectoryListingFrm.cpp dcplusplus/trunk/windows/DirectoryListingFrm.h dcplusplus/trunk/windows/HubFrame.cpp dcplusplus/trunk/windows/HubFrame.h dcplusplus/trunk/windows/PrivateFrame.cpp dcplusplus/trunk/windows/PrivateFrame.h dcplusplus/trunk/windows/SearchFrm.cpp dcplusplus/trunk/windows/SearchFrm.h dcplusplus/trunk/windows/SingleInstance.h dcplusplus/trunk/windows/TransferView.cpp dcplusplus/trunk/windows/TransferView.h Modified: dcplusplus/trunk/Example.xml =================================================================== --- dcplusplus/trunk/Example.xml 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/Example.xml 2006-05-15 21:53:14 UTC (rev 603) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> -<Language Name="Example Language" Author="arnetheduck" Version="0.689" Revision="1" RightToLeft="0"> +<Language Name="Example Language" Author="arnetheduck" Version="0.69" Revision="1" RightToLeft="0"> <Strings> <String Name="Active">Active</String> <String Name="ActiveSearchString">Enabled / Search String</String> Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/changelog.txt 2006-05-15 21:53:14 UTC (rev 603) @@ -11,6 +11,9 @@ * Advanced TTH rollback no longer performed if tree is invalid (thanks garg) * Option not to auto-disconnect favorite users (thanks ullner) * Fixed auto-disconnect delay (thanks uller) +* Another fix for opencow +* Fixed user command parameters not being remembered +* Fixed ADC op commands -- 0.689 2006-04-01 -- * Fixed displaying of available bytes when user list is off Modified: dcplusplus/trunk/client/AdcHub.cpp =================================================================== --- dcplusplus/trunk/client/AdcHub.cpp 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/client/AdcHub.cpp 2006-05-15 21:53:14 UTC (rev 603) @@ -336,9 +336,9 @@ short port = secure ? ConnectionManager::getInstance()->getSecurePort() : ConnectionManager::getInstance()->getPort(); if(ClientManager::getInstance()->isActive()) { - send(AdcCommand(AdcCommand::CMD_CTM, user.getSID()).addParam(proto).addParam(Util::toString(port)).addParam(token)); + send(AdcCommand(AdcCommand::CMD_CTM, user.getIdentity().getSID()).addParam(proto).addParam(Util::toString(port)).addParam(token)); } else { - send(AdcCommand(AdcCommand::CMD_RCM, user.getSID()).addParam(proto)); + send(AdcCommand(AdcCommand::CMD_RCM, user.getIdentity().getSID()).addParam(proto)); } } @@ -357,7 +357,7 @@ void AdcHub::privateMessage(const OnlineUser& user, const string& aMessage) { if(state != STATE_NORMAL) return; - send(AdcCommand(AdcCommand::CMD_MSG, user.getSID()).addParam(aMessage).addParam("PM", getMySID())); + send(AdcCommand(AdcCommand::CMD_MSG, user.getIdentity().getSID()).addParam(aMessage).addParam("PM", getMySID())); } void AdcHub::search(int aSizeMode, int64_t aSize, int aFileType, const string& aString, const string& aToken) { Modified: dcplusplus/trunk/client/ClientManager.cpp =================================================================== --- dcplusplus/trunk/client/ClientManager.cpp 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/client/ClientManager.cpp 2006-05-15 21:53:14 UTC (rev 603) @@ -316,7 +316,7 @@ if(cmd.getType() == AdcCommand::TYPE_UDP && !u->getIdentity().isUdpActive()) { cmd.setType(AdcCommand::TYPE_DIRECT); } - cmd.setTo(u->getSID()); + cmd.setTo(u->getIdentity().getSID()); u->getClient().send(cmd); } } @@ -404,7 +404,7 @@ if(i != onlineUsers.end()) { return i->second->getIdentity(); } - return Identity(aUser, Util::emptyString); + return Identity(aUser, Util::emptyString, 0); } void ClientManager::search(int aSizeMode, int64_t aSize, int aFileType, const string& aString, const string& aToken) { Modified: dcplusplus/trunk/client/FavoriteManager.cpp =================================================================== --- dcplusplus/trunk/client/FavoriteManager.cpp 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/client/FavoriteManager.cpp 2006-05-15 21:53:14 UTC (rev 603) @@ -408,11 +408,10 @@ // Add ADC standard op commands static const char adc_disconnectstr[] = - "HDSC %[mycid] %[cid] DI ND Friendly\\ disconnect\n"; + "HDSC %[userSID]\n"; addUserCommand(UserCommand::TYPE_RAW_ONCE, UserCommand::CONTEXT_CHAT | UserCommand::CONTEXT_SEARCH, UserCommand::FLAG_NOSAVE, STRING(DISCONNECT_USER), adc_disconnectstr, "adc://op"); - try { SimpleXML xml; xml.fromXML(File(getConfigFile(), File::READ, File::OPEN).read()); @@ -600,11 +599,11 @@ } UserCommand::List FavoriteManager::getUserCommands(int ctx, const StringList& hubs) { - bool isOp = false; - for(StringIterC i = hubs.begin(); i != hubs.end(); ++i) { - if(ClientManager::getInstance()->isOp(ClientManager::getInstance()->getMe(), *i)) { - isOp = true; - break; + vector<bool> isOp(hubs.size()); + + for(size_t i = 0; i < hubs.size(); ++i) { + if(ClientManager::getInstance()->isOp(ClientManager::getInstance()->getMe(), hubs[i])) { + isOp[i] = true; } } @@ -612,14 +611,32 @@ UserCommand::List lst; for(UserCommand::Iter i = userCommands.begin(); i != userCommands.end(); ++i) { UserCommand& uc = *i; - if( (uc.getCtx() & ctx) && - ( uc.getHub().empty() || - (uc.getHub() == "op" && isOp) || - (find_if(hubs.begin(), hubs.end(), bind1st(equal_to<string>(), uc.getHub())) != hubs.end()) - ) ) - { - lst.push_back(*i); + if(!(uc.getCtx() & ctx)) { + continue; } + + for(size_t j = 0; j < hubs.size(); ++j) { + const string& hub = hubs[j]; + bool hubAdc = hub.compare(0, 6, "adc://") == 0; + bool commandAdc = uc.getHub().compare(0, 6, "adc://") == 0; + if(hubAdc && commandAdc) { + if((uc.getHub().length() == 6) || + (uc.getHub() == "adc://op" && isOp[j]) || + (uc.getHub() == hub) ) + { + lst.push_back(*i); + break; + } + } else if(!hubAdc && !commandAdc) { + if((uc.getHub().length() == 0) || + (uc.getHub() == "op" && isOp[j]) || + (uc.getHub() == hub) ) + { + lst.push_back(*i); + break; + } + } + } } return lst; } Modified: dcplusplus/trunk/client/User.cpp =================================================================== --- dcplusplus/trunk/client/User.cpp 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/client/User.cpp 2006-05-15 21:53:14 UTC (rev 603) @@ -23,7 +23,7 @@ #include "Client.h" #include "StringTokenizer.h" -OnlineUser::OnlineUser(const User::Ptr& ptr, Client& client_, u_int32_t sid_) : user(ptr), identity(ptr, client_.getHubUrl()), sid(sid_), client(&client_) { +OnlineUser::OnlineUser(const User::Ptr& ptr, Client& client_, u_int32_t sid_) : user(ptr), identity(ptr, client_.getHubUrl(), sid_), client(&client_) { } @@ -32,6 +32,7 @@ sm[prefix + string((char*)(&i->first), 2)] = i->second; } if(user) { + sm[prefix + "SID"] = getSIDString(); sm[prefix + "CID"] = user->getCID().toBase32(); sm[prefix + "TAG"] = getTag(); sm[prefix + "SSshort"] = Util::formatBytes(get("SS")); Modified: dcplusplus/trunk/client/User.h =================================================================== --- dcplusplus/trunk/client/User.h 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/client/User.h 2006-05-15 21:53:14 UTC (rev 603) @@ -97,10 +97,10 @@ NMDC_PASSIVE = 1 << NMDC_PASSIVE_BIT }; - Identity() { } - Identity(const User::Ptr& ptr, const string& aHubUrl) : user(ptr), hubUrl(aHubUrl) { } - Identity(const Identity& rhs) : ::Flags(rhs), user(rhs.user), hubUrl(rhs.hubUrl), info(rhs.info) { } - Identity& operator=(const Identity& rhs) { user = rhs.user; hubUrl = rhs.hubUrl; info = rhs.info; return *this; } + Identity() : sid(0) { } + Identity(const User::Ptr& ptr, const string& aHubUrl, u_int32_t aSID) : user(ptr), hubUrl(aHubUrl), sid(aSID) { } + Identity(const Identity& rhs) : ::Flags(rhs), user(rhs.user), hubUrl(rhs.hubUrl), sid(rhs.sid), info(rhs.info) { } + Identity& operator=(const Identity& rhs) { user = rhs.user; hubUrl = rhs.hubUrl; sid = rhs.sid; info = rhs.info; return *this; } #define GS(n, x) const string& get##n() const { return get(x); } void set##n(const string& v) { set(x, v); } GS(Nick, "NI") @@ -143,10 +143,15 @@ info[*(short*)name] = val; } + string getSIDString() const { + return string((const char*)&sid, 4); + } + void getParams(StringMap& map, const string& prefix, bool compatibility) const; User::Ptr& getUser() { return user; } GETSET(User::Ptr, user, User); GETSET(string, hubUrl, HubUrl); + GETSET(u_int32_t, sid, SID); private: typedef map<short, string> InfMap; typedef InfMap::iterator InfIter; @@ -174,7 +179,6 @@ GETSET(User::Ptr, user, User); GETSET(Identity, identity, Identity); - GETSET(u_int32_t, sid, SID); private: friend class NmdcHub; Modified: dcplusplus/trunk/windows/DirectoryListingFrm.cpp =================================================================== --- dcplusplus/trunk/windows/DirectoryListingFrm.cpp 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/windows/DirectoryListingFrm.cpp 2006-05-15 21:53:14 UTC (rev 603) @@ -1035,9 +1035,11 @@ } void DirectoryListingFrame::runUserCommand(UserCommand& uc) { - StringMap ucParams; - if(!WinUtil::getUCParams(m_hWnd, uc, ucParams)) + if(!WinUtil::getUCParams(m_hWnd, uc, ucLineParams)) return; + + StringMap ucParams = ucLineParams; + set<User::Ptr> nicks; int sel = -1; Modified: dcplusplus/trunk/windows/DirectoryListingFrm.h =================================================================== --- dcplusplus/trunk/windows/DirectoryListingFrm.h 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/windows/DirectoryListingFrm.h 2006-05-15 21:53:14 UTC (rev 603) @@ -345,6 +345,8 @@ auto_ptr<DirectoryListing> dl; + StringMap ucLineParams; + typedef HASH_MAP_X(User::Ptr, DirectoryListingFrame*, User::HashFunction, equal_to<User::Ptr>, less<User::Ptr>) UserMap; typedef UserMap::iterator UserIter; Modified: dcplusplus/trunk/windows/HubFrame.cpp =================================================================== --- dcplusplus/trunk/windows/HubFrame.cpp 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/windows/HubFrame.cpp 2006-05-15 21:53:14 UTC (rev 603) @@ -799,10 +799,11 @@ } void HubFrame::runUserCommand(::UserCommand& uc) { - StringMap ucParams; - if(!WinUtil::getUCParams(m_hWnd, uc, ucParams)) + if(!WinUtil::getUCParams(m_hWnd, uc, ucLineParams)) return; + StringMap ucParams = ucLineParams; + client->getMyIdentity().getParams(ucParams, "my", true); client->getHubIdentity().getParams(ucParams, "hub", false); Modified: dcplusplus/trunk/windows/HubFrame.h =================================================================== --- dcplusplus/trunk/windows/HubFrame.h 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/windows/HubFrame.h 2006-05-15 21:53:14 UTC (rev 603) @@ -324,6 +324,8 @@ bool updateUsers; bool resort; + StringMap ucLineParams; + enum { MAX_CLIENT_LINES = 5 }; TStringList lastLinesList; tstring lastLines; Modified: dcplusplus/trunk/windows/PrivateFrame.cpp =================================================================== --- dcplusplus/trunk/windows/PrivateFrame.cpp 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/windows/PrivateFrame.cpp 2006-05-15 21:53:14 UTC (rev 603) @@ -32,6 +32,7 @@ #include "../client/ShareManager.h" #include "../client/FavoriteManager.h" #include "../client/QueueManager.h" +#include "../client/StringTokenizer.h" PrivateFrame::FrameMap PrivateFrame::frames; @@ -284,10 +285,12 @@ } void PrivateFrame::runUserCommand(UserCommand& uc) { - StringMap ucParams; - if(!WinUtil::getUCParams(m_hWnd, uc, ucParams)) + + if(!WinUtil::getUCParams(m_hWnd, uc, ucLineParams)) return; + StringMap ucParams = ucLineParams; + ClientManager::getInstance()->userCommand(replyTo, uc, ucParams, true); } Modified: dcplusplus/trunk/windows/PrivateFrame.h =================================================================== --- dcplusplus/trunk/windows/PrivateFrame.h 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/windows/PrivateFrame.h 2006-05-15 21:53:14 UTC (rev 603) @@ -161,6 +161,8 @@ bool closed; + StringMap ucLineParams; + void updateTitle(); // ClientManagerListener Modified: dcplusplus/trunk/windows/SearchFrm.cpp =================================================================== --- dcplusplus/trunk/windows/SearchFrm.cpp 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/windows/SearchFrm.cpp 2006-05-15 21:53:14 UTC (rev 603) @@ -768,9 +768,11 @@ } void SearchFrame::runUserCommand(UserCommand& uc) { - StringMap ucParams; - if(!WinUtil::getUCParams(m_hWnd, uc, ucParams)) + if(!WinUtil::getUCParams(m_hWnd, uc, ucLineParams)) return; + + StringMap ucParams = ucLineParams; + set<CID> users; int sel = -1; Modified: dcplusplus/trunk/windows/SearchFrm.h =================================================================== --- dcplusplus/trunk/windows/SearchFrm.h 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/windows/SearchFrm.h 2006-05-15 21:53:14 UTC (rev 603) @@ -383,6 +383,8 @@ bool closed; + StringMap ucLineParams; + static int columnIndexes[]; static int columnSizes[]; Modified: dcplusplus/trunk/windows/SingleInstance.h =================================================================== --- dcplusplus/trunk/windows/SingleInstance.h 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/windows/SingleInstance.h 2006-05-15 21:53:14 UTC (rev 603) @@ -24,7 +24,7 @@ #endif // _MSC_VER > 1000 #define WMU_WHERE_ARE_YOU_MSG _T("WMU_WHERE_ARE_YOU-{885D4B75-6606-4add-A8DE-EEEDC04181F1}") -const UINT WMU_WHERE_ARE_YOU = ::RegisterWindowMessage(_T("WMU_WHERE_ARE_YOU_MSG")); +const UINT WMU_WHERE_ARE_YOU = ::RegisterWindowMessageA("WMU_WHERE_ARE_YOU_MSG"); class SingleInstance { Modified: dcplusplus/trunk/windows/TransferView.cpp =================================================================== --- dcplusplus/trunk/windows/TransferView.cpp 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/windows/TransferView.cpp 2006-05-15 21:53:14 UTC (rev 603) @@ -128,10 +128,11 @@ } void TransferView::runUserCommand(UserCommand& uc) { - StringMap ucParams; - if(!WinUtil::getUCParams(m_hWnd, uc, ucParams)) + if(!WinUtil::getUCParams(m_hWnd, uc, ucLineParams)) return; + StringMap ucParams = ucLineParams; + int i = -1; while((i = ctrlTransfers.GetNextItem(i, LVNI_SELECTED)) != -1) { ItemInfo* itemI = ctrlTransfers.getItemData(i); Modified: dcplusplus/trunk/windows/TransferView.h =================================================================== --- dcplusplus/trunk/windows/TransferView.h 2006-05-13 15:00:16 UTC (rev 602) +++ dcplusplus/trunk/windows/TransferView.h 2006-05-15 21:53:14 UTC (rev 603) @@ -263,6 +263,8 @@ CMenu transferMenu; CImageList arrows; + StringMap ucLineParams; + virtual void on(ConnectionManagerListener::Added, ConnectionQueueItem* aCqi) throw(); virtual void on(ConnectionManagerListener::Failed, ConnectionQueueItem* aCqi, const string& aReason) throw(); virtual void on(ConnectionManagerListener::Removed, ConnectionQueueItem* aCqi) throw(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-05-13 15:01:01
|
Revision: 602 Author: arnetheduck Date: 2006-05-13 08:00:16 -0700 (Sat, 13 May 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=602&view=rev Log Message: ----------- Patches Modified Paths: -------------- dcplusplus/trunk/Example.xml dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/DownloadManager.cpp dcplusplus/trunk/client/SettingsManager.cpp dcplusplus/trunk/client/SettingsManager.h dcplusplus/trunk/client/StringDefs.cpp dcplusplus/trunk/client/StringDefs.h dcplusplus/trunk/client/UploadManager.cpp dcplusplus/trunk/windows/AdvancedPage.cpp Modified: dcplusplus/trunk/Example.xml =================================================================== --- dcplusplus/trunk/Example.xml 2006-05-03 21:47:14 UTC (rev 601) +++ dcplusplus/trunk/Example.xml 2006-05-13 15:00:16 UTC (rev 602) @@ -379,6 +379,7 @@ <String Name="SettingsAutoAway">Auto-away on minimize (and back on restore)</String> <String Name="SettingsAutoFollow">Automatically follow redirects</String> <String Name="SettingsAutoKick">Automatically disconnect users who leave the hub</String> + <String Name="SettingsAutoKickNoFavs">Don't automatically disconnect favorite users who leave the hub</String> <String Name="SettingsAutoSearch">Automatically search for alternative download locations</String> <String Name="SettingsAutoSearchAutoMatch">Automatically match queue for auto search hits</String> <String Name="SettingsAutoSearchLimit">Auto-search limit</String> Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-05-03 21:47:14 UTC (rev 601) +++ dcplusplus/trunk/changelog.txt 2006-05-13 15:00:16 UTC (rev 602) @@ -8,6 +8,9 @@ * Added display of CID in a few places * Updated yaSSL to 1.2.2 * Fixed ADC hubname display (thanks ullner) +* Advanced TTH rollback no longer performed if tree is invalid (thanks garg) +* Option not to auto-disconnect favorite users (thanks ullner) +* Fixed auto-disconnect delay (thanks uller) -- 0.689 2006-04-01 -- * Fixed displaying of available bytes when user list is off Modified: dcplusplus/trunk/client/DownloadManager.cpp =================================================================== --- dcplusplus/trunk/client/DownloadManager.cpp 2006-05-03 21:47:14 UTC (rev 601) +++ dcplusplus/trunk/client/DownloadManager.cpp 2006-05-13 15:00:16 UTC (rev 602) @@ -266,7 +266,9 @@ d->setFlag(Download::FLAG_ANTI_FRAG); } - if(BOOLSETTING(ADVANCED_RESUME) && d->getTreeValid() && start > 0) { + if(BOOLSETTING(ADVANCED_RESUME) && d->getTreeValid() && start > 0 && + (d->getTigerTree().getLeaves().size() > 32 || // 32 leaves is 5 levels + d->getTigerTree().getBlockSize() * 10 < d->getSize())) { d->setStartPos(getResumePos(d->getDownloadTarget(), d->getTigerTree(), start)); } else { int rollback = SETTING(ROLLBACK); Modified: dcplusplus/trunk/client/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/client/SettingsManager.cpp 2006-05-03 21:47:14 UTC (rev 601) +++ dcplusplus/trunk/client/SettingsManager.cpp 2006-05-13 15:00:16 UTC (rev 602) @@ -73,7 +73,7 @@ "NoIpOverride", "SearchOnlyFreeSlots", "LastSearchType", "BoldFinishedDownloads", "BoldFinishedUploads", "BoldQueue", "BoldHub", "BoldPm", "BoldSearch", "SocketInBuffer", "SocketOutBuffer", "OnlyDlTthFiles", "OpenWaitingUsers", "BoldWaitingUsers", "OpenSystemLog", "BoldSystemLog", "AutoRefreshTime", - "UseSsl", "AutoSearchLimit", "AltSortOrder", + "UseSsl", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", "SENTRY", // Int64 "TotalUpload", "TotalDownload", @@ -255,6 +255,7 @@ setDefault(USE_SSL, false); setDefault(AUTO_SEARCH_LIMIT, 5); setDefault(ALT_SORT_ORDER, false); + setDefault(AUTO_KICK_NO_FAVS, false); #ifdef _WIN32 setDefault(MAIN_WINDOW_STATE, SW_SHOWNORMAL); Modified: dcplusplus/trunk/client/SettingsManager.h =================================================================== --- dcplusplus/trunk/client/SettingsManager.h 2006-05-03 21:47:14 UTC (rev 601) +++ dcplusplus/trunk/client/SettingsManager.h 2006-05-13 15:00:16 UTC (rev 602) @@ -89,7 +89,7 @@ NO_IP_OVERRIDE, SEARCH_ONLY_FREE_SLOTS, LAST_SEARCH_TYPE, BOLD_FINISHED_DOWNLOADS, BOLD_FINISHED_UPLOADS, BOLD_QUEUE, BOLD_HUB, BOLD_PM, BOLD_SEARCH, SOCKET_IN_BUFFER, SOCKET_OUT_BUFFER, ONLY_DL_TTH_FILES, OPEN_WAITING_USERS, BOLD_WAITING_USERS, OPEN_SYSTEM_LOG, BOLD_SYSTEM_LOG, AUTO_REFRESH_TIME, - USE_SSL, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, + USE_SSL, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, INT_LAST }; enum Int64Setting { INT64_FIRST = INT_LAST + 1, Modified: dcplusplus/trunk/client/StringDefs.cpp =================================================================== --- dcplusplus/trunk/client/StringDefs.cpp 2006-05-03 21:47:14 UTC (rev 601) +++ dcplusplus/trunk/client/StringDefs.cpp 2006-05-13 15:00:16 UTC (rev 602) @@ -380,6 +380,7 @@ "Auto-away on minimize (and back on restore)", "Automatically follow redirects", "Automatically disconnect users who leave the hub", +"Don't automatically disconnect favorite users who leave the hub", "Automatically search for alternative download locations", "Automatically match queue for auto search hits", "Auto-search limit", @@ -983,6 +984,7 @@ "SettingsAutoAway", "SettingsAutoFollow", "SettingsAutoKick", +"SettingsAutoKickNoFavs", "SettingsAutoSearch", "SettingsAutoSearchAutoMatch", "SettingsAutoSearchLimit", Modified: dcplusplus/trunk/client/StringDefs.h =================================================================== --- dcplusplus/trunk/client/StringDefs.h 2006-05-03 21:47:14 UTC (rev 601) +++ dcplusplus/trunk/client/StringDefs.h 2006-05-13 15:00:16 UTC (rev 602) @@ -383,6 +383,7 @@ SETTINGS_AUTO_AWAY, // "Auto-away on minimize (and back on restore)" SETTINGS_AUTO_FOLLOW, // "Automatically follow redirects" SETTINGS_AUTO_KICK, // "Automatically disconnect users who leave the hub" + SETTINGS_AUTO_KICK_NO_FAVS, // "Don't automatically disconnect favorite users who leave the hub" SETTINGS_AUTO_SEARCH, // "Automatically search for alternative download locations" SETTINGS_AUTO_SEARCH_AUTO_MATCH, // "Automatically match queue for auto search hits" SETTINGS_AUTO_SEARCH_LIMIT, // "Auto-search limit" Modified: dcplusplus/trunk/client/UploadManager.cpp =================================================================== --- dcplusplus/trunk/client/UploadManager.cpp 2006-05-03 21:47:14 UTC (rev 601) +++ dcplusplus/trunk/client/UploadManager.cpp 2006-05-13 15:00:16 UTC (rev 602) @@ -492,14 +492,14 @@ void UploadManager::on(ClientManagerListener::UserDisconnected, const User::Ptr& aUser) throw() { /// @todo Don't kick when /me disconnects - if( BOOLSETTING(AUTO_KICK) ) { + if( BOOLSETTING(AUTO_KICK) && !(BOOLSETTING(AUTO_KICK_NO_FAVS) && FavoriteManager::getInstance()->isFavoriteUser(aUser)) ) { Lock l(cs); for(Upload::Iter i = uploads.begin(); i != uploads.end(); ++i) { Upload* u = *i; if(u->getUser() == aUser) { // Oops...adios... - u->getUserConnection()->disconnect(); + u->getUserConnection()->disconnect(true); // But let's grant him/her a free slot just in case... if (!u->getUserConnection()->isSet(UserConnection::FLAG_HASEXTRASLOT)) reserveSlot(aUser); Modified: dcplusplus/trunk/windows/AdvancedPage.cpp =================================================================== --- dcplusplus/trunk/windows/AdvancedPage.cpp 2006-05-03 21:47:14 UTC (rev 601) +++ dcplusplus/trunk/windows/AdvancedPage.cpp 2006-05-13 15:00:16 UTC (rev 602) @@ -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::USE_SSL, ResourceManager::SETTINGS_USE_SSL }, + { SettingsManager::AUTO_KICK_NO_FAVS, ResourceManager::SETTINGS_AUTO_KICK_NO_FAVS }, { 0, ResourceManager::SETTINGS_AUTO_AWAY } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2006-05-03 21:51:00
|
Revision: 601 Author: arnetheduck Date: 2006-05-03 14:47:14 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=601&view=rev Log Message: ----------- patches Modified Paths: -------------- dcplusplus/trunk/DCPlusPlus.rc dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/ADLSearch.cpp dcplusplus/trunk/client/ADLSearch.h dcplusplus/trunk/client/AdcCommand.cpp dcplusplus/trunk/client/AdcCommand.h dcplusplus/trunk/client/AdcHub.cpp dcplusplus/trunk/client/AdcHub.h dcplusplus/trunk/client/BZUtils.cpp dcplusplus/trunk/client/BZUtils.h dcplusplus/trunk/client/BitInputStream.h dcplusplus/trunk/client/BitOutputStream.h dcplusplus/trunk/client/BloomFilter.h dcplusplus/trunk/client/BufferedSocket.cpp dcplusplus/trunk/client/BufferedSocket.h dcplusplus/trunk/client/CID.h dcplusplus/trunk/client/Client.cpp dcplusplus/trunk/client/Client.h dcplusplus/trunk/client/ClientManager.cpp dcplusplus/trunk/client/ClientManager.h dcplusplus/trunk/client/ClientManagerListener.h dcplusplus/trunk/client/ConnectionManager.cpp dcplusplus/trunk/client/ConnectionManager.h dcplusplus/trunk/client/ConnectionManagerListener.h dcplusplus/trunk/client/CriticalSection.h dcplusplus/trunk/client/CryptoManager.cpp dcplusplus/trunk/client/CryptoManager.h dcplusplus/trunk/client/DCPlusPlus.cpp dcplusplus/trunk/client/DCPlusPlus.h dcplusplus/trunk/client/DirectoryListing.cpp dcplusplus/trunk/client/DirectoryListing.h dcplusplus/trunk/client/DownloadManager.cpp dcplusplus/trunk/client/DownloadManager.h dcplusplus/trunk/client/Encoder.cpp dcplusplus/trunk/client/Encoder.h dcplusplus/trunk/client/Exception.h dcplusplus/trunk/client/FastAlloc.h dcplusplus/trunk/client/FavoriteManager.cpp dcplusplus/trunk/client/FavoriteManager.h dcplusplus/trunk/client/FavoriteUser.h dcplusplus/trunk/client/File.h dcplusplus/trunk/client/FilteredFile.h dcplusplus/trunk/client/FinishedManager.cpp dcplusplus/trunk/client/FinishedManager.h dcplusplus/trunk/client/HashManager.cpp dcplusplus/trunk/client/HashManager.h dcplusplus/trunk/client/HashValue.h dcplusplus/trunk/client/HttpConnection.cpp dcplusplus/trunk/client/HttpConnection.h dcplusplus/trunk/client/LogManager.cpp dcplusplus/trunk/client/LogManager.h dcplusplus/trunk/client/MerkleCheckOutputStream.h dcplusplus/trunk/client/MerkleTree.h dcplusplus/trunk/client/NmdcHub.cpp dcplusplus/trunk/client/NmdcHub.h dcplusplus/trunk/client/Pointer.h dcplusplus/trunk/client/QueueItem.h dcplusplus/trunk/client/QueueManager.cpp dcplusplus/trunk/client/QueueManager.h dcplusplus/trunk/client/QueueManagerListener.h dcplusplus/trunk/client/ResourceManager.cpp dcplusplus/trunk/client/ResourceManager.h dcplusplus/trunk/client/SFVReader.cpp dcplusplus/trunk/client/SFVReader.h dcplusplus/trunk/client/SearchManager.cpp dcplusplus/trunk/client/SearchManager.h dcplusplus/trunk/client/SearchManagerListener.h dcplusplus/trunk/client/Semaphore.h dcplusplus/trunk/client/ServerSocket.cpp dcplusplus/trunk/client/ServerSocket.h dcplusplus/trunk/client/SettingsManager.cpp dcplusplus/trunk/client/SettingsManager.h dcplusplus/trunk/client/ShareManager.cpp dcplusplus/trunk/client/ShareManager.h dcplusplus/trunk/client/SimpleXML.cpp dcplusplus/trunk/client/SimpleXML.h dcplusplus/trunk/client/Singleton.h dcplusplus/trunk/client/Socket.cpp dcplusplus/trunk/client/Socket.h dcplusplus/trunk/client/Speaker.h dcplusplus/trunk/client/Streams.h dcplusplus/trunk/client/StringSearch.h dcplusplus/trunk/client/StringTokenizer.cpp dcplusplus/trunk/client/StringTokenizer.h dcplusplus/trunk/client/Text.cpp dcplusplus/trunk/client/Text.h dcplusplus/trunk/client/Thread.cpp dcplusplus/trunk/client/Thread.h dcplusplus/trunk/client/TigerHash.cpp dcplusplus/trunk/client/TigerHash.h dcplusplus/trunk/client/TimerManager.cpp dcplusplus/trunk/client/TimerManager.h dcplusplus/trunk/client/UploadManager.cpp dcplusplus/trunk/client/UploadManager.h dcplusplus/trunk/client/User.cpp dcplusplus/trunk/client/User.h dcplusplus/trunk/client/UserCommand.h dcplusplus/trunk/client/UserConnection.cpp dcplusplus/trunk/client/UserConnection.h dcplusplus/trunk/client/Util.cpp dcplusplus/trunk/client/Util.h dcplusplus/trunk/client/ZUtils.cpp dcplusplus/trunk/client/ZUtils.h dcplusplus/trunk/client/config.h dcplusplus/trunk/client/stdinc.cpp dcplusplus/trunk/client/stdinc.h dcplusplus/trunk/client/version.h dcplusplus/trunk/windows/ADLSProperties.cpp dcplusplus/trunk/windows/ADLSProperties.h dcplusplus/trunk/windows/ADLSearchFrame.cpp dcplusplus/trunk/windows/ADLSearchFrame.h dcplusplus/trunk/windows/AboutDlg.h dcplusplus/trunk/windows/Advanced3Page.cpp dcplusplus/trunk/windows/Advanced3Page.h dcplusplus/trunk/windows/AdvancedPage.cpp dcplusplus/trunk/windows/AdvancedPage.h dcplusplus/trunk/windows/Appearance2Page.cpp dcplusplus/trunk/windows/Appearance2Page.h dcplusplus/trunk/windows/AppearancePage.cpp dcplusplus/trunk/windows/AppearancePage.h dcplusplus/trunk/windows/CertificatesPage.cpp dcplusplus/trunk/windows/CertificatesPage.h dcplusplus/trunk/windows/CommandDlg.cpp dcplusplus/trunk/windows/CommandDlg.h dcplusplus/trunk/windows/DirectoryListingFrm.cpp dcplusplus/trunk/windows/DirectoryListingFrm.h dcplusplus/trunk/windows/DownloadPage.cpp dcplusplus/trunk/windows/DownloadPage.h dcplusplus/trunk/windows/ExListViewCtrl.cpp dcplusplus/trunk/windows/ExListViewCtrl.h dcplusplus/trunk/windows/ExtendedTrace.cpp dcplusplus/trunk/windows/ExtendedTrace.h dcplusplus/trunk/windows/FavHubProperties.cpp dcplusplus/trunk/windows/FavHubProperties.h dcplusplus/trunk/windows/FavoriteDirsPage.cpp dcplusplus/trunk/windows/FavoriteDirsPage.h dcplusplus/trunk/windows/FavoritesFrm.cpp dcplusplus/trunk/windows/FavoritesFrm.h dcplusplus/trunk/windows/FinishedFrame.h dcplusplus/trunk/windows/FinishedFrameBase.h dcplusplus/trunk/windows/FinishedULFrame.h dcplusplus/trunk/windows/FlatTabCtrl.h dcplusplus/trunk/windows/GeneralPage.cpp dcplusplus/trunk/windows/GeneralPage.h dcplusplus/trunk/windows/HashProgressDlg.h dcplusplus/trunk/windows/HubFrame.cpp dcplusplus/trunk/windows/HubFrame.h dcplusplus/trunk/windows/LineDlg.h dcplusplus/trunk/windows/ListViewArrows.h dcplusplus/trunk/windows/LogPage.cpp dcplusplus/trunk/windows/LogPage.h dcplusplus/trunk/windows/MagnetDlg.h dcplusplus/trunk/windows/MainFrm.cpp dcplusplus/trunk/windows/MainFrm.h dcplusplus/trunk/windows/NetworkPage.cpp dcplusplus/trunk/windows/NetworkPage.h dcplusplus/trunk/windows/NotepadFrame.cpp dcplusplus/trunk/windows/NotepadFrame.h dcplusplus/trunk/windows/PrivateFrame.cpp dcplusplus/trunk/windows/PrivateFrame.h dcplusplus/trunk/windows/PropPage.cpp dcplusplus/trunk/windows/PropPage.h dcplusplus/trunk/windows/PropertiesDlg.cpp dcplusplus/trunk/windows/PropertiesDlg.h dcplusplus/trunk/windows/PublicHubsFrm.cpp dcplusplus/trunk/windows/PublicHubsFrm.h dcplusplus/trunk/windows/PublicHubsListDlg.h dcplusplus/trunk/windows/QueueFrame.cpp dcplusplus/trunk/windows/QueueFrame.h dcplusplus/trunk/windows/QueuePage.cpp dcplusplus/trunk/windows/QueuePage.h dcplusplus/trunk/windows/SearchFrm.cpp dcplusplus/trunk/windows/SearchFrm.h dcplusplus/trunk/windows/SingleInstance.h dcplusplus/trunk/windows/SpyFrame.cpp dcplusplus/trunk/windows/SpyFrame.h dcplusplus/trunk/windows/StatsFrame.cpp dcplusplus/trunk/windows/StatsFrame.h dcplusplus/trunk/windows/SystemFrame.cpp dcplusplus/trunk/windows/SystemFrame.h dcplusplus/trunk/windows/TextFrame.cpp dcplusplus/trunk/windows/TextFrame.h dcplusplus/trunk/windows/TransferView.cpp dcplusplus/trunk/windows/TransferView.h dcplusplus/trunk/windows/TreePropertySheet.cpp dcplusplus/trunk/windows/TreePropertySheet.h dcplusplus/trunk/windows/TypedListViewCtrl.h dcplusplus/trunk/windows/UCHandler.h dcplusplus/trunk/windows/UCPage.cpp dcplusplus/trunk/windows/UCPage.h dcplusplus/trunk/windows/UPnP.cpp dcplusplus/trunk/windows/UPnP.h dcplusplus/trunk/windows/UploadPage.cpp dcplusplus/trunk/windows/UploadPage.h dcplusplus/trunk/windows/UsersFrame.cpp dcplusplus/trunk/windows/UsersFrame.h dcplusplus/trunk/windows/WaitingUsersFrame.cpp dcplusplus/trunk/windows/WaitingUsersFrame.h dcplusplus/trunk/windows/WinUtil.cpp dcplusplus/trunk/windows/WinUtil.h dcplusplus/trunk/windows/WindowsPage.cpp dcplusplus/trunk/windows/WindowsPage.h dcplusplus/trunk/windows/main.cpp dcplusplus/trunk/windows/stdafx.cpp dcplusplus/trunk/windows/stdafx.h dcplusplus/trunk/yassl/src/yassl.cpp dcplusplus/trunk/zlib/adler32.c dcplusplus/trunk/zlib/compress.c dcplusplus/trunk/zlib/crc32.c dcplusplus/trunk/zlib/deflate.c dcplusplus/trunk/zlib/deflate.h dcplusplus/trunk/zlib/trees.c dcplusplus/trunk/zlib/uncompr.c dcplusplus/trunk/zlib/zconf.h dcplusplus/trunk/zlib/zutil.c dcplusplus/trunk/zlib/zutil.h Modified: dcplusplus/trunk/DCPlusPlus.rc =================================================================== --- dcplusplus/trunk/DCPlusPlus.rc 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/DCPlusPlus.rc 2006-05-03 21:47:14 UTC (rev 601) @@ -933,8 +933,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,6,8,9 - PRODUCTVERSION 0,6,8,9 + FILEVERSION 0,6,9,0 + PRODUCTVERSION 0,6,9,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -951,12 +951,12 @@ BEGIN VALUE "Comments", "http://dcplusplus.sourceforge.net" VALUE "FileDescription", "DC++" - VALUE "FileVersion", "0, 6, 8, 9" + VALUE "FileVersion", "0, 6, 9, 0" VALUE "InternalName", "DC++" VALUE "LegalCopyright", "Copyright 2001-2006 Jacek Sieka" VALUE "OriginalFilename", "DCPlusPlus.exe" VALUE "ProductName", "DC++" - VALUE "ProductVersion", "0, 6, 8, 9" + VALUE "ProductVersion", "0, 6, 9, 0" END END BLOCK "VarFileInfo" Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/changelog.txt 2006-05-03 21:47:14 UTC (rev 601) @@ -7,6 +7,7 @@ * CID of user shown if nick is missing (in queue for example) * Added display of CID in a few places * Updated yaSSL to 1.2.2 +* Fixed ADC hubname display (thanks ullner) -- 0.689 2006-04-01 -- * Fixed displaying of available bytes when user list is off Modified: dcplusplus/trunk/client/ADLSearch.cpp =================================================================== --- dcplusplus/trunk/client/ADLSearch.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/ADLSearch.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -321,8 +321,3 @@ } StepUpDirectory(aDestList); } - -/** - * @file - * $Id: ADLSearch.cpp,v 1.31 2006/02/05 17:02:37 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/ADLSearch.h =================================================================== --- dcplusplus/trunk/client/ADLSearch.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/ADLSearch.h 2006-05-03 21:47:14 UTC (rev 601) @@ -308,8 +308,3 @@ }; #endif // !defined(ADL_SEARCH_H) - -/** - * @file - * $Id: ADLSearch.h,v 1.25 2006/01/23 08:00:49 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/AdcCommand.cpp =================================================================== --- dcplusplus/trunk/client/AdcCommand.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/AdcCommand.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -222,8 +222,3 @@ } return false; } - -/** - * @file - * $Id: AdcCommand.cpp,v 1.18 2006/02/19 20:39:20 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/AdcCommand.h =================================================================== --- dcplusplus/trunk/client/AdcCommand.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/AdcCommand.h 2006-05-03 21:47:14 UTC (rev 601) @@ -201,8 +201,3 @@ }; #endif // !defined(ADC_COMMAND_H) - -/** - * @file - * $Id: AdcCommand.h,v 1.29 2006/02/19 20:39:20 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/AdcHub.cpp =================================================================== --- dcplusplus/trunk/client/AdcHub.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/AdcHub.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -132,8 +132,10 @@ u->getUser()->setFlag(User::SSL); } - if(u->getIdentity().isHub()) + if(u->getIdentity().isHub()) { setHubIdentity(u->getIdentity()); + fire(ClientListener::HubUpdated(), this); + } if(u->getUser() == ClientManager::getInstance()->getMe()) { state = STATE_NORMAL; @@ -540,8 +542,3 @@ sendUDP(cmd); send(cmd.toString(sid)); } - -/** - * @file - * $Id: AdcHub.cpp,v 1.66 2006/02/12 18:16:12 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/AdcHub.h =================================================================== --- dcplusplus/trunk/client/AdcHub.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/AdcHub.h 2006-05-03 21:47:14 UTC (rev 601) @@ -122,8 +122,3 @@ }; #endif // !defined(ADC_HUB_H) - -/** - * @file - * $Id: AdcHub.h,v 1.42 2006/02/19 20:39:20 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/BZUtils.cpp =================================================================== --- dcplusplus/trunk/client/BZUtils.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/BZUtils.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -99,8 +99,3 @@ insize = insize - zs.avail_in; return err == BZ_OK; } - -/** - * @file - * $Id: BZUtils.cpp,v 1.6 2005/04/24 08:13:11 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/BZUtils.h =================================================================== --- dcplusplus/trunk/client/BZUtils.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/BZUtils.h 2006-05-03 21:47:14 UTC (rev 601) @@ -64,8 +64,3 @@ }; #endif // !defined(BZ_UTILS_H) - -/** - * @file - * $Id: BZUtils.h,v 1.6 2005/04/24 08:13:11 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/BitInputStream.h =================================================================== --- dcplusplus/trunk/client/BitInputStream.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/BitInputStream.h 2006-05-03 21:47:14 UTC (rev 601) @@ -66,8 +66,3 @@ }; #endif // !defined(BIT_INPUT_STREAM_H) - -/** - * @file - * $Id: BitInputStream.h,v 1.18 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/BitOutputStream.h =================================================================== --- dcplusplus/trunk/client/BitOutputStream.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/BitOutputStream.h 2006-05-03 21:47:14 UTC (rev 601) @@ -58,8 +58,3 @@ }; #endif // !defined(BIT_OUTPUT_STREAM_H) - -/** - * @file - * $Id: BitOutputStream.h,v 1.16 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/BloomFilter.h =================================================================== --- dcplusplus/trunk/client/BloomFilter.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/BloomFilter.h 2006-05-03 21:47:14 UTC (rev 601) @@ -91,8 +91,3 @@ }; #endif // !defined(BLOOM_FILTER_H) - -/** - * @file - * $Id: BloomFilter.h,v 1.11 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/BufferedSocket.cpp =================================================================== --- dcplusplus/trunk/client/BufferedSocket.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/BufferedSocket.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -468,8 +468,3 @@ delete this; } } - -/** - * @file - * $Id: BufferedSocket.cpp,v 1.103 2006/02/19 23:51:31 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/BufferedSocket.h =================================================================== --- dcplusplus/trunk/client/BufferedSocket.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/BufferedSocket.h 2006-05-03 21:47:14 UTC (rev 601) @@ -187,8 +187,3 @@ }; #endif // !defined(BUFFERED_SOCKET_H) - -/** - * @file - * $Id: BufferedSocket.h,v 1.79 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/CID.h =================================================================== --- dcplusplus/trunk/client/CID.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/CID.h 2006-05-03 21:47:14 UTC (rev 601) @@ -61,8 +61,3 @@ }; #endif // !defined(CID_H) - -/** - * @file - * $Id: CID.h,v 1.10 2006/02/10 07:56:46 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Client.cpp =================================================================== --- dcplusplus/trunk/client/Client.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Client.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -145,8 +145,3 @@ return Util::getLocalIp(); return lip; } - -/** - * @file - * $Id: Client.cpp,v 1.94 2006/02/19 23:51:31 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Client.h =================================================================== --- dcplusplus/trunk/client/Client.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Client.h 2006-05-03 21:47:14 UTC (rev 601) @@ -205,8 +205,3 @@ }; #endif // !defined(CLIENT_H) - -/** - * @file - * $Id: Client.h,v 1.111 2006/02/19 23:51:31 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/ClientManager.cpp =================================================================== --- dcplusplus/trunk/client/ClientManager.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/ClientManager.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -571,8 +571,3 @@ if(clients.size() > 0) cachedIp = (*clients.begin())->getLocalIp(); } - -/** - * @file - * $Id: ClientManager.cpp,v 1.97 2006/02/19 23:51:31 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/ClientManager.h =================================================================== --- dcplusplus/trunk/client/ClientManager.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/ClientManager.h 2006-05-03 21:47:14 UTC (rev 601) @@ -167,8 +167,3 @@ }; #endif // !defined(CLIENT_MANAGER_H) - -/** - * @file - * $Id: ClientManager.h,v 1.78 2006/02/13 21:13:27 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/ClientManagerListener.h =================================================================== --- dcplusplus/trunk/client/ClientManagerListener.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/ClientManagerListener.h 2006-05-03 21:47:14 UTC (rev 601) @@ -48,8 +48,3 @@ }; #endif // !defined(CLIENT_MANAGER_LISTENER_H) - -/** - * @file - * $Id: ClientManagerListener.h,v 1.13 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/ConnectionManager.cpp =================================================================== --- dcplusplus/trunk/client/ConnectionManager.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/ConnectionManager.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -697,8 +697,3 @@ } } } - -/** - * @file - * $Id: ConnectionManager.cpp,v 1.119 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/ConnectionManager.h =================================================================== --- dcplusplus/trunk/client/ConnectionManager.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/ConnectionManager.h 2006-05-03 21:47:14 UTC (rev 601) @@ -198,8 +198,3 @@ }; #endif // !defined(CONNECTION_MANAGER_H) - -/** - * @file - * $Id: ConnectionManager.h,v 1.77 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/ConnectionManagerListener.h =================================================================== --- dcplusplus/trunk/client/ConnectionManagerListener.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/ConnectionManagerListener.h 2006-05-03 21:47:14 UTC (rev 601) @@ -44,8 +44,3 @@ }; #endif // !defined(CONNECTION_MANAGER_LISTENER_H) - -/** - * @file - * $Id: ConnectionManagerListener.h,v 1.8 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/CriticalSection.h =================================================================== --- dcplusplus/trunk/client/CriticalSection.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/CriticalSection.h 2006-05-03 21:47:14 UTC (rev 601) @@ -171,8 +171,3 @@ }; #endif // !defined(CRITICAL_SECTION_H) - -/** - * @file - * $Id: CriticalSection.h,v 1.29 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/CryptoManager.cpp =================================================================== --- dcplusplus/trunk/client/CryptoManager.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/CryptoManager.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -394,8 +394,3 @@ } bos.skipToByte(); } - -/** - * @file - * $Id: CryptoManager.cpp,v 1.56 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/CryptoManager.h =================================================================== --- dcplusplus/trunk/client/CryptoManager.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/CryptoManager.h 2006-05-03 21:47:14 UTC (rev 601) @@ -124,8 +124,3 @@ }; #endif // !defined(CRYPTO_MANAGER_H) - -/** - * @file - * $Id: CryptoManager.h,v 1.44 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/DCPlusPlus.cpp =================================================================== --- dcplusplus/trunk/client/DCPlusPlus.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/DCPlusPlus.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -111,8 +111,3 @@ TimerManager::deleteInstance(); ResourceManager::deleteInstance(); } - -/** - * @file - * $Id: DCPlusPlus.cpp,v 1.43 2006/02/12 18:16:12 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/DCPlusPlus.h =================================================================== --- dcplusplus/trunk/client/DCPlusPlus.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/DCPlusPlus.h 2006-05-03 21:47:14 UTC (rev 601) @@ -125,8 +125,3 @@ extern void shutdown(); #endif // !defined(DC_PLUS_PLUS_H) - -/** - * @file - * $Id: DCPlusPlus.h,v 1.48 2005/04/24 08:13:36 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/DirectoryListing.cpp =================================================================== --- dcplusplus/trunk/client/DirectoryListing.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/DirectoryListing.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -423,8 +423,3 @@ } return x; } - -/** - * @file - * $Id: DirectoryListing.cpp,v 1.59 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/DirectoryListing.h =================================================================== --- dcplusplus/trunk/client/DirectoryListing.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/DirectoryListing.h 2006-05-03 21:47:14 UTC (rev 601) @@ -176,8 +176,3 @@ inline bool operator==(DirectoryListing::File::Ptr a, const string& b) { return Util::stricmp(a->getName(), b) == 0; } #endif // !defined(DIRECTORY_LISTING_H) - -/** - * @file - * $Id: DirectoryListing.h,v 1.47 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/DownloadManager.cpp =================================================================== --- dcplusplus/trunk/client/DownloadManager.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/DownloadManager.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -941,8 +941,3 @@ QueueManager::getInstance()->putDownload(d, false); checkDownloads(aSource); } - -/** - * @file - * $Id: DownloadManager.cpp,v 1.160 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/DownloadManager.h =================================================================== --- dcplusplus/trunk/client/DownloadManager.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/DownloadManager.h 2006-05-03 21:47:14 UTC (rev 601) @@ -279,8 +279,3 @@ }; #endif // !defined(DOWNLOAD_MANAGER_H) - -/** - * @file - * $Id: DownloadManager.h,v 1.86 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Encoder.cpp =================================================================== --- dcplusplus/trunk/client/Encoder.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Encoder.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -102,8 +102,3 @@ } } } - -/** - * @file - * $Id: Encoder.cpp,v 1.7 2005/04/24 08:13:10 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Encoder.h =================================================================== --- dcplusplus/trunk/client/Encoder.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Encoder.h 2006-05-03 21:47:14 UTC (rev 601) @@ -38,8 +38,3 @@ }; #endif // !defined(ENCODER_H) - -/** - * @file - * $Id: Encoder.h,v 1.6 2005/04/24 08:13:10 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Exception.h =================================================================== --- dcplusplus/trunk/client/Exception.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Exception.h 2006-05-03 21:47:14 UTC (rev 601) @@ -54,8 +54,3 @@ #endif #endif // !defined(EXCEPTION_H) - -/** - * @file - * $Id: Exception.h,v 1.19 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/FastAlloc.h =================================================================== --- dcplusplus/trunk/client/FastAlloc.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/FastAlloc.h 2006-05-03 21:47:14 UTC (rev 601) @@ -98,8 +98,3 @@ #endif #endif // !defined(FAST_ALLOC_H) - -/** - * @file - * $Id: FastAlloc.h,v 1.11 2005/04/24 08:13:10 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/FavoriteManager.cpp =================================================================== --- dcplusplus/trunk/client/FavoriteManager.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/FavoriteManager.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -681,8 +681,3 @@ if(isFav) fire(FavoriteManagerListener::StatusChanged(), user); } - -/** - * @file - * $Id: FavoriteManager.cpp,v 1.18 2006/02/19 16:19:05 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/FavoriteManager.h =================================================================== --- dcplusplus/trunk/client/FavoriteManager.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/FavoriteManager.h 2006-05-03 21:47:14 UTC (rev 601) @@ -279,8 +279,3 @@ }; #endif // !defined(FAVORITE_MANAGER_H) - -/** - * @file - * $Id: FavoriteManager.h,v 1.13 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/FavoriteUser.h =================================================================== --- dcplusplus/trunk/client/FavoriteUser.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/FavoriteUser.h 2006-05-03 21:47:14 UTC (rev 601) @@ -47,8 +47,3 @@ }; #endif // !defined(FAVORITE_USER_H) - -/** - * @file - * $Id: FavoriteUser.h,v 1.15 2005/12/12 08:43:00 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/File.h =================================================================== --- dcplusplus/trunk/client/File.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/File.h 2006-05-03 21:47:14 UTC (rev 601) @@ -432,8 +432,3 @@ }; #endif // !defined(FILE_H) - -/** - * @file - * $Id: File.h,v 1.54 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/FilteredFile.h =================================================================== --- dcplusplus/trunk/client/FilteredFile.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/FilteredFile.h 2006-05-03 21:47:14 UTC (rev 601) @@ -184,8 +184,3 @@ }; #endif // !defined(FILTERED_FILE_H) - -/** - * @file - * $Id: FilteredFile.h,v 1.14 2005/04/24 09:45:39 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/FinishedManager.cpp =================================================================== --- dcplusplus/trunk/client/FinishedManager.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/FinishedManager.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -93,8 +93,3 @@ fire(FinishedManagerListener::AddedUl(), item); } } - -/** - * @file - * $Id: FinishedManager.cpp,v 1.28 2006/01/01 22:42:54 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/FinishedManager.h =================================================================== --- dcplusplus/trunk/client/FinishedManager.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/FinishedManager.h 2006-05-03 21:47:14 UTC (rev 601) @@ -106,8 +106,3 @@ }; #endif // !defined(FINISHED_MANAGER_H) - -/** - * @file - * $Id: FinishedManager.h,v 1.19 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/HashManager.cpp =================================================================== --- dcplusplus/trunk/client/HashManager.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/HashManager.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -675,8 +675,3 @@ } return 0; } - -/** - * @file - * $Id: HashManager.cpp,v 1.52 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/HashManager.h =================================================================== --- dcplusplus/trunk/client/HashManager.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/HashManager.h 2006-05-03 21:47:14 UTC (rev 601) @@ -272,8 +272,3 @@ }; #endif // !defined(HASH_MANAGER_H) - -/** - * @file - * $Id: HashManager.h,v 1.34 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/HashValue.h =================================================================== --- dcplusplus/trunk/client/HashValue.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/HashValue.h 2006-05-03 21:47:14 UTC (rev 601) @@ -58,8 +58,3 @@ }; #endif // !defined(HASH_VALUE_H) - -/** - * @file - * $Id: HashValue.h,v 1.14 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/HttpConnection.cpp =================================================================== --- dcplusplus/trunk/client/HttpConnection.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/HttpConnection.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -158,8 +158,3 @@ void HttpConnection::on(BufferedSocketListener::Data, u_int8_t* aBuf, size_t aLen) throw() { fire(HttpConnectionListener::Data(), this, aBuf, aLen); } - -/** - * @file - * $Id: HttpConnection.cpp,v 1.33 2006/01/21 10:38:01 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/HttpConnection.h =================================================================== --- dcplusplus/trunk/client/HttpConnection.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/HttpConnection.h 2006-05-03 21:47:14 UTC (rev 601) @@ -87,8 +87,3 @@ }; #endif // !defined(HTTP_CONNECTION_H) - -/** - * @file - * $Id: HttpConnection.h,v 1.28 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/LogManager.cpp =================================================================== --- dcplusplus/trunk/client/LogManager.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/LogManager.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -20,8 +20,3 @@ #include "DCPlusPlus.h" #include "LogManager.h" - -/** - * @file - * $Id: LogManager.cpp,v 1.9 2005/04/24 08:13:11 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/LogManager.h =================================================================== --- dcplusplus/trunk/client/LogManager.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/LogManager.h 2006-05-03 21:47:14 UTC (rev 601) @@ -121,8 +121,3 @@ #define LOG(area, msg) LogManager::getInstance()->log(area, msg) #endif // !defined(LOG_MANAGER_H) - -/** - * @file - * $Id: LogManager.h,v 1.22 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/MerkleCheckOutputStream.h =================================================================== --- dcplusplus/trunk/client/MerkleCheckOutputStream.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/MerkleCheckOutputStream.h 2006-05-03 21:47:14 UTC (rev 601) @@ -113,8 +113,3 @@ }; #endif // !defined(MERKLE_CHECK_OUTPUT_STREAM_H) - -/** - * @file - * $Id: MerkleCheckOutputStream.h,v 1.5 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/MerkleTree.h =================================================================== --- dcplusplus/trunk/client/MerkleTree.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/MerkleTree.h 2006-05-03 21:47:14 UTC (rev 601) @@ -227,8 +227,3 @@ }; #endif // !defined(MERKLE_TREE_H) - -/** - * @file - * $Id: MerkleTree.h,v 1.27 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/client/NmdcHub.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/NmdcHub.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -808,9 +808,3 @@ fire(ClientListener::Failed(), this, aLine); } - -/** - * @file - * $Id: NmdcHub.cpp,v 1.55 2006/02/19 20:39:20 arnetheduck Exp $ - */ - Modified: dcplusplus/trunk/client/NmdcHub.h =================================================================== --- dcplusplus/trunk/client/NmdcHub.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/NmdcHub.h 2006-05-03 21:47:14 UTC (rev 601) @@ -127,8 +127,3 @@ }; #endif // !defined(NMDC_HUB_H) - -/** - * @file - * $Id: NmdcHub.h,v 1.33 2006/02/19 23:51:31 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Pointer.h =================================================================== --- dcplusplus/trunk/client/Pointer.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Pointer.h 2006-05-03 21:47:14 UTC (rev 601) @@ -163,8 +163,3 @@ }; #endif // !defined(POINTER_H) - -/** - * @file - * $Id: Pointer.h,v 1.22 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/QueueItem.h =================================================================== --- dcplusplus/trunk/client/QueueItem.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/QueueItem.h 2006-05-03 21:47:14 UTC (rev 601) @@ -279,8 +279,3 @@ }; #endif // !defined(QUEUE_ITEM_H) - -/** - * @file - * $Id: QueueItem.h,v 1.25 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/QueueManager.cpp =================================================================== --- dcplusplus/trunk/client/QueueManager.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/QueueManager.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -1385,8 +1385,3 @@ saveQueue(); } } - -/** - * @file - * $Id: QueueManager.cpp,v 1.146 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/QueueManager.h =================================================================== --- dcplusplus/trunk/client/QueueManager.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/QueueManager.h 2006-05-03 21:47:14 UTC (rev 601) @@ -234,8 +234,3 @@ }; #endif // !defined(QUEUE_MANAGER_H) - -/** - * @file - * $Id: QueueManager.h,v 1.75 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/QueueManagerListener.h =================================================================== --- dcplusplus/trunk/client/QueueManagerListener.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/QueueManagerListener.h 2006-05-03 21:47:14 UTC (rev 601) @@ -50,8 +50,3 @@ }; #endif // !defined(QUEUE_MANAGER_LISTENER_H) - -/** - * @file - * $Id: QueueManagerListener.h,v 1.12 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/ResourceManager.cpp =================================================================== --- dcplusplus/trunk/client/ResourceManager.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/ResourceManager.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -67,8 +67,3 @@ Text::utf8ToWide(strings[i], wstrings[i]); } } - -/** - * @file - * $Id: ResourceManager.cpp,v 1.15 2006/01/05 00:11:31 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/ResourceManager.h =================================================================== --- dcplusplus/trunk/client/ResourceManager.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/ResourceManager.h 2006-05-03 21:47:14 UTC (rev 601) @@ -77,8 +77,3 @@ #endif // !defined(RESOURCE_MANAGER_H) - -/** - * @file - * $Id: ResourceManager.h,v 1.17 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/SFVReader.cpp =================================================================== --- dcplusplus/trunk/client/SFVReader.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/SFVReader.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -98,8 +98,3 @@ #endif } - -/** - * @file - * $Id: SFVReader.cpp,v 1.11 2005/04/24 08:13:37 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/SFVReader.h =================================================================== --- dcplusplus/trunk/client/SFVReader.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/SFVReader.h 2006-05-03 21:47:14 UTC (rev 601) @@ -54,8 +54,3 @@ }; #endif // !defined(SFV_READER_H) - -/** - * @file - * $Id: SFVReader.h,v 1.7 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/SearchManager.cpp =================================================================== --- dcplusplus/trunk/client/SearchManager.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/SearchManager.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -366,8 +366,3 @@ return tmp; } - -/** - * @file - * $Id: SearchManager.cpp,v 1.67 2006/02/13 21:13:27 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/SearchManager.h =================================================================== --- dcplusplus/trunk/client/SearchManager.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/SearchManager.h 2006-05-03 21:47:14 UTC (rev 601) @@ -187,8 +187,3 @@ }; #endif // !defined(SEARCH_MANAGER_H) - -/** - * @file - * $Id: SearchManager.h,v 1.59 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/SearchManagerListener.h =================================================================== --- dcplusplus/trunk/client/SearchManagerListener.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/SearchManagerListener.h 2006-05-03 21:47:14 UTC (rev 601) @@ -35,8 +35,3 @@ }; #endif // !defined(SEARCH_MANAGER_LISTENER_H) - -/** - * @file - * $Id: SearchManagerListener.h,v 1.9 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Semaphore.h =================================================================== --- dcplusplus/trunk/client/Semaphore.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Semaphore.h 2006-05-03 21:47:14 UTC (rev 601) @@ -96,8 +96,3 @@ }; #endif // !defined(SEMAPHORE_H) - -/** - * @file - * $Id: Semaphore.h,v 1.15 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/ServerSocket.cpp =================================================================== --- dcplusplus/trunk/client/ServerSocket.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/ServerSocket.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -30,8 +30,3 @@ socket.bind(aPort, SETTING(BIND_ADDRESS)); socket.listen(); } - -/** - * @file - * $Id: ServerSocket.cpp,v 1.18 2005/11/27 19:19:20 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/ServerSocket.h =================================================================== --- dcplusplus/trunk/client/ServerSocket.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/ServerSocket.h 2006-05-03 21:47:14 UTC (rev 601) @@ -58,8 +58,3 @@ }; #endif // !defined(SERVER_SOCKET_H) - -/** - * @file - * $Id: ServerSocket.h,v 1.29 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/client/SettingsManager.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/SettingsManager.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -420,8 +420,3 @@ // ... } } - -/** - * @file - * $Id: SettingsManager.cpp,v 1.142 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/SettingsManager.h =================================================================== --- dcplusplus/trunk/client/SettingsManager.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/SettingsManager.h 2006-05-03 21:47:14 UTC (rev 601) @@ -204,8 +204,3 @@ #define BOOLSETTING(k) (SettingsManager::getInstance()->getBool(SettingsManager::k, true)) #endif // !defined(SETTINGS_MANAGER_H) - -/** - * @file - * $Id: SettingsManager.h,v 1.112 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/ShareManager.cpp =================================================================== --- dcplusplus/trunk/client/ShareManager.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/ShareManager.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -1518,8 +1518,3 @@ } } } - -/** - * @file - * $Id: ShareManager.cpp,v 1.145 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/ShareManager.h =================================================================== --- dcplusplus/trunk/client/ShareManager.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/ShareManager.h 2006-05-03 21:47:14 UTC (rev 601) @@ -329,8 +329,3 @@ }; #endif // !defined(SHARE_MANAGER_H) - -/** - * @file - * $Id: ShareManager.h,v 1.87 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/SimpleXML.cpp =================================================================== --- dcplusplus/trunk/client/SimpleXML.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/SimpleXML.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -330,8 +330,3 @@ current = &root; resetCurrentChild(); } - -/** - * @file - * $Id: SimpleXML.cpp,v 1.32 2005/04/24 08:13:11 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/SimpleXML.h =================================================================== --- dcplusplus/trunk/client/SimpleXML.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/SimpleXML.h 2006-05-03 21:47:14 UTC (rev 601) @@ -281,8 +281,3 @@ }; #endif // !defined(SIMPLE_XML_H) - -/** - * @file - * $Id: SimpleXML.h,v 1.46 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Singleton.h =================================================================== --- dcplusplus/trunk/client/Singleton.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Singleton.h 2006-05-03 21:47:14 UTC (rev 601) @@ -57,8 +57,3 @@ template<class T> T* Singleton<T>::instance = NULL; #endif // !defined(SINGLETON_H) - -/** - * @file - * $Id: Singleton.h,v 1.10 2005/04/24 08:13:11 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Socket.cpp =================================================================== --- dcplusplus/trunk/client/Socket.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Socket.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -580,8 +580,3 @@ shutdown(); close(); } - -/** - * @file - * $Id: Socket.cpp,v 1.72 2005/12/16 01:00:46 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Socket.h =================================================================== --- dcplusplus/trunk/client/Socket.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Socket.h 2006-05-03 21:47:14 UTC (rev 601) @@ -246,8 +246,3 @@ }; #endif // !defined(SOCKET_H) - -/** - * @file - * $Id: Socket.h,v 1.67 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Speaker.h =================================================================== --- dcplusplus/trunk/client/Speaker.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Speaker.h 2006-05-03 21:47:14 UTC (rev 601) @@ -122,8 +122,3 @@ }; #endif // !defined(SPEAKER_H) - -/** - * @file - * $Id: Speaker.h,v 1.10 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Streams.h =================================================================== --- dcplusplus/trunk/client/Streams.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Streams.h 2006-05-03 21:47:14 UTC (rev 601) @@ -192,8 +192,3 @@ #endif // !defined(STREAMS_H) - -/** - * @file - * $Id: Streams.h,v 1.7 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/StringSearch.h =================================================================== --- dcplusplus/trunk/client/StringSearch.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/StringSearch.h 2006-05-03 21:47:14 UTC (rev 601) @@ -115,8 +115,3 @@ }; #endif // !defined(STRING_SEARCH_H) - -/** - * @file - * $Id: StringSearch.h,v 1.10 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/StringTokenizer.cpp =================================================================== --- dcplusplus/trunk/client/StringTokenizer.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/StringTokenizer.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -20,8 +20,3 @@ #include "DCPlusPlus.h" #include "StringTokenizer.h" - -/** - * @file - * $Id: StringTokenizer.cpp,v 1.12 2005/04/24 08:13:36 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/StringTokenizer.h =================================================================== --- dcplusplus/trunk/client/StringTokenizer.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/StringTokenizer.h 2006-05-03 21:47:14 UTC (rev 601) @@ -58,8 +58,3 @@ }; #endif // !defined(STRING_TOKENIZER_H) - -/** - * @file - * $Id: StringTokenizer.h,v 1.10 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Text.cpp =================================================================== --- dcplusplus/trunk/client/Text.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Text.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -259,8 +259,3 @@ } return tmp; } - -/** - * @file - * $Id: Text.cpp,v 1.11 2005/12/03 20:36:49 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Text.h =================================================================== --- dcplusplus/trunk/client/Text.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Text.h 2006-05-03 21:47:14 UTC (rev 601) @@ -124,8 +124,3 @@ }; #endif // !defined(TEXT_H) - -/** - * @file - * $Id: Text.h,v 1.9 2005/04/24 08:13:10 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Thread.cpp =================================================================== --- dcplusplus/trunk/client/Thread.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Thread.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -39,8 +39,3 @@ } } #endif - -/** - * @file - * $Id: Thread.cpp,v 1.10 2005/04/24 08:13:36 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Thread.h =================================================================== --- dcplusplus/trunk/client/Thread.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Thread.h 2006-05-03 21:47:14 UTC (rev 601) @@ -145,8 +145,3 @@ }; #endif // !defined(THREAD_H) - -/** - * @file - * $Id: Thread.h,v 1.23 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/TigerHash.cpp =================================================================== --- dcplusplus/trunk/client/TigerHash.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/TigerHash.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -679,8 +679,3 @@ _ULL(0xCD56D9430EA8280E) /* 1020 */, _ULL(0xC12591D7535F5065) /* 1021 */, _ULL(0xC83223F1720AEF96) /* 1022 */, _ULL(0xC3A0396F7363A51F) /* 1023 */ }; - -/** - * @file - * $Id: TigerHash.cpp,v 1.7 2005/04/24 08:13:11 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/TigerHash.h =================================================================== --- dcplusplus/trunk/client/TigerHash.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/TigerHash.h 2006-05-03 21:47:14 UTC (rev 601) @@ -58,8 +58,3 @@ }; #endif // !defined(TIGER_HASH_H) - -/** - * @file - * $Id: TigerHash.h,v 1.9 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/TimerManager.cpp =================================================================== --- dcplusplus/trunk/client/TimerManager.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/TimerManager.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -44,8 +44,3 @@ return 0; } - -/** - * @file - * $Id: TimerManager.cpp,v 1.19 2005/04/24 08:13:11 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/TimerManager.h =================================================================== --- dcplusplus/trunk/client/TimerManager.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/TimerManager.h 2006-05-03 21:47:14 UTC (rev 601) @@ -92,8 +92,3 @@ #define GET_TIME() TimerManager::getTime() #endif // !defined(TIMER_MANAGER_H) - -/** - * @file - * $Id: TimerManager.h,v 1.30 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/UploadManager.cpp =================================================================== --- dcplusplus/trunk/client/UploadManager.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/UploadManager.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -513,8 +513,3 @@ clearUserFiles(aUser); } } - -/** - * @file - * $Id: UploadManager.cpp,v 1.104 2006/02/05 17:02:38 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/UploadManager.h =================================================================== --- dcplusplus/trunk/client/UploadManager.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/UploadManager.h 2006-05-03 21:47:14 UTC (rev 601) @@ -196,8 +196,3 @@ }; #endif // !defined(UPLOAD_MANAGER_H) - -/** - * @file - * $Id: UploadManager.h,v 1.86 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/User.cpp =================================================================== --- dcplusplus/trunk/client/User.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/User.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -63,8 +63,3 @@ } return false; } - -/** - * @file - * $Id: User.cpp,v 1.53 2006/02/17 19:23:51 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/User.h =================================================================== --- dcplusplus/trunk/client/User.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/User.h 2006-05-03 21:47:14 UTC (rev 601) @@ -185,8 +185,3 @@ }; #endif // !defined(USER_H) - -/** - * @file - * $Id: User.h,v 1.71 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/UserCommand.h =================================================================== --- dcplusplus/trunk/client/UserCommand.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/UserCommand.h 2006-05-03 21:47:14 UTC (rev 601) @@ -75,8 +75,3 @@ }; #endif // !defined(USER_COMMAND_H) - -/** - * @file - * $Id: UserCommand.h,v 1.14 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/UserConnection.cpp =================================================================== --- dcplusplus/trunk/client/UserConnection.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/UserConnection.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -206,8 +206,3 @@ delete this; } - -/** - * @file - * $Id: UserConnection.cpp,v 1.58 2006/02/12 18:16:12 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/UserConnection.h =================================================================== --- dcplusplus/trunk/client/UserConnection.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/UserConnection.h 2006-05-03 21:47:14 UTC (rev 601) @@ -361,8 +361,3 @@ }; #endif // !defined(USER_CONNECTION_H) - -/** - * @file - * $Id: UserConnection.h,v 1.107 2006/02/19 17:19:04 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Util.cpp =================================================================== --- dcplusplus/trunk/client/Util.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Util.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -945,8 +945,3 @@ } return tmp2; } - -/** - * @file - * $Id: Util.cpp,v 1.95 2006/02/18 23:32:17 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/Util.h =================================================================== --- dcplusplus/trunk/client/Util.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/Util.h 2006-05-03 21:47:14 UTC (rev 601) @@ -605,8 +605,3 @@ }; #endif // !defined(UTIL_H) - -/** - * @file - * $Id: Util.h,v 1.128 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/ZUtils.cpp =================================================================== --- dcplusplus/trunk/client/ZUtils.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/ZUtils.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -125,8 +125,3 @@ insize = insize - zs.avail_in; return err == Z_OK; } - -/** - * @file - * $Id: ZUtils.cpp,v 1.10 2006/01/29 18:48:25 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/ZUtils.h =================================================================== --- dcplusplus/trunk/client/ZUtils.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/ZUtils.h 2006-05-03 21:47:14 UTC (rev 601) @@ -80,8 +80,3 @@ }; #endif // !defined(_Z_UTILS_H) - -/** - * @file - * $Id: ZUtils.h,v 1.8 2005/04/24 08:13:11 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/config.h =================================================================== --- dcplusplus/trunk/client/config.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/config.h 2006-05-03 21:47:14 UTC (rev 601) @@ -128,8 +128,3 @@ #endif #endif // !defined(CONFIG_H) - -/** - * @file - * $Id: config.h,v 1.41 2006/02/13 21:13:27 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/stdinc.cpp =================================================================== --- dcplusplus/trunk/client/stdinc.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/stdinc.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -29,8 +29,3 @@ #endif #endif // HAS_STLPORT - -/** - * @file - * $Id: stdinc.cpp,v 1.8 2005/04/24 08:13:36 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/stdinc.h =================================================================== --- dcplusplus/trunk/client/stdinc.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/stdinc.h 2006-05-03 21:47:14 UTC (rev 601) @@ -133,8 +133,3 @@ #endif // __GLIBCPP__ #endif // !defined(STDINC_H) - -/** - * @file - * $Id: stdinc.h,v 1.22 2006/02/18 23:32:17 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/client/version.h =================================================================== --- dcplusplus/trunk/client/version.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/client/version.h 2006-05-03 21:47:14 UTC (rev 601) @@ -17,8 +17,8 @@ */ #define APPNAME "DC++" -#define VERSIONSTRING "0.689" -#define VERSIONFLOAT 0.689 +#define VERSIONSTRING "0.69" +#define VERSIONFLOAT 0.69 /* Update the .rc file as well... */ Modified: dcplusplus/trunk/windows/ADLSProperties.cpp =================================================================== --- dcplusplus/trunk/windows/ADLSProperties.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/windows/ADLSProperties.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -99,8 +99,3 @@ EndDialog(wID); return 0; } - -/** - * @file - * $Id: ADLSProperties.cpp,v 1.10 2005/04/24 08:13:03 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/windows/ADLSProperties.h =================================================================== --- dcplusplus/trunk/windows/ADLSProperties.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/windows/ADLSProperties.h 2006-05-03 21:47:14 UTC (rev 601) @@ -59,8 +59,3 @@ }; #endif // !defined(ADLS_PROPERTIES_H) - -/** - * @file - * $Id: ADLSProperties.h,v 1.5 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/windows/ADLSearchFrame.cpp =================================================================== --- dcplusplus/trunk/windows/ADLSearchFrame.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/windows/ADLSearchFrame.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -546,8 +546,3 @@ // Update 'Active' check box ctrlList.SetCheckState(index, search.isActive); } - -/** - * @file - * $Id: ADLSearchFrame.cpp,v 1.26 2005/11/28 01:21:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/windows/ADLSearchFrame.h =================================================================== --- dcplusplus/trunk/windows/ADLSearchFrame.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/windows/ADLSearchFrame.h 2006-05-03 21:47:14 UTC (rev 601) @@ -145,8 +145,3 @@ }; #endif // !defined(ADL_SEARCH_FRAME_H) - -/** - * @file - * $Id: ADLSearchFrame.h,v 1.13 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/windows/AboutDlg.h =================================================================== --- dcplusplus/trunk/windows/AboutDlg.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/windows/AboutDlg.h 2006-05-03 21:47:14 UTC (rev 601) @@ -128,8 +128,3 @@ }; #endif // !defined(ABOUT_DLG_H) - -/** - * @file - * $Id: AboutDlg.h,v 1.58 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/windows/Advanced3Page.cpp =================================================================== --- dcplusplus/trunk/windows/Advanced3Page.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/windows/Advanced3Page.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -100,8 +100,3 @@ HtmlHelp(m_hWnd, WinUtil::getHelpFile().c_str(), HH_HELP_CONTEXT, IDD_ADVANCED3PAGE); return 0; } - -/** - * @file - * $Id: Advanced3Page.cpp,v 1.14 2006/02/10 07:56:47 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/windows/Advanced3Page.h =================================================================== --- dcplusplus/trunk/windows/Advanced3Page.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/windows/Advanced3Page.h 2006-05-03 21:47:14 UTC (rev 601) @@ -58,8 +58,3 @@ }; #endif // !defined(ADVANCED3_PAGE_H) - -/** - * @file - * $Id: Advanced3Page.h,v 1.5 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/windows/AdvancedPage.cpp =================================================================== --- dcplusplus/trunk/windows/AdvancedPage.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/windows/AdvancedPage.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -72,8 +72,3 @@ HtmlHelp(m_hWnd, WinUtil::getHelpFile().c_str(), HH_HELP_CONTEXT, IDD_ADVANCEDPAGE); return 0; } - -/** - * @file - * $Id: AdvancedPage.cpp,v 1.58 2006/01/06 14:44:32 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/windows/AdvancedPage.h =================================================================== --- dcplusplus/trunk/windows/AdvancedPage.h 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/windows/AdvancedPage.h 2006-05-03 21:47:14 UTC (rev 601) @@ -57,8 +57,3 @@ }; #endif // !defined(ADVANCED_PAGE_H) - -/** - * @file - * $Id: AdvancedPage.h,v 1.16 2006/02/19 16:19:06 arnetheduck Exp $ - */ Modified: dcplusplus/trunk/windows/Appearance2Page.cpp =================================================================== --- dcplusplus/trunk/windows/Appearance2Page.cpp 2006-04-30 12:13:44 UTC (rev 600) +++ dcplusplus/trunk/windows/Appearance2Page.cpp 2006-05-03 21:47:14 UTC (rev 601) @@ -176,8 +176,3 @@ HtmlHelp(m_hWnd, WinUtil::getHelpFile().c_str(), HH_HELP_CONTEXT, ... [truncated message content] |
From: <arn...@us...> - 2006-04-30 12:14:25
|
Revision: 600 Author: arnetheduck Date: 2006-04-30 05:13:44 -0700 (Sun, 30 Apr 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=600&view=rev Log Message: ----------- Updated yaSSL Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/yassl/README dcplusplus/trunk/yassl/include/crypto_wrapper.hpp dcplusplus/trunk/yassl/include/openssl/ssl.h dcplusplus/trunk/yassl/include/yassl_imp.hpp dcplusplus/trunk/yassl/include/yassl_types.hpp dcplusplus/trunk/yassl/src/crypto_wrapper.cpp dcplusplus/trunk/yassl/src/handshake.cpp dcplusplus/trunk/yassl/src/ssl.cpp dcplusplus/trunk/yassl/src/yassl_imp.cpp dcplusplus/trunk/yassl/src/yassl_int.cpp dcplusplus/trunk/yassl/taocrypt/include/asn.hpp dcplusplus/trunk/yassl/taocrypt/include/dh.hpp dcplusplus/trunk/yassl/taocrypt/src/aes.cpp dcplusplus/trunk/yassl/taocrypt/src/arc4.cpp dcplusplus/trunk/yassl/taocrypt/src/coding.cpp dcplusplus/trunk/yassl/taocrypt/src/dh.cpp dcplusplus/trunk/yassl/taocrypt/src/random.cpp dcplusplus/trunk/yassl/yassl.vcproj Added Paths: ----------- dcplusplus/trunk/yassl/src/yassl.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/changelog.txt 2006-04-30 12:13:44 UTC (rev 600) @@ -6,6 +6,7 @@ * Saved users file more often to have fewer missing nicks around * CID of user shown if nick is missing (in queue for example) * Added display of CID in a few places +* Updated yaSSL to 1.2.2 -- 0.689 2006-04-01 -- * Fixed displaying of available bytes when user list is off Modified: dcplusplus/trunk/yassl/README =================================================================== --- dcplusplus/trunk/yassl/README 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/README 2006-04-30 12:13:44 UTC (rev 600) @@ -1,6 +1,26 @@ -yaSSL Release notes, version 1.1.5 +yaSSL Release notes, version 1.2.2 (03/27/06) + + This release of yaSSL contains minor bug fixes and portability enhancements. + +See build instructions below under 1.0.6: + + + +*****************yaSSL Release notes, version 1.2.0 + + This release of yaSSL contains minor bug fixes, portability enhancements, + Diffie-Hellman compatibility fixes for other servers and client, + optimization improvements, and x86 ASM changes. + +See build instructions below under 1.0.6: + + + +*****************yaSSL Release notes, version 1.1.5 + + This release of yaSSL contains minor bug fixes, portability enhancements, and user requested changes including the ability to add all certificates in a directory, more robust socket handling, no new overloading unless requested, and an SSL_VERIFY_NONE option. Modified: dcplusplus/trunk/yassl/include/crypto_wrapper.hpp =================================================================== --- dcplusplus/trunk/yassl/include/crypto_wrapper.hpp 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/include/crypto_wrapper.hpp 2006-04-30 12:13:44 UTC (rev 600) @@ -41,8 +41,8 @@ namespace yaSSL { -// Digest policy should implement a get_digest, update, and get sizes for pad and -// digest +// Digest policy should implement a get_digest, update, and get sizes for pad +// and digest struct Digest : public virtual_base { virtual void get_digest(byte*) = 0; virtual void get_digest(byte*, const byte*, unsigned int) = 0; @@ -380,7 +380,7 @@ uint get_agreedKeyLength() const; const byte* get_agreedKey() const; const byte* get_publicKey() const; - void makeAgreement(const byte*); + void makeAgreement(const byte*, unsigned int); void set_sizes(int&, int&, int&) const; void get_parms(byte*, byte*, byte*) const; Modified: dcplusplus/trunk/yassl/include/openssl/ssl.h =================================================================== --- dcplusplus/trunk/yassl/include/openssl/ssl.h 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/include/openssl/ssl.h 2006-04-30 12:13:44 UTC (rev 600) @@ -50,11 +50,11 @@ class X509; class X509_NAME; #else - typedef struct SSL SSL; - typedef struct SSL_SESION SSL_SESSION; - typedef struct SSL_METHOD SSL_METHOD; - typedef struct SSL_CTX SSL_CTX; - typedef struct SSL_CIPHER SSL_CIPHER; + typedef struct SSL SSL; + typedef struct SSL_SESSION SSL_SESSION; + typedef struct SSL_METHOD SSL_METHOD; + typedef struct SSL_CTX SSL_CTX; + typedef struct SSL_CIPHER SSL_CIPHER; typedef struct RSA RSA; Modified: dcplusplus/trunk/yassl/include/yassl_imp.hpp =================================================================== --- dcplusplus/trunk/yassl/include/yassl_imp.hpp 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/include/yassl_imp.hpp 2006-04-30 12:13:44 UTC (rev 600) @@ -662,7 +662,7 @@ uint8 suites_size_; Cipher suites_[MAX_SUITE_SZ]; char cipher_name_[MAX_SUITE_NAME]; - char cipher_list_[MAX_CIPHER_LIST]; + char cipher_list_[MAX_CIPHERS][MAX_SUITE_NAME]; Parameters(ConnectionEnd, const Ciphers&, ProtocolVersion); Modified: dcplusplus/trunk/yassl/include/yassl_types.hpp =================================================================== --- dcplusplus/trunk/yassl/include/yassl_types.hpp 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/include/yassl_types.hpp 2006-04-30 12:13:44 UTC (rev 600) @@ -132,7 +132,7 @@ const int FORTEZZA_MAX = 128; // Maximum Fortezza Key length const int MAX_SUITE_SZ = 64; // 32 max suites * sizeof(suite) const int MAX_SUITE_NAME = 48; // max length of suite name -const int MAX_CIPHER_LIST = 512; // max length of cipher list names +const int MAX_CIPHERS = 32; // max supported ciphers for cipher list const int SIZEOF_ENUM = 1; // SSL considers an enum 1 byte, not 4 const int SIZEOF_SENDER = 4; // Sender constant, for finished generation const int PAD_MD5 = 48; // pad length 1 and 2 for md5 finished Modified: dcplusplus/trunk/yassl/src/crypto_wrapper.cpp =================================================================== --- dcplusplus/trunk/yassl/src/crypto_wrapper.cpp 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/src/crypto_wrapper.cpp 2006-04-30 12:13:44 UTC (rev 600) @@ -855,9 +855,9 @@ } -void DiffieHellman::makeAgreement(const byte* other) +void DiffieHellman::makeAgreement(const byte* other, unsigned int otherSz) { - pimpl_->dh_.Agree(pimpl_->agreedKey_, pimpl_->privateKey_, other); + pimpl_->dh_.Agree(pimpl_->agreedKey_, pimpl_->privateKey_, other, otherSz); } Modified: dcplusplus/trunk/yassl/src/handshake.cpp =================================================================== --- dcplusplus/trunk/yassl/src/handshake.cpp 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/src/handshake.cpp 2006-04-30 12:13:44 UTC (rev 600) @@ -605,7 +605,7 @@ void PRF(byte* digest, uint digLen, const byte* secret, uint secLen, const byte* label, uint labLen, const byte* seed, uint seedLen) { - uint half = secLen / 2 + secLen % 2; + uint half = (secLen + 1) / 2; output_buffer md5_half(half); output_buffer sha_half(half); Modified: dcplusplus/trunk/yassl/src/ssl.cpp =================================================================== --- dcplusplus/trunk/yassl/src/ssl.cpp 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/src/ssl.cpp 2006-04-30 12:13:44 UTC (rev 600) @@ -291,9 +291,15 @@ } -const char* SSL_get_cipher_list(SSL* ssl, int /*priority */) +const char* SSL_get_cipher_list(SSL* ssl, int priority) { - return ssl->getSecurity().get_parms().cipher_list_; + if (priority < 0 || priority >= MAX_CIPHERS) + return 0; + + if (ssl->getSecurity().get_parms().cipher_list_[priority][0]) + return ssl->getSecurity().get_parms().cipher_list_[priority]; + + return 0; } Added: dcplusplus/trunk/yassl/src/yassl.cpp =================================================================== --- dcplusplus/trunk/yassl/src/yassl.cpp (rev 0) +++ dcplusplus/trunk/yassl/src/yassl.cpp 2006-04-30 12:13:44 UTC (rev 600) @@ -0,0 +1,244 @@ +/* yassl.cpp + * + * Copyright (C) 2003 Sawtooth Consulting Ltd. + * + * This file is part of yaSSL. + * + * yaSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * yaSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + + +/* yaSSL implements external API + */ + +#include "runtime.hpp" +#include "yassl.hpp" +#include "yassl_int.hpp" +#include "handshake.hpp" +#include <stdio.h> + +#include "openssl/ssl.h" // get rid of this + + +// yaSSL overloads hide these +void* operator new[](size_t sz) +{ + return ::operator new(sz); +} + +void operator delete[](void* ptr) +{ + ::operator delete(ptr); +} + + +namespace yaSSL { + +using mySTL::min; + + +struct Base { + SSL_METHOD* method_; + SSL_CTX* ctx_; + SSL* ssl_; + + char* ca_; + char* cert_; + char* key_; + + DH* dh_; + + Base() : method_(0), ctx_(0), ssl_(0), ca_(0), cert_(0), key_(0), dh_(0) + {} + + ~Base() + { + if (dh_) DH_free(dh_); + delete[] key_; + delete[] cert_; + delete[] ca_; + SSL_CTX_free(ctx_); // frees method_ too + SSL_free(ssl_); + } +}; + + +void SetDH(Base&); + +void SetUpBase(Base& base, ConnectionEnd end, SOCKET_T s) +{ + base.method_ = new SSL_METHOD(end, ProtocolVersion(3,1)); + base.ctx_ = new SSL_CTX(base.method_); + + if (base.ca_) + if (SSL_CTX_load_verify_locations(base.ctx_, + base.ca_, 0) != SSL_SUCCESS) assert(0); + if (base.cert_) + if (SSL_CTX_use_certificate_file(base.ctx_, + base.cert_, SSL_FILETYPE_PEM) != SSL_SUCCESS) assert(0); + if (base.key_) + if (SSL_CTX_use_PrivateKey_file(base.ctx_, base.key_, + SSL_FILETYPE_PEM) != SSL_SUCCESS) assert(0); + + if (end == server_end) SetDH(base); + + base.ssl_ = new SSL(base.ctx_); + base.ssl_->useSocket().set_fd(s); +} + + +void SetDH(Base& base) +{ + static unsigned char dh512_p[] = + { + 0xDA,0x58,0x3C,0x16,0xD9,0x85,0x22,0x89,0xD0,0xE4,0xAF,0x75, + 0x6F,0x4C,0xCA,0x92,0xDD,0x4B,0xE5,0x33,0xB8,0x04,0xFB,0x0F, + 0xED,0x94,0xEF,0x9C,0x8A,0x44,0x03,0xED,0x57,0x46,0x50,0xD3, + 0x69,0x99,0xDB,0x29,0xD7,0x76,0x27,0x6B,0xA2,0xD3,0xD4,0x12, + 0xE2,0x18,0xF4,0xDD,0x1E,0x08,0x4C,0xF6,0xD8,0x00,0x3E,0x7C, + 0x47,0x74,0xE8,0x33, + }; + + static unsigned char dh512_g[] = + { + 0x02, + }; + + if ( (base.dh_ = DH_new()) ) { + base.dh_->p = BN_bin2bn(dh512_p, sizeof(dh512_p), 0); + base.dh_->g = BN_bin2bn(dh512_g, sizeof(dh512_g), 0); + } + if (!base.dh_->p || !base.dh_->g) { + DH_free(base.dh_); + base.dh_ = 0; + } + SSL_CTX_set_tmp_dh(base.ctx_, base.dh_); +} + + +void NewCopy(char*& dst, const char* src) +{ + size_t len = strlen(src) + 1; + dst = new char[len]; + + strncpy(dst, src, len); +} + + +// Client Implementation +struct Client::ClientImpl { + Base base_; +}; + + +Client::Client() : pimpl_(new ClientImpl) +{} + + +Client::~Client() { delete pimpl_; } + + +int Client::Connect(SOCKET_T s) +{ + SetUpBase(pimpl_->base_, client_end, s); + return SSL_connect(pimpl_->base_.ssl_); +} + + +int Client::Write(const void* buffer, int sz) +{ + return sendData(*pimpl_->base_.ssl_, buffer, sz); +} + + +int Client::Read(void* buffer, int sz) +{ + Data data(min(sz, MAX_RECORD_SIZE), static_cast<opaque*>(buffer)); + return receiveData(*pimpl_->base_.ssl_, data); +} + + +void Client::SetCA(const char* name) +{ + NewCopy(pimpl_->base_.ca_, name); +} + + +void Client::SetCert(const char* name) +{ + NewCopy(pimpl_->base_.cert_, name); +} + + +void Client::SetKey(const char* name) +{ + NewCopy(pimpl_->base_.key_, name); +} + + + +// Server Implementation +struct Server::ServerImpl { + Base base_; +}; + + +Server::Server() : pimpl_(new ServerImpl) +{} + + +Server::~Server() { delete pimpl_; } + + +int Server::Accept(SOCKET_T s) +{ + SetUpBase(pimpl_->base_, server_end, s); + return SSL_accept(pimpl_->base_.ssl_); +} + + +int Server::Write(const void* buffer, int sz) +{ + return sendData(*pimpl_->base_.ssl_, buffer, sz); +} + + +int Server::Read(void* buffer, int sz) +{ + Data data(min(sz, MAX_RECORD_SIZE), static_cast<opaque*>(buffer)); + return receiveData(*pimpl_->base_.ssl_, data); +} + + +void Server::SetCA(const char* name) +{ + NewCopy(pimpl_->base_.ca_, name); +} + + +void Server::SetCert(const char* name) +{ + NewCopy(pimpl_->base_.cert_, name); +} + + +void Server::SetKey(const char* name) +{ + NewCopy(pimpl_->base_.key_, name); +} + + + +} // namespace yaSSL Modified: dcplusplus/trunk/yassl/src/yassl_imp.cpp =================================================================== --- dcplusplus/trunk/yassl/src/yassl_imp.cpp 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/src/yassl_imp.cpp 2006-04-30 12:13:44 UTC (rev 600) @@ -29,6 +29,7 @@ #include "asn.hpp" // provide crypto wrapper?? + namespace yaSSL { @@ -111,11 +112,15 @@ uint keyLength = dhClient.get_agreedKeyLength(); // pub and agree same alloc(keyLength, true); - dhClient.makeAgreement(dhServer.get_publicKey()); + dhClient.makeAgreement(dhServer.get_publicKey(), keyLength); c16toa(keyLength, Yc_); memcpy(Yc_ + KEY_OFFSET, dhClient.get_publicKey(), keyLength); - ssl.set_preMaster(dhClient.get_agreedKey(), keyLength); + // because of encoding first byte might be zero, don't use it for preMaster + if (*dhClient.get_agreedKey() == 0) + ssl.set_preMaster(dhClient.get_agreedKey() + 1, keyLength - 1); + else + ssl.set_preMaster(dhClient.get_agreedKey(), keyLength); } @@ -269,10 +274,14 @@ ato16(tmp, keyLength); alloc(keyLength); - input.read(Yc_, length_); - dh.makeAgreement(Yc_); + input.read(Yc_, keyLength); + dh.makeAgreement(Yc_, keyLength); - ssl.set_preMaster(dh.get_agreedKey(), keyLength); + // because of encoding, first byte might be 0, don't use for preMaster + if (*dh.get_agreedKey() == 0) + ssl.set_preMaster(dh.get_agreedKey() + 1, dh.get_agreedKeyLength() - 1); + else + ssl.set_preMaster(dh.get_agreedKey(), dh.get_agreedKeyLength()); ssl.makeMasterSecret(); } @@ -438,7 +447,7 @@ int i = 0; // available suites, best first // when adding more, make sure cipher_names is updated and - // MAX_CIPHER_LIST is big enough + // MAX_CIPHERS is big enough if (isTLS(pv)) { suites_[i++] = 0x00; @@ -510,13 +519,10 @@ for (int j = 0; j < suites; j++) { int index = suites_[j*2 + 1]; // every other suite is suite id - int len = strlen(cipher_names[index]); - memcpy(&cipher_list_[pos], cipher_names[index], len); - pos += len; - cipher_list_[pos++] = ':'; + int len = strlen(cipher_names[index]) + 1; + strncpy(cipher_list_[pos++], cipher_names[index], len); } - if (suites) - cipher_list_[--pos] = 0; + cipher_list_[pos][0] = 0; } @@ -1630,8 +1636,11 @@ // CertificateRequest processing handler void CertificateRequest::Process(input_buffer&, SSL& ssl) { - if (ssl.useCrypto().use_certManager().get_cert()) - ssl.useCrypto().use_certManager().setSendVerify(); + CertManager& cm = ssl.useCrypto().use_certManager(); + + // make sure user provided cert and key before sending and using + if (cm.get_cert() && cm.get_privateKey()) + cm.setSendVerify(); } Modified: dcplusplus/trunk/yassl/src/yassl_int.cpp =================================================================== --- dcplusplus/trunk/yassl/src/yassl_int.cpp 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/src/yassl_int.cpp 2006-04-30 12:13:44 UTC (rev 600) @@ -832,7 +832,7 @@ int length = 2 * secure_.get_parms().hash_size_ + 2 * secure_.get_parms().key_size_ + 2 * secure_.get_parms().iv_size_; - int rounds = length / MD5_LEN + ((length % MD5_LEN) ? 1 : 0); + int rounds = (length + MD5_LEN - 1 ) / MD5_LEN; input_buffer key_data(rounds * MD5_LEN); opaque sha_output[SHA_LEN]; Modified: dcplusplus/trunk/yassl/taocrypt/include/asn.hpp =================================================================== --- dcplusplus/trunk/yassl/taocrypt/include/asn.hpp 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/taocrypt/include/asn.hpp 2006-04-30 12:13:44 UTC (rev 600) @@ -184,7 +184,7 @@ word32 sz_; public: explicit PublicKey(const byte* k = 0, word32 s = 0); - ~PublicKey() { tcDelete(key_); } + ~PublicKey() { tcArrayDelete(key_); } const byte* GetKey() const { return key_; } word32 size() const { return sz_; } Modified: dcplusplus/trunk/yassl/taocrypt/include/dh.hpp =================================================================== --- dcplusplus/trunk/yassl/taocrypt/include/dh.hpp 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/taocrypt/include/dh.hpp 2006-04-30 12:13:44 UTC (rev 600) @@ -64,7 +64,7 @@ } void GenerateKeyPair(RandomNumberGenerator&, byte*, byte*); - void Agree(byte*, const byte*, const byte*); + void Agree(byte*, const byte*, const byte*, word32 otherSz = 0); void SetP(const Integer& p) { p_ = p; } void SetG(const Integer& g) { g_ = g; } Modified: dcplusplus/trunk/yassl/taocrypt/src/aes.cpp =================================================================== --- dcplusplus/trunk/yassl/taocrypt/src/aes.cpp 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/taocrypt/src/aes.cpp 2006-04-30 12:13:44 UTC (rev 600) @@ -478,9 +478,9 @@ AS2( mov ebp, DWORD PTR [ebp + 20] ) #define EPILOG() \ + AS2( mov esi, [ebp - 4] ) \ AS2( mov esp, ebp ) \ AS2( movd ebx, mm4 ) \ - AS2( mov esi, [ebp - 4] ) \ AS2( movd edi, mm3 ) \ AS1( emms ) \ asm(".att_syntax"); Modified: dcplusplus/trunk/yassl/taocrypt/src/arc4.cpp =================================================================== --- dcplusplus/trunk/yassl/taocrypt/src/arc4.cpp 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/taocrypt/src/arc4.cpp 2006-04-30 12:13:44 UTC (rev 600) @@ -80,7 +80,6 @@ void ARC4::Process(byte* out, const byte* in, word32 length) { - //AsmProcess(out, in, length); if (length == 0) return; byte *const s = state_; @@ -202,7 +201,7 @@ AS2( movzx eax, BYTE PTR [ebp + ecx] ) // xOr w/ inByte - AS2( xor ebx, [esi] ) + AS2( xor bl, BYTE PTR [esi] ) AS1( inc esi ) // write to outByte Modified: dcplusplus/trunk/yassl/taocrypt/src/coding.cpp =================================================================== --- dcplusplus/trunk/yassl/taocrypt/src/coding.cpp 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/taocrypt/src/coding.cpp 2006-04-30 12:13:44 UTC (rev 600) @@ -130,7 +130,7 @@ word32 outSz = bytes * 4 / 3; outSz += (outSz % 4); // 4 byte integrals - outSz += outSz / pemLineSz + ( (outSz % pemLineSz) ? 1 : 0); // new lines + outSz += (outSz + pemLineSz - 1) / pemLineSz; // new lines encoded_.New(outSz); word32 i = 0; @@ -187,9 +187,8 @@ void Base64Decoder::Decode() { word32 bytes = coded_.size(); - word32 plainSz = bytes - (bytes / pemLineSz + ( (bytes % pemLineSz) ? - 1 : 0)); - plainSz = plainSz * 3 / 4 + (( (plainSz * 3) % 4) ? 1 : 0); + word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz); + plainSz = (plainSz * 3 + 3) / 4; decoded_.New(plainSz); word32 i = 0; Modified: dcplusplus/trunk/yassl/taocrypt/src/dh.cpp =================================================================== --- dcplusplus/trunk/yassl/taocrypt/src/dh.cpp 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/taocrypt/src/dh.cpp 2006-04-30 12:13:44 UTC (rev 600) @@ -26,10 +26,26 @@ #include "runtime.hpp" #include "dh.hpp" #include "asn.hpp" +#include <math.h> namespace TaoCrypt { +namespace { // locals + +unsigned int DiscreteLogWorkFactor(unsigned int n) +{ + // assuming discrete log takes about the same time as factoring + if (n<5) + return 0; + else + return (unsigned int)(2.4 * pow((double)n, 1.0/3.0) * + pow(log(double(n)), 2.0/3.0) - 5); +} + +} // namespace locals + + // Generate a DH Key Pair void DH::GenerateKeyPair(RandomNumberGenerator& rng, byte* priv, byte* pub) { @@ -41,7 +57,8 @@ // Generate private value void DH::GeneratePrivate(RandomNumberGenerator& rng, byte* priv) { - Integer x(rng, Integer::One(), p_ - 1); + Integer x(rng, Integer::One(), mySTL::min(p_ - 1, + Integer::Power2(2*DiscreteLogWorkFactor(p_.BitCount())) ) ); x.Encode(priv, p_.ByteCount()); } @@ -57,11 +74,16 @@ // Generate Agreement -void DH::Agree(byte* agree, const byte* priv, const byte* otherPub) +void DH::Agree(byte* agree, const byte* priv, const byte* otherPub, word32 + otherSz) { const word32 bc(p_.ByteCount()); Integer x(priv, bc); - Integer y(otherPub, bc); + Integer y; + if (otherSz) + y.Decode(otherPub, otherSz); + else + y.Decode(otherPub, bc); Integer z(a_exp_b_mod_c(y, x, p_)); z.Encode(agree, bc); Modified: dcplusplus/trunk/yassl/taocrypt/src/random.cpp =================================================================== --- dcplusplus/trunk/yassl/taocrypt/src/random.cpp 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/taocrypt/src/random.cpp 2006-04-30 12:13:44 UTC (rev 600) @@ -26,7 +26,9 @@ #include "runtime.hpp" #include "random.hpp" +#include <string.h> + #if defined(_WIN32) #define _WIN32_WINNT 0x0400 #include <windows.h> @@ -52,6 +54,7 @@ // place a generated block in output void RandomNumberGenerator::GenerateBlock(byte* output, word32 sz) { + memset(output, 0, sz); cipher_.Process(output, output, sz); } Modified: dcplusplus/trunk/yassl/yassl.vcproj =================================================================== --- dcplusplus/trunk/yassl/yassl.vcproj 2006-04-30 11:09:50 UTC (rev 599) +++ dcplusplus/trunk/yassl/yassl.vcproj 2006-04-30 12:13:44 UTC (rev 600) @@ -312,6 +312,9 @@ </FileConfiguration> </File> <File + RelativePath=".\src\yassl.cpp"> + </File> + <File RelativePath="src\yassl_error.cpp"> <FileConfiguration Name="Debug|Win32"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |