From: <arn...@us...> - 2006-09-19 09:42:45
|
Revision: 651 http://svn.sourceforge.net/dcplusplus/?rev=651&view=rev Author: arnetheduck Date: 2006-09-19 02:42:13 -0700 (Tue, 19 Sep 2006) Log Message: ----------- Removed some more code, fixed some utf8 issues Modified Paths: -------------- dcplusplus/trunk/Example.xml dcplusplus/trunk/Extensions.txt dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/DownloadManager.cpp dcplusplus/trunk/client/SearchManager.cpp dcplusplus/trunk/client/SearchManager.h dcplusplus/trunk/client/StringDefs.cpp dcplusplus/trunk/client/StringDefs.h dcplusplus/trunk/client/UploadManager.cpp dcplusplus/trunk/client/UploadManager.h dcplusplus/trunk/client/User.h dcplusplus/trunk/client/UserConnection.cpp dcplusplus/trunk/client/UserConnection.h dcplusplus/trunk/windows/SearchFrm.cpp dcplusplus/trunk/windows/TransferView.cpp Modified: dcplusplus/trunk/Example.xml =================================================================== --- dcplusplus/trunk/Example.xml 2006-09-18 21:40:58 UTC (rev 650) +++ dcplusplus/trunk/Example.xml 2006-09-19 09:42:13 UTC (rev 651) @@ -551,7 +551,7 @@ <String Name="SocksFailed">The socks server failed establish a connection</String> <String Name="SocksNeedsAuth">The socks server requires authentication</String> <String Name="SocksSetupError">Failed to set up the socks server for UDP relay (check socks address and port)</String> - <String Name="SourceTooOld">Source client does not support TTH</String> + <String Name="SourceTooOld">Remote client does not fully support TTH - cannot download</String> <String Name="SourceTooSlow">Source too slow</String> <String Name="SourceType">Source Type</String> <String Name="SpecifySearchString">Specify a search string</String> Modified: dcplusplus/trunk/Extensions.txt =================================================================== --- dcplusplus/trunk/Extensions.txt 2006-09-18 21:40:58 UTC (rev 650) +++ dcplusplus/trunk/Extensions.txt 2006-09-19 09:42:13 UTC (rev 651) @@ -74,6 +74,7 @@ Feature: GetZBlock Since: 0.307 +Deprecated - replaced by ADCGet Usage: Instead of $Get and $Send, use "$GetZBlock <start> <numbytes> <filename>|" where <start> is the 0-based Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-09-18 21:40:58 UTC (rev 650) +++ dcplusplus/trunk/changelog.txt 2006-09-19 09:42:13 UTC (rev 651) @@ -9,6 +9,9 @@ * [ADC] Fixed support for uncompressed files.xml as well as proper files.xml.bz2 support * Some socket code cleanup * Removed broken nick save code +* Upgraded yaSSL to 1.4.0 +* Fixed some SSL connection issues +* Fixed on-the-fly compression of file lists -- 0.695 2006-09-10 -- * PM popup/ignore options updated, in nmdc a hub is any nick which hasn't sent a hello or myinfo, and a bot is a nick with myinfo Modified: dcplusplus/trunk/client/DownloadManager.cpp =================================================================== --- dcplusplus/trunk/client/DownloadManager.cpp 2006-09-18 21:40:58 UTC (rev 650) +++ dcplusplus/trunk/client/DownloadManager.cpp 2006-09-19 09:42:13 UTC (rev 651) @@ -248,6 +248,7 @@ void DownloadManager::addConnection(UserConnection::Ptr conn) { if(!conn->isSet(UserConnection::FLAG_SUPPORTS_TTHF) || !conn->isSet(UserConnection::FLAG_SUPPORTS_ADCGET)) { // Can't download from these... + conn->getUser()->setFlag(User::OLD_CLIENT); QueueManager::getInstance()->removeSource(conn->getUser(), QueueItem::Source::FLAG_NO_TTHF); removeConnection(conn); } Modified: dcplusplus/trunk/client/SearchManager.cpp =================================================================== --- dcplusplus/trunk/client/SearchManager.cpp 2006-09-18 21:40:58 UTC (rev 650) +++ dcplusplus/trunk/client/SearchManager.cpp 2006-09-19 09:42:13 UTC (rev 651) @@ -29,7 +29,7 @@ SearchResult::SearchResult(Types aType, int64_t aSize, const string& aFile, const TTHValue& aTTH) : file(aFile), user(ClientManager::getInstance()->getMe()), size(aSize), type(aType), slots(SETTING(SLOTS)), freeSlots(UploadManager::getInstance()->getFreeSlots()), - tth(aTTH), utf8(true), ref(1) { } + tth(aTTH), ref(1) { } string SearchResult::toSR(const Client& c) const { // File: "$SR %s %s%c%s %d/%d%c%s (%s)|" @@ -39,7 +39,7 @@ tmp.append("$SR ", 4); tmp.append(Text::utf8ToAcp(c.getMyNick())); tmp.append(1, ' '); - string acpFile = utf8 ? Text::utf8ToAcp(file) : file; + string acpFile = Text::utf8ToAcp(file); if(type == TYPE_FILE) { tmp.append(acpFile); tmp.append(1, '\x05'); @@ -63,7 +63,7 @@ AdcCommand cmd(AdcCommand::CMD_RES, type); cmd.addParam("SI", Util::toString(size)); cmd.addParam("SL", Util::toString(freeSlots)); - cmd.addParam("FN", Util::toAdcFile(utf8 ? file : Text::acpToUtf8(file))); + cmd.addParam("FN", Util::toAdcFile(file)); cmd.addParam("TR", getTTH().toBase32()); return cmd; } @@ -211,12 +211,12 @@ if(j < i + 1) { return; } - file = x.substr(i, j-i) + '\\'; + file = Text::acpToUtf8(x.substr(i, j-i)) + '\\'; } else if(cnt == 2) { if( (j = x.find((char)5, i)) == string::npos) { return; } - file = x.substr(i, j-i); + file = Text::acpToUtf8(x.substr(i, j-i)); i = j + 1; if( (j = x.find(' ', i)) == string::npos) { return; @@ -264,7 +264,7 @@ return; SearchResult* sr = new SearchResult(user, type, slots, freeSlots, size, - file, hubName, url, remoteIp, TTHValue(tth), false, Util::emptyString); + file, hubName, url, remoteIp, TTHValue(tth), Util::emptyString); fire(SearchManagerListener::SR(), sr); sr->decRef(); } else if(x.compare(1, 4, "RES ") == 0 && x[x.length() - 1] == 0x0a) { @@ -326,7 +326,7 @@ return; /// @todo Something about the slots SearchResult* sr = new SearchResult(from, type, 0, freeSlots, size, - file, hubName, hub, remoteIp, TTHValue(tth), true, token); + file, hubName, hub, remoteIp, TTHValue(tth), token); fire(SearchManagerListener::SR(), sr); sr->decRef(); } Modified: dcplusplus/trunk/client/SearchManager.h =================================================================== --- dcplusplus/trunk/client/SearchManager.h 2006-09-18 21:40:58 UTC (rev 650) +++ dcplusplus/trunk/client/SearchManager.h 2006-09-19 09:42:13 UTC (rev 651) @@ -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& aToken) : + const string& aHubURL, const string& ip, TTHValue aTTH, const string& aToken) : file(aFile), hubName(aHubName), hubURL(aHubURL), user(aUser), size(aSize), type(aType), slots(aSlots), freeSlots(aFreeSlots), IP(ip), - tth(aTTH), token(aToken), utf8(aUtf8), ref(1) { } + tth(aTTH), token(aToken), ref(1) { } string getFileName() const; string toSR(const Client& client) const; @@ -75,7 +75,6 @@ int getSlots() const { return slots; } int getFreeSlots() const { return freeSlots; } TTHValue getTTH() const { return tth; } - bool getUtf8() const { return utf8; } const string& getIP() const { return IP; } const string& getToken() const { return token; } @@ -105,7 +104,6 @@ TTHValue tth; string token; - bool utf8; volatile long ref; }; Modified: dcplusplus/trunk/client/StringDefs.cpp =================================================================== --- dcplusplus/trunk/client/StringDefs.cpp 2006-09-18 21:40:58 UTC (rev 650) +++ dcplusplus/trunk/client/StringDefs.cpp 2006-09-19 09:42:13 UTC (rev 651) @@ -552,7 +552,7 @@ "The socks server failed establish a connection", "The socks server requires authentication", "Failed to set up the socks server for UDP relay (check socks address and port)", -"Source client does not support TTH", +"Remote client does not fully support TTH - cannot download", "Source too slow", "Source Type", "Specify a search string", Modified: dcplusplus/trunk/client/StringDefs.h =================================================================== --- dcplusplus/trunk/client/StringDefs.h 2006-09-18 21:40:58 UTC (rev 650) +++ dcplusplus/trunk/client/StringDefs.h 2006-09-19 09:42:13 UTC (rev 651) @@ -555,7 +555,7 @@ SOCKS_FAILED, // "The socks server failed establish a connection" SOCKS_NEEDS_AUTH, // "The socks server requires authentication" SOCKS_SETUP_ERROR, // "Failed to set up the socks server for UDP relay (check socks address and port)" - SOURCE_TOO_OLD, // "Source client does not support TTH" + SOURCE_TOO_OLD, // "Remote client does not fully support TTH - cannot download" SOURCE_TOO_SLOW, // "Source too slow" SOURCE_TYPE, // "Source Type" SPECIFY_SEARCH_STRING, // "Specify a search string" Modified: dcplusplus/trunk/client/UploadManager.cpp =================================================================== --- dcplusplus/trunk/client/UploadManager.cpp 2006-09-18 21:40:58 UTC (rev 650) +++ dcplusplus/trunk/client/UploadManager.cpp 2006-09-19 09:42:13 UTC (rev 651) @@ -259,31 +259,6 @@ } } -void UploadManager::onGetBlock(UserConnection* aSource, const string& aFile, int64_t aStartPos, int64_t aBytes, bool z) { - if(!z || BOOLSETTING(COMPRESS_TRANSFERS)) { - if(prepareFile(aSource, "file", Util::toAdcFile(aFile), aStartPos, aBytes)) { - Upload* u = aSource->getUpload(); - dcassert(u != NULL); - if(aBytes == -1) - aBytes = u->getSize() - aStartPos; - - dcassert(aBytes >= 0); - - u->setStart(GET_TICK()); - - if(z) { - u->setFile(new FilteredInputStream<ZFilter, true>(u->getFile())); - u->setFlag(Upload::FLAG_ZUPLOAD); - } - - aSource->sending(aBytes); - aSource->setState(UserConnection::STATE_DONE); - aSource->transmitFile(u->getFile()); - fire(UploadManagerListener::Starting(), u); - } - } -} - void UploadManager::on(UserConnectionListener::Send, UserConnection* aSource) throw() { if(aSource->getState() != UserConnection::STATE_SEND) { dcdebug("UM::onSend Bad state, ignoring\n"); Modified: dcplusplus/trunk/client/UploadManager.h =================================================================== --- dcplusplus/trunk/client/UploadManager.h 2006-09-18 21:40:58 UTC (rev 650) +++ dcplusplus/trunk/client/UploadManager.h 2006-09-19 09:42:13 UTC (rev 651) @@ -182,8 +182,6 @@ virtual void on(BytesSent, UserConnection*, size_t, size_t) throw(); virtual void on(Failed, UserConnection*, const string&) throw(); virtual void on(Get, UserConnection*, const string&, int64_t) throw(); - virtual void on(GetBlock, UserConnection* conn, const string& line, int64_t resume, int64_t bytes) throw() { onGetBlock(conn, line, resume, bytes, false); } - virtual void on(GetZBlock, UserConnection* conn, const string& line, int64_t resume, int64_t bytes) throw() { onGetBlock(conn, line, resume, bytes, true); } virtual void on(Send, UserConnection*) throw(); virtual void on(GetListLength, UserConnection* conn) throw(); virtual void on(TransmitDone, UserConnection*) throw(); @@ -191,7 +189,6 @@ virtual void on(AdcCommand::GET, UserConnection*, const AdcCommand&) throw(); virtual void on(AdcCommand::GFI, UserConnection*, const AdcCommand&) throw(); - void onGetBlock(UserConnection* aSource, const string& aFile, int64_t aResume, int64_t aBytes, bool z); bool prepareFile(UserConnection* aSource, const string& aType, const string& aFile, int64_t aResume, int64_t aBytes, bool listRecursive = false); }; Modified: dcplusplus/trunk/client/User.h =================================================================== --- dcplusplus/trunk/client/User.h 2006-09-18 21:40:58 UTC (rev 650) +++ dcplusplus/trunk/client/User.h 2006-09-19 09:42:13 UTC (rev 651) @@ -40,7 +40,8 @@ NMDC_BIT, BOT_BIT, TTH_GET_BIT, - TLS_BIT + TLS_BIT, + OLD_CLIENT_BIT }; /** Each flag is set if it's true in at least one hub */ @@ -51,7 +52,8 @@ NMDC = 1<<NMDC_BIT, BOT = 1<<BOT_BIT, TTH_GET = 1<<TTH_GET_BIT, //< User supports getting files by tth -> don't have path in queue... - TLS = 1<<TLS_BIT //< Client supports SSL + TLS = 1<<TLS_BIT, //< Client supports SSL + OLD_CLIENT = 1<<OLD_CLIENT_BIT //< Can't download - old client }; typedef Pointer<User> Ptr; Modified: dcplusplus/trunk/client/UserConnection.cpp =================================================================== --- dcplusplus/trunk/client/UserConnection.cpp 2006-09-18 21:40:58 UTC (rev 650) +++ dcplusplus/trunk/client/UserConnection.cpp 2006-09-19 09:42:13 UTC (rev 651) @@ -116,28 +116,6 @@ if(x != string::npos) { fire(UserConnectionListener::Get(), this, Text::acpToUtf8(param.substr(0, x)), Util::toInt64(param.substr(x+1)) - (int64_t)1); } - } else if(cmd == "$GetZBlock" || cmd == "$UGetZBlock" || cmd == "$UGetBlock") { - string::size_type i = param.find(' '); - if(i == string::npos) - return; - int64_t start = Util::toInt64(param.substr(0, i)); - if(start < 0) { - disconnect(); - return; - } - i++; - string::size_type j = param.find(' ', i); - if(j == string::npos) - return; - int64_t bytes = Util::toInt64(param.substr(i, j-i)); - string name = param.substr(j+1); - if(cmd == "$GetZBlock") - name = Text::acpToUtf8(name); - if(cmd == "$UGetBlock") { - fire(UserConnectionListener::GetBlock(), this, name, start, bytes); - } else { - fire(UserConnectionListener::GetZBlock(), this, name, start, bytes); - } } else if(cmd == "$Key") { if(!param.empty()) fire(UserConnectionListener::Key(), this, param); Modified: dcplusplus/trunk/client/UserConnection.h =================================================================== --- dcplusplus/trunk/client/UserConnection.h 2006-09-18 21:40:58 UTC (rev 650) +++ dcplusplus/trunk/client/UserConnection.h 2006-09-19 09:42:13 UTC (rev 651) @@ -46,8 +46,6 @@ typedef X<5> Key; typedef X<6> Direction; typedef X<7> Get; - typedef X<8> GetBlock; - typedef X<9> GetZBlock; typedef X<10> Sending; typedef X<11> FileLength; typedef X<12> Send; @@ -70,8 +68,6 @@ virtual void on(Key, UserConnection*, const string&) throw() { } virtual void on(Direction, UserConnection*, const string&, const string&) throw() { } virtual void on(Get, UserConnection*, const string&, int64_t) throw() { } - virtual void on(GetBlock, UserConnection*, const string&, int64_t, int64_t) throw() { } - virtual void on(GetZBlock, UserConnection*, const string&, int64_t, int64_t) throw() { } virtual void on(Sending, UserConnection*, int64_t) throw() { } virtual void on(FileLength, UserConnection*, int64_t) throw() { } virtual void on(Send, UserConnection*) throw() { } @@ -235,8 +231,6 @@ void key(const string& aKey) { send("$Key " + aKey + '|'); } void direction(const string& aDirection, int aNumber) { send("$Direction " + aDirection + " " + Util::toString(aNumber) + '|'); } void get(const string& aFile, int64_t aResume) { send("$Get " + aFile + "$" + Util::toString(aResume + 1) + '|'); } // No acp - utf conversion here... - void getZBlock(const string& aFile, int64_t aResume, int64_t aBytes, bool utf8) { send((utf8 ? "$UGetZBlock " : "$GetZBlock ") + Util::toString(aResume) + ' ' + Util::toString(aBytes) + ' ' + aFile + '|'); } - void uGetBlock(const string& aFile, int64_t aResume, int64_t aBytes) { send("$UGetBlock " + Util::toString(aResume) + ' ' + Util::toString(aBytes) + ' ' + aFile + '|'); } void fileLength(const string& aLength) { send("$FileLength " + aLength + '|'); } void startSend() { send("$Send|"); } void sending(int64_t bytes) { send(bytes == -1 ? string("$Sending|") : "$Sending " + Util::toString(bytes) + "|"); } Modified: dcplusplus/trunk/windows/SearchFrm.cpp =================================================================== --- dcplusplus/trunk/windows/SearchFrm.cpp 2006-09-18 21:40:58 UTC (rev 650) +++ dcplusplus/trunk/windows/SearchFrm.cpp 2006-09-19 09:42:13 UTC (rev 651) @@ -352,8 +352,8 @@ } else { // match all here for(TStringIter j = search.begin(); j != search.end(); ++j) { - if((*j->begin() != _T('-') && Util::findSubString(aResult->getUtf8() ? aResult->getFile() : Text::acpToUtf8(aResult->getFile()), Text::fromT(*j)) == -1) || - (*j->begin() == _T('-') && j->size() != 1 && Util::findSubString(aResult->getUtf8() ? aResult->getFile() : Text::acpToUtf8(aResult->getFile()), Text::fromT(j->substr(1))) != -1) + if((*j->begin() != _T('-') && Util::findSubString(aResult->getFile(), Text::fromT(*j)) == -1) || + (*j->begin() == _T('-') && j->size() != 1 && Util::findSubString(aResult->getFile(), Text::fromT(j->substr(1))) != -1) ) { droppedResults++; @@ -1109,10 +1109,10 @@ void SearchFrame::SearchInfo::update() { if(sr->getType() == SearchResult::TYPE_FILE) { if(sr->getFile().rfind(_T('\\')) == tstring::npos) { - columns[COLUMN_FILENAME] = Text::toT(sr->getUtf8() ? sr->getFile() : Text::acpToUtf8(sr->getFile())); + columns[COLUMN_FILENAME] = Text::toT(sr->getFile()); } else { - columns[COLUMN_FILENAME] = Text::toT(Util::getFileName(sr->getUtf8() ? sr->getFile() : Text::acpToUtf8(sr->getFile()))); - columns[COLUMN_PATH] = Text::toT(Util::getFilePath(sr->getUtf8() ? sr->getFile() : Text::acpToUtf8(sr->getFile()))); + columns[COLUMN_FILENAME] = Text::toT(Util::getFileName(sr->getFile())); + columns[COLUMN_PATH] = Text::toT(Util::getFilePath(sr->getFile())); } columns[COLUMN_TYPE] = Text::toT(Util::getFileExt(Text::fromT(columns[COLUMN_FILENAME]))); @@ -1121,8 +1121,8 @@ columns[COLUMN_SIZE] = Text::toT(Util::formatBytes(sr->getSize())); columns[COLUMN_EXACT_SIZE] = Text::toT(Util::formatExactSize(sr->getSize())); } else { - columns[COLUMN_FILENAME] = Text::toT(sr->getUtf8() ? sr->getFileName() : Text::acpToUtf8(sr->getFileName())); - columns[COLUMN_PATH] = Text::toT(sr->getUtf8() ? sr->getFile() : Text::acpToUtf8(sr->getFile())); + columns[COLUMN_FILENAME] = Text::toT(sr->getFileName()); + columns[COLUMN_PATH] = Text::toT(sr->getFile()); columns[COLUMN_TYPE] = TSTRING(DIRECTORY); if(sr->getSize() > 0) { columns[COLUMN_SIZE] = Text::toT(Util::formatBytes(sr->getSize())); Modified: dcplusplus/trunk/windows/TransferView.cpp =================================================================== --- dcplusplus/trunk/windows/TransferView.cpp 2006-09-18 21:40:58 UTC (rev 650) +++ dcplusplus/trunk/windows/TransferView.cpp 2006-09-19 09:42:13 UTC (rev 651) @@ -439,7 +439,11 @@ void TransferView::on(ConnectionManagerListener::Failed, ConnectionQueueItem* aCqi, const string& aReason) { UpdateInfo* ui = new UpdateInfo(aCqi->getUser(), aCqi->getDownload()); - ui->setStatusString(Text::toT(aReason)); + if(aCqi->getUser()->isSet(User::OLD_CLIENT)) { + ui->setStatusString(TSTRING(SOURCE_TOO_OLD)); + } else { + ui->setStatusString(Text::toT(aReason)); + } speak(UPDATE_ITEM, ui); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |