From: <arn...@us...> - 2007-10-18 17:28:31
|
Revision: 864 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=864&view=rev Author: arnetheduck Date: 2007-10-18 10:28:30 -0700 (Thu, 18 Oct 2007) Log Message: ----------- connection & upload fix Modified Paths: -------------- dcplusplus/trunk/dcpp/ConnectionManager.cpp dcplusplus/trunk/dcpp/UploadManager.cpp This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-11-16 23:11:12
|
Revision: 911 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=911&view=rev Author: arnetheduck Date: 2007-11-16 15:11:07 -0800 (Fri, 16 Nov 2007) Log Message: ----------- More 0.14 support Modified Paths: -------------- dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/dcpp/ConnectionManager.cpp dcplusplus/trunk/dcpp/User.cpp dcplusplus/trunk/dcpp/User.h Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2007-11-16 17:34:06 UTC (rev 910) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2007-11-16 23:11:07 UTC (rev 911) @@ -527,6 +527,24 @@ } } +static void addParam(StringMap& lastInfoMap, AdcCommand& c, const string& var, const string& value) { + StringMapIter i = lastInfoMap.find(var); + + if(i != lastInfoMap.end()) { + if(i->second != value) { + if(value.empty()) { + lastInfoMap.erase(i); + } else { + i->second = value; + } + c.addParam(var, value); + } + } else if(!value.empty()) { + lastInfoMap.insert(make_pair(var, value)); + c.addParam(var, value); + } +} + void AdcHub::info(bool /*alwaysSend*/) { if(state != STATE_IDENTIFY && state != STATE_NORMAL) return; @@ -534,51 +552,30 @@ reloadSettings(false); AdcCommand c(AdcCommand::CMD_INF, AdcCommand::TYPE_BROADCAST); - string tmp; - StringMapIter i; -#define ADDPARAM(var, content) \ - tmp = content; \ - if((i = lastInfoMap.find(var)) != lastInfoMap.end()) { \ - if(i->second != tmp) { \ - if(tmp.empty()) \ - lastInfoMap.erase(i); \ - else \ - i->second = tmp; \ - c.addParam(var, tmp); \ - } \ - } else if(!tmp.empty()) { \ - c.addParam(var, tmp); \ - lastInfoMap[var] = tmp; \ - } + updateCounts(false); - updateCounts(false); \ + addParam(lastInfoMap, c, "ID", ClientManager::getInstance()->getMyCID().toBase32()); + addParam(lastInfoMap, c, "PD", ClientManager::getInstance()->getMyPID().toBase32()); + addParam(lastInfoMap, c, "NI", getCurrentNick()); + addParam(lastInfoMap, c, "DE", getCurrentDescription()); + addParam(lastInfoMap, c, "SL", Util::toString(SETTING(SLOTS))); + addParam(lastInfoMap, c, "SS", ShareManager::getInstance()->getShareSizeString()); + addParam(lastInfoMap, c, "SF", Util::toString(ShareManager::getInstance()->getSharedFiles())); + addParam(lastInfoMap, c, "EM", SETTING(EMAIL)); + addParam(lastInfoMap, c, "HN", Util::toString(counts.normal)); + addParam(lastInfoMap, c, "HR", Util::toString(counts.registered)); + addParam(lastInfoMap, c, "HO", Util::toString(counts.op)); + addParam(lastInfoMap, c, "VE", "++ " VERSIONSTRING); + addParam(lastInfoMap, c, "US", Util::toString((long)(Util::toDouble(SETTING(UPLOAD_SPEED))*1024*1024))); + addParam(lastInfoMap, c, "AW", Util::getAway() ? "1" : Util::emptyString); - ADDPARAM("ID", ClientManager::getInstance()->getMyCID().toBase32()); - ADDPARAM("PD", ClientManager::getInstance()->getMyPID().toBase32()); - ADDPARAM("NI", getCurrentNick()); - ADDPARAM("DE", getCurrentDescription()); - ADDPARAM("SL", Util::toString(SETTING(SLOTS))); - ADDPARAM("SS", ShareManager::getInstance()->getShareSizeString()); - ADDPARAM("SF", Util::toString(ShareManager::getInstance()->getSharedFiles())); - ADDPARAM("EM", SETTING(EMAIL)); - ADDPARAM("HN", Util::toString(counts.normal)); - 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))); + addParam(lastInfoMap, c, "DS", Util::toString((SETTING(MAX_DOWNLOAD_SPEED)*1024*8))); } else { - ADDPARAM("DS", Util::emptyString); + addParam(lastInfoMap, c, "DS", Util::emptyString); } - if(Util::getAway()){ - ADDPARAM("AW", '1'); - } else { - ADDPARAM("AW", Util::emptyString); - } string su; if(CryptoManager::getInstance()->TLSOk()) { @@ -587,25 +584,23 @@ if(ClientManager::getInstance()->isActive()) { if(BOOLSETTING(NO_IP_OVERRIDE) && !SETTING(EXTERNAL_IP).empty()) { - ADDPARAM("I4", Socket::resolve(SETTING(EXTERNAL_IP))); + addParam(lastInfoMap, c, "I4", Socket::resolve(SETTING(EXTERNAL_IP))); } else { - ADDPARAM("I4", "0.0.0.0"); + addParam(lastInfoMap, c, "I4", "0.0.0.0"); } - ADDPARAM("U4", Util::toString(SearchManager::getInstance()->getPort())); + addParam(lastInfoMap, c, "U4", Util::toString(SearchManager::getInstance()->getPort())); su += TCP4_FEATURE + ","; su += UDP4_FEATURE + ","; } else { - ADDPARAM("I4", ""); - ADDPARAM("U4", ""); + addParam(lastInfoMap, c, "I4", ""); + addParam(lastInfoMap, c, "U4", ""); } if(!su.empty()) { su.erase(su.size() - 1); } - ADDPARAM("SU", su); + addParam(lastInfoMap, c, "SU", su); -#undef ADDPARAM - if(c.getParameters().size() > 0) { send(c); } Modified: dcplusplus/trunk/dcpp/ConnectionManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ConnectionManager.cpp 2007-11-16 17:34:06 UTC (rev 910) +++ dcplusplus/trunk/dcpp/ConnectionManager.cpp 2007-11-16 23:11:07 UTC (rev 911) @@ -736,8 +736,6 @@ conn->setFlag(UserConnection::FLAG_SUPPORTS_TTHL); } else if(*i == UserConnection::FEATURE_TTHF) { conn->setFlag(UserConnection::FLAG_SUPPORTS_TTHF); - if(conn->getUser()) - conn->getUser()->setFlag(User::TTH_GET); } } } Modified: dcplusplus/trunk/dcpp/User.cpp =================================================================== --- dcplusplus/trunk/dcpp/User.cpp 2007-11-16 17:34:06 UTC (rev 910) +++ dcplusplus/trunk/dcpp/User.cpp 2007-11-16 23:11:07 UTC (rev 911) @@ -61,6 +61,11 @@ } } +bool Identity::isClientType(ClientType ct) const { + int type = Util::toInt(get("CT")); + return (type & ct) == ct; +} + string Identity::getTag() const { if(!get("TA").empty()) return get("TA"); @@ -69,6 +74,7 @@ return "<" + get("VE") + ",M:" + string(isTcpActive() ? "A" : "P") + ",H:" + get("HN") + "/" + get("HR") + "/" + get("HO") + ",S:" + get("SL") + ">"; } + string Identity::get(const char* name) const { Lock l(cs); InfMap::const_iterator i = info.find(*(short*)name); Modified: dcplusplus/trunk/dcpp/User.h =================================================================== --- dcplusplus/trunk/dcpp/User.h 2007-11-16 17:34:06 UTC (rev 910) +++ dcplusplus/trunk/dcpp/User.h 2007-11-16 23:11:07 UTC (rev 911) @@ -39,7 +39,6 @@ PASSIVE_BIT, NMDC_BIT, BOT_BIT, - TTH_GET_BIT, TLS_BIT, OLD_CLIENT_BIT }; @@ -51,7 +50,6 @@ PASSIVE = 1<<PASSIVE_BIT, 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 TLS OLD_CLIENT = 1<<OLD_CLIENT_BIT //< Can't download - old client }; @@ -80,7 +78,7 @@ /** One of possibly many identities of a user, mainly for UI purposes */ class Identity : public Flags { public: - enum { + enum IdentityFlagBits { GOT_INF_BIT, NMDC_PASSIVE_BIT }; @@ -88,7 +86,14 @@ GOT_INF = 1 << GOT_INF_BIT, NMDC_PASSIVE = 1 << NMDC_PASSIVE_BIT }; - + enum ClientType { + CT_BOT = 1, + CT_REGGED = 2, + CT_OP = 4, + CT_OWNER = 8, + CT_HUB = 16 + }; + Identity() : sid(0) { } Identity(const UserPtr& ptr, uint32_t aSID) : user(ptr), sid(aSID) { } Identity(const Identity& rhs) : Flags(rhs), user(rhs.user), sid(rhs.sid), info(rhs.info) { } @@ -111,24 +116,26 @@ void setHidden(bool hidden) { set("HI", hidden ? "1" : Util::emptyString); } string getTag() const; 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 isHub() const { return isClientType(CT_HUB) || !get("HU").empty(); } + bool isOp() const { return isClientType(CT_OP) || !get("OP").empty(); } + bool isRegistered() const { return isClientType(CT_REGGED) || !get("RG").empty(); } bool isHidden() const { return !get("HI").empty(); } - bool isBot() const { return !get("BO").empty(); } + bool isBot() const { return isClientType(CT_BOT) || !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(); } string get(const char* name) const; void set(const char* name, const string& val); string getSIDString() const { return string((const char*)&sid, 4); } + + bool isClientType(ClientType ct) const; void getParams(StringMap& map, const string& prefix, bool compatibility) const; UserPtr& getUser() { return user; } GETSET(UserPtr, user, User); GETSET(uint32_t, sid, SID); private: - typedef map<short, string> InfMap; + typedef std::tr1::unordered_map<short, string> InfMap; typedef InfMap::iterator InfIter; InfMap info; /** @todo there are probably more threading issues here ...*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-13 20:32:17
|
Revision: 938 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=938&view=rev Author: arnetheduck Date: 2007-12-13 12:32:16 -0800 (Thu, 13 Dec 2007) Log Message: ----------- advertise base support Modified Paths: -------------- dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/dcpp/ConnectionManager.cpp Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-13 20:15:27 UTC (rev 937) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-13 20:32:16 UTC (rev 938) @@ -208,7 +208,7 @@ return; } else if(!tigrOk) { oldPassword = true; - // What now? Some hubs fake BASE support without TIGR support =/ + // Some hubs fake BASE support without TIGR support =/ fire(ClientListener::StatusMessage(), this, "Hub probably uses an old version of ADC, please encourage the owner to upgrade"); } } @@ -292,7 +292,7 @@ token = tok; } } else { - // <= 0.703 would send an empty token for passive connections... + // <= 0.703 would send an empty token for passive connections when replying to RCM } bool secure = false; @@ -678,7 +678,7 @@ sid = 0; AdcCommand cmd(AdcCommand::CMD_SUP, AdcCommand::TYPE_HUB); - cmd.addParam(BAS0_SUPPORT).addParam(TIGR_SUPPORT); + cmd.addParam(BAS0_SUPPORT).addParam(BASE_SUPPORT).addParam(TIGR_SUPPORT); if(BOOLSETTING(HUB_USER_COMMANDS)) { cmd.addParam(UCM0_SUPPORT); Modified: dcplusplus/trunk/dcpp/ConnectionManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ConnectionManager.cpp 2007-12-13 20:15:27 UTC (rev 937) +++ dcplusplus/trunk/dcpp/ConnectionManager.cpp 2007-12-13 20:32:16 UTC (rev 938) @@ -43,6 +43,7 @@ features.push_back(UserConnection::FEATURE_TTHF); adcFeatures.push_back("AD" + UserConnection::FEATURE_ADC_BAS0); + adcFeatures.push_back("AD" + UserConnection::FEATURE_ADC_BASE); adcFeatures.push_back("AD" + UserConnection::FEATURE_ADC_TIGR); adcFeatures.push_back("AD" + UserConnection::FEATURE_ADC_BZIP); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-15 22:26:25
|
Revision: 945 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=945&view=rev Author: arnetheduck Date: 2007-12-15 14:26:23 -0800 (Sat, 15 Dec 2007) Log Message: ----------- Remove silly sharedfile Modified Paths: -------------- dcplusplus/trunk/dcpp/Download.cpp dcplusplus/trunk/dcpp/Download.h dcplusplus/trunk/dcpp/File.cpp dcplusplus/trunk/dcpp/File.h dcplusplus/trunk/dcpp/QueueManager.cpp dcplusplus/trunk/dcpp/forward.h Removed Paths: ------------- dcplusplus/trunk/dcpp/SharedFile.cpp dcplusplus/trunk/dcpp/SharedFile.h Modified: dcplusplus/trunk/dcpp/Download.cpp =================================================================== --- dcplusplus/trunk/dcpp/Download.cpp 2007-12-14 19:50:32 UTC (rev 944) +++ dcplusplus/trunk/dcpp/Download.cpp 2007-12-15 22:26:23 UTC (rev 945) @@ -23,7 +23,6 @@ #include "UserConnection.h" #include "QueueItem.h" -#include "SharedFile.h" #include "HashManager.h" namespace dcpp { @@ -120,8 +119,4 @@ params["sfv"] = Util::toString(isSet(Download::FLAG_CRC32_OK) ? 1 : 0); } -void Download::setSharedFile(SharedFile* f) { - file = sharedFile = f; -} - } // namespace dcpp Modified: dcplusplus/trunk/dcpp/Download.h =================================================================== --- dcplusplus/trunk/dcpp/Download.h 2007-12-14 19:50:32 UTC (rev 944) +++ dcplusplus/trunk/dcpp/Download.h 2007-12-15 22:26:23 UTC (rev 945) @@ -52,9 +52,6 @@ /** @internal */ AdcCommand getCommand(bool zlib); - const SharedFile* getSharedFile() const{ return sharedFile; } - void setSharedFile(SharedFile* f); - GETSET(string, tempTarget, TempTarget); GETSET(OutputStream*, file, File); GETSET(bool, treeValid, TreeValid); @@ -64,7 +61,6 @@ TigerTree tt; string pfs; - SharedFile* sharedFile; }; } // namespace dcpp Modified: dcplusplus/trunk/dcpp/File.cpp =================================================================== --- dcplusplus/trunk/dcpp/File.cpp 2007-12-14 19:50:32 UTC (rev 944) +++ dcplusplus/trunk/dcpp/File.cpp 2007-12-15 22:26:23 UTC (rev 945) @@ -41,9 +41,10 @@ dcassert(0); } } + DWORD shared = FILE_SHARE_READ | (mode & SHARED ? FILE_SHARE_WRITE : 0); + + h = ::CreateFile(Text::toT(aFileName).c_str(), access, shared, NULL, m, FILE_FLAG_SEQUENTIAL_SCAN, NULL); - h = ::CreateFile(Text::toT(aFileName).c_str(), access, FILE_SHARE_READ, NULL, m, FILE_FLAG_SEQUENTIAL_SCAN, NULL); - if(h == INVALID_HANDLE_VALUE) { throw FileException(Util::translateError(GetLastError())); } Modified: dcplusplus/trunk/dcpp/File.h =================================================================== --- dcplusplus/trunk/dcpp/File.h 2007-12-14 19:50:32 UTC (rev 944) +++ dcplusplus/trunk/dcpp/File.h 2007-12-15 22:26:23 UTC (rev 945) @@ -46,7 +46,8 @@ enum { OPEN = 0x01, CREATE = 0x02, - TRUNCATE = 0x04 + TRUNCATE = 0x04, + SHARED = 0x08 }; #ifdef _WIN32 Modified: dcplusplus/trunk/dcpp/QueueManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/QueueManager.cpp 2007-12-14 19:50:32 UTC (rev 944) +++ dcplusplus/trunk/dcpp/QueueManager.cpp 2007-12-15 22:26:23 UTC (rev 945) @@ -31,7 +31,6 @@ #include "ResourceManager.h" #include "SearchManager.h" #include "ShareManager.h" -#include "SharedFile.h" #include "SimpleXML.h" #include "StringTokenizer.h" #include "Transfer.h" @@ -733,19 +732,11 @@ throw QueueException(STRING(TARGET_REMOVED)); } - for(DownloadList::const_iterator i = qi->getDownloads().begin(); i != qi->getDownloads().end(); ++i) { - const Download* d2 = *i; - if(d2->getFile()) { - // Already downloading, reuse same file - d->setSharedFile(new SharedFile(*d2->getSharedFile(), d->getSegment())); - return; - } - } - string target = d->getDownloadTarget(); File::ensureDirectory(target); - - d->setSharedFile(new SharedFile(target, d->getSegment(), qi->getSize())); + File* f = new File(target, File::WRITE, File::OPEN | File::CREATE | File::SHARED); + f->setPos(d->getSegment().getStart()); + d->setFile(f); } else if(d->getType() == Transfer::TYPE_FULL_LIST) { string target = d->getDownloadTarget(); File::ensureDirectory(target); Deleted: dcplusplus/trunk/dcpp/SharedFile.cpp =================================================================== --- dcplusplus/trunk/dcpp/SharedFile.cpp 2007-12-14 19:50:32 UTC (rev 944) +++ dcplusplus/trunk/dcpp/SharedFile.cpp 2007-12-15 22:26:23 UTC (rev 945) @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com - * - * This program 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. - * - * This program 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. - */ - -#include "stdinc.h" -#include "DCPlusPlus.h" - -#include "SharedFile.h" - -namespace dcpp { - -SharedFile::FileData::FileData(const string& filename) : f(filename, File::RW, File::OPEN | File::CREATE) { - -} - -SharedFile::SharedFile(const string& filename, const Segment& segment_, int64_t totalSize) : segment(segment_), pos(0) { - file = FileDataPtr(new FileData(filename)); - if(totalSize != -1) { - file->f.setSize(totalSize); - } -} - -size_t SharedFile::write(const void* buf, size_t len) throw(Exception) { - Lock l(file->cs); - file->f.setPos(segment.getStart() + pos); - size_t n = file->f.write(buf, len); - pos += n; - return n; -} - -size_t SharedFile::read(void* buf, size_t& len) throw(Exception) { - Lock l(file->cs); - file->f.setPos(segment.getStart() + pos); - size_t n = file->f.read(buf, len); - pos += n; - return n; -} - -size_t SharedFile::flush() throw(Exception) { - Lock l(file->cs); - return file->f.flush(); -} - -} Deleted: dcplusplus/trunk/dcpp/SharedFile.h =================================================================== --- dcplusplus/trunk/dcpp/SharedFile.h 2007-12-14 19:50:32 UTC (rev 944) +++ dcplusplus/trunk/dcpp/SharedFile.h 2007-12-15 22:26:23 UTC (rev 945) @@ -1,41 +0,0 @@ -#ifndef DCPLUSPLUS_DCPP_SHAREDFILE_H_ -#define DCPLUSPLUS_DCPP_SHAREDFILE_H_ - -#include "File.h" -#include "CriticalSection.h" -#include "Segment.h" - -namespace dcpp { - -/** A file used by multiple writers */ -class SharedFile : public IOStream { -public: - SharedFile(const string& filename, const Segment& segment, int64_t totalSize); - - SharedFile(const SharedFile& sf, const Segment& segment_) : file(sf.file), segment(segment_), pos(0) { } - - using OutputStream::write; - virtual size_t write(const void* buf, size_t len) throw(Exception); - virtual size_t read(void* buf, size_t& len) throw(Exception); - - virtual size_t flush() throw(Exception); -private: - struct FileData { - FileData(const string& filename); - File f; - CriticalSection cs; - }; - - typedef std::tr1::shared_ptr<FileData> FileDataPtr; - - FileDataPtr file; - - Segment segment; - - /** Bytes written so far */ - size_t pos; - -}; - -} -#endif /*SHAREDFILE_H_*/ Modified: dcplusplus/trunk/dcpp/forward.h =================================================================== --- dcplusplus/trunk/dcpp/forward.h 2007-12-14 19:50:32 UTC (rev 944) +++ dcplusplus/trunk/dcpp/forward.h 2007-12-15 22:26:23 UTC (rev 945) @@ -72,8 +72,6 @@ class ServerSocket; -class SharedFile; - class Socket; class SocketException; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-23 20:29:59
|
Revision: 950 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=950&view=rev Author: arnetheduck Date: 2007-12-23 12:29:57 -0800 (Sun, 23 Dec 2007) Log Message: ----------- Make bloom filters slightly more robust Modified Paths: -------------- dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/dcpp/ShareManager.cpp Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-23 11:04:30 UTC (rev 949) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-23 20:29:57 UTC (rev 950) @@ -489,7 +489,20 @@ ByteVector v; size_t m = Util::toUInt32(c.getParam(3)) * 8; size_t k = Util::toUInt32(tmp); - + + if(k > 8 || k < 1) { + send(AdcCommand(AdcCommand::SEV_FATAL, AdcCommand::ERROR_TRANSFER_GENERIC, "Unsupported k")); + return; + } + + size_t n = ShareManager::getInstance()->getSharedFiles(); + + // Ideal size for m is n * k / ln(2), but we allow some slack + if(m > (5 * n * k / log(2))) { + send(AdcCommand(AdcCommand::SEV_FATAL, AdcCommand::ERROR_TRANSFER_GENERIC, "Unsupported m")); + return; + } + ShareManager::getInstance()->getBloom(v, k, m); AdcCommand cmd(AdcCommand::CMD_SND, AdcCommand::TYPE_HUB); cmd.addParam(c.getParam(0)); Modified: dcplusplus/trunk/dcpp/ShareManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ShareManager.cpp 2007-12-23 11:04:30 UTC (rev 949) +++ dcplusplus/trunk/dcpp/ShareManager.cpp 2007-12-23 20:29:57 UTC (rev 950) @@ -844,7 +844,6 @@ bloom.copy_to(v); } - void ShareManager::generateXmlList() { Lock l(cs); if(xmlDirty && (lastXmlUpdate + 15 * 60 * 1000 < GET_TICK() || lastXmlUpdate < lastFullUpdate)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-01-23 19:46:29
|
Revision: 974 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=974&view=rev Author: arnetheduck Date: 2008-01-23 11:46:22 -0800 (Wed, 23 Jan 2008) Log Message: ----------- gettext patch Modified Paths: -------------- dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/dcpp/BZUtils.cpp dcplusplus/trunk/dcpp/BitInputStream.h dcplusplus/trunk/dcpp/BufferedSocket.cpp dcplusplus/trunk/dcpp/Client.cpp dcplusplus/trunk/dcpp/ClientManager.cpp dcplusplus/trunk/dcpp/ConnectionManager.cpp dcplusplus/trunk/dcpp/CryptoManager.cpp dcplusplus/trunk/dcpp/DCPlusPlus.cpp dcplusplus/trunk/dcpp/DirectoryListing.cpp dcplusplus/trunk/dcpp/DownloadManager.cpp dcplusplus/trunk/dcpp/FavoriteManager.cpp dcplusplus/trunk/dcpp/HashManager.cpp dcplusplus/trunk/dcpp/MerkleCheckOutputStream.h dcplusplus/trunk/dcpp/NmdcHub.cpp dcplusplus/trunk/dcpp/QueueManager.cpp dcplusplus/trunk/dcpp/SearchManager.cpp dcplusplus/trunk/dcpp/ShareManager.cpp dcplusplus/trunk/dcpp/Socket.cpp dcplusplus/trunk/dcpp/Thread.cpp dcplusplus/trunk/dcpp/Transfer.cpp dcplusplus/trunk/dcpp/UploadManager.cpp dcplusplus/trunk/dcpp/UserConnection.cpp dcplusplus/trunk/dcpp/ZUtils.cpp Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -29,7 +29,6 @@ #include "Util.h" #include "UserCommand.h" #include "CryptoManager.h" -#include "ResourceManager.h" #include "LogManager.h" namespace dcpp { @@ -552,7 +551,7 @@ uint16_t port = secure ? ConnectionManager::getInstance()->getSecurePort() : ConnectionManager::getInstance()->getPort(); if(port == 0) { // Oops? - LogManager::getInstance()->message(STRING(NOT_LISTENING)); + LogManager::getInstance()->message(_("Not listening for connections - please restart DC++")); return; } send(AdcCommand(AdcCommand::CMD_CTM, user.getIdentity().getSID(), AdcCommand::TYPE_DIRECT).addParam(*proto).addParam(Util::toString(port)).addParam(token)); Modified: dcplusplus/trunk/dcpp/BZUtils.cpp =================================================================== --- dcplusplus/trunk/dcpp/BZUtils.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/BZUtils.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -21,7 +21,6 @@ #include "BZUtils.h" #include "Exception.h" -#include "ResourceManager.h" namespace dcpp { @@ -29,7 +28,7 @@ memset(&zs, 0, sizeof(zs)); if(BZ2_bzCompressInit(&zs, 9, 0, 30) != BZ_OK) { - throw Exception(STRING(COMPRESSION_ERROR)); + throw Exception(_("Error during compression")); } } @@ -50,7 +49,7 @@ if(insize == 0) { int err = ::BZ2_bzCompress(&zs, BZ_FINISH); if(err != BZ_FINISH_OK && err != BZ_STREAM_END) - throw Exception(STRING(COMPRESSION_ERROR)); + throw Exception(_("Error during compression")); outsize = outsize - zs.avail_out; insize = insize - zs.avail_in; @@ -58,7 +57,7 @@ } else { int err = ::BZ2_bzCompress(&zs, BZ_RUN); if(err != BZ_RUN_OK) - throw Exception(STRING(COMPRESSION_ERROR)); + throw Exception(_("Error during compression")); outsize = outsize - zs.avail_out; insize = insize - zs.avail_in; @@ -70,7 +69,7 @@ memset(&zs, 0, sizeof(zs)); if(BZ2_bzDecompressInit(&zs, 0, 0) != BZ_OK) - throw Exception(STRING(DECOMPRESSION_ERROR)); + throw Exception(_("Error during decompression")); } @@ -92,10 +91,10 @@ // No more input data, and inflate didn't think it has reached the end... if(insize == 0 && zs.avail_out != 0 && err != BZ_STREAM_END) - throw Exception(STRING(DECOMPRESSION_ERROR)); + throw Exception(_("Error during decompression")); if(err != BZ_OK && err != BZ_STREAM_END) - throw Exception(STRING(DECOMPRESSION_ERROR)); + throw Exception(_("Error during decompression")); outsize = outsize - zs.avail_out; insize = insize - zs.avail_in; Modified: dcplusplus/trunk/dcpp/BitInputStream.h =================================================================== --- dcplusplus/trunk/dcpp/BitInputStream.h 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/BitInputStream.h 2008-01-23 19:46:22 UTC (rev 974) @@ -20,7 +20,6 @@ #define BIT_INPUT_STREAM_H #include "Exception.h" -#include "ResourceManager.h" namespace dcpp { @@ -38,7 +37,7 @@ bool get() throw(BitStreamException) { if(bitPos > endPos) { - throw BitStreamException(STRING(SEEK_BEYOND_END)); + throw BitStreamException(_("Request to seek beyond the end of data")); } bool ret = (((uint8_t)is[bitPos>>3]) >> (bitPos&0x07)) & 0x01; bitPos++; Modified: dcplusplus/trunk/dcpp/BufferedSocket.cpp =================================================================== --- dcplusplus/trunk/dcpp/BufferedSocket.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/BufferedSocket.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -21,7 +21,6 @@ #include "BufferedSocket.h" -#include "ResourceManager.h" #include "TimerManager.h" #include "SettingsManager.h" @@ -152,7 +151,7 @@ return; if((startTime + 30000) < GET_TICK()) { - throw SocketException(STRING(CONNECTION_TIMEOUT)); + throw SocketException(_("Connection timeout")); } } @@ -169,7 +168,7 @@ return; } else if(left == 0) { // This socket has been closed... - throw SocketException(STRING(CONNECTION_CLOSED)); + throw SocketException(("Connection closed")); } size_t used; string::size_type pos = 0; @@ -261,7 +260,7 @@ } if(mode == MODE_LINE && line.size() > static_cast<size_t>(SETTING(MAX_COMMAND_LENGTH))) { - throw SocketException(STRING(COMMAND_TOO_LONG)); + throw SocketException(_("Maximum command length exceeded")); } } @@ -407,7 +406,7 @@ } if(failed && p.first != SHUTDOWN) { dcdebug("BufferedSocket: New command when already failed: %d\n", p.first); - fail(STRING(DISCONNECTED)); + fail(_("Disconnected")); delete p.second; continue; } @@ -425,7 +424,7 @@ } case DISCONNECT: if(isConnected()) - fail(STRING(DISCONNECTED)); + fail(_("Disconnected")); break; case SHUTDOWN: return false; Modified: dcplusplus/trunk/dcpp/Client.cpp =================================================================== --- dcplusplus/trunk/dcpp/Client.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/Client.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -25,7 +25,6 @@ #include "FavoriteManager.h" #include "TimerManager.h" -#include "ResourceManager.h" #include "ClientManager.h" namespace dcpp { Modified: dcplusplus/trunk/dcpp/ClientManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ClientManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/ClientManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -27,7 +27,6 @@ #include "FavoriteManager.h" #include "SimpleXML.h" #include "UserCommand.h" -#include "ResourceManager.h" #include "LogManager.h" #include "AdcHub.h" @@ -113,7 +112,7 @@ if(i != onlineUsers.end()) { return i->second->getIdentity().getConnection(); } - return STRING(OFFLINE); + return _("Offline"); } int64_t ClientManager::getAvailable() const { Modified: dcplusplus/trunk/dcpp/ConnectionManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ConnectionManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/ConnectionManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -21,7 +21,6 @@ #include "ConnectionManager.h" -#include "ResourceManager.h" #include "DownloadManager.h" #include "UploadManager.h" #include "CryptoManager.h" @@ -179,13 +178,13 @@ attemptDone = true; } else { cqi->setState(ConnectionQueueItem::NO_DOWNLOAD_SLOTS); - fire(ConnectionManagerListener::Failed(), cqi, STRING(ALL_DOWNLOAD_SLOTS_TAKEN)); + fire(ConnectionManagerListener::Failed(), cqi, _("All download slots taken")); } } else if(cqi->getState() == ConnectionQueueItem::NO_DOWNLOAD_SLOTS && startDown) { cqi->setState(ConnectionQueueItem::WAITING); } } else if(((cqi->getLastAttempt() + 50*1000) < aTick) && (cqi->getState() == ConnectionQueueItem::CONNECTING)) { - fire(ConnectionManagerListener::Failed(), cqi, STRING(CONNECTION_TIMEOUT)); + fire(ConnectionManagerListener::Failed(), cqi, _("Connection timeout")); cqi->setState(ConnectionQueueItem::WAITING); } } @@ -237,7 +236,7 @@ } } } catch(const Exception& e) { - LogManager::getInstance()->message(STRING(LISTENER_FAILED) + e.getError()); + LogManager::getInstance()->message(str(F_("Listening socket failed (you need to restart DC++): %1%") % e.getError())); } return 0; } @@ -383,7 +382,7 @@ 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)); + LogManager::getInstance()->message(_("Certificate not trusted, unable to connect")); return; } Modified: dcplusplus/trunk/dcpp/CryptoManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/CryptoManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/CryptoManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -23,7 +23,6 @@ #include "BitInputStream.h" #include "BitOutputStream.h" -#include "ResourceManager.h" #include "LogManager.h" #include "ClientManager.h" @@ -211,7 +210,7 @@ const string& key = SETTING(TLS_PRIVATE_KEY_FILE); if(cert.empty() || key.empty()) { - LogManager::getInstance()->message(STRING(NO_CERTIFICATE_FILE_SET)); + LogManager::getInstance()->message(_("TLS disabled, no certificate file set")); return; } @@ -219,45 +218,45 @@ // Try to generate them... try { generateCertificate(); - LogManager::getInstance()->message(STRING(CERTIFICATE_GENERATED)); + LogManager::getInstance()->message(_("Generated new TLS certificate")); } catch(const CryptoException& e) { - LogManager::getInstance()->message(STRING(CERTIFICATE_GENERATION_FAILED) + e.getError()); + LogManager::getInstance()->message(str(F_("TLS disabled, failed to generate certificate: %1%") % e.getError())); } } 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)); + 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(STRING(FAILED_TO_LOAD_CERTIFICATE)); + LogManager::getInstance()->message(_("Failed to load certificate file")); 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)); + LogManager::getInstance()->message(_("Failed to load certificate file")); 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)); + LogManager::getInstance()->message(_("Failed to load certificate file")); 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)); + LogManager::getInstance()->message(_("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)); + LogManager::getInstance()->message(_("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)); + LogManager::getInstance()->message(_("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)); + LogManager::getInstance()->message(_("Failed to load private key")); return; } @@ -342,7 +341,7 @@ bz_stream bs = { 0 }; if(BZ2_bzDecompressInit(&bs, 0, 0) != BZ_OK) - throw(CryptoException(STRING(DECOMPRESSION_ERROR))); + throw(CryptoException(_("Error during decompression"))); // We assume that the files aren't compressed more than 2:1...if they are it'll work anyway, // but we'll have to do multiple passes... @@ -361,7 +360,7 @@ while((err = BZ2_bzDecompress(&bs)) == BZ_OK) { if (bs.avail_in == 0 && bs.avail_out > 0) { // error: BZ_UNEXPECTED_EOF BZ2_bzDecompressEnd(&bs); - throw CryptoException(STRING(DECOMPRESSION_ERROR)); + throw CryptoException(_("Error during decompression")); } os.append(buf, bufsize-bs.avail_out); bs.avail_out = bufsize; @@ -375,7 +374,7 @@ if(err < 0) { // This was a real error - throw CryptoException(STRING(DECOMPRESSION_ERROR)); + throw CryptoException(_("Error during decompression")); } } Modified: dcplusplus/trunk/dcpp/DCPlusPlus.cpp =================================================================== --- dcplusplus/trunk/dcpp/DCPlusPlus.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/DCPlusPlus.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -97,13 +97,13 @@ CryptoManager::getInstance()->loadCertificates(); if(f != NULL) - (*f)(p, STRING(HASH_DATABASE)); + (*f)(p, _("Hash database")); HashManager::getInstance()->startup(); if(f != NULL) - (*f)(p, STRING(SHARED_FILES)); + (*f)(p, _("Shared Files")); ShareManager::getInstance()->refresh(true, false, true); if(f != NULL) - (*f)(p, STRING(DOWNLOAD_QUEUE)); + (*f)(p, _("Download Queue")); QueueManager::getInstance()->loadQueue(); } Modified: dcplusplus/trunk/dcpp/DirectoryListing.cpp =================================================================== --- dcplusplus/trunk/dcpp/DirectoryListing.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/DirectoryListing.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -30,7 +30,6 @@ #include "FilteredFile.h" #include "BZUtils.h" #include "CryptoManager.h" -#include "ResourceManager.h" #ifdef ff #undef ff @@ -100,7 +99,7 @@ } else if(Util::stricmp(ext, ".xml") == 0) { int64_t sz = dcpp::File::getSize(name); if(sz == -1 || sz >= static_cast<int64_t>(txt.max_size())) - throw FileException(STRING(FILE_NOT_AVAILABLE)); + throw FileException(_("File not available")); txt.resize((size_t) sz); size_t n = txt.length(); Modified: dcplusplus/trunk/dcpp/DownloadManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -21,7 +21,6 @@ #include "DownloadManager.h" -#include "ResourceManager.h" #include "QueueManager.h" #include "Download.h" #include "LogManager.h" @@ -141,9 +140,9 @@ // Try to just rename it to the correct name at least string newTarget = Util::getFilePath(next.first) + Util::getFileName(next.second); File::renameFile(next.first, newTarget); - LogManager::getInstance()->message(next.first + STRING(RENAMED_TO) + newTarget); + LogManager::getInstance()->message(str(F_("%1% renamed to %2%") % next.first % newTarget)); } catch(const FileException& e) { - LogManager::getInstance()->message(STRING(UNABLE_TO_RENAME) + next.first + ": " + e.getError()); + LogManager::getInstance()->message(str(F_("Unable to rename %1%: %2%") % next.first % e.getError())); } } } @@ -262,12 +261,12 @@ if(bytes != -1) { d->setSize(bytes); } else { - failDownload(aSource, STRING(INVALID_SIZE)); + failDownload(aSource, _("Invalid size")); return false; } } else if(d->getSize() != bytes || d->getStartPos() != start) { // This is not what we requested... - failDownload(aSource, STRING(INVALID_SIZE)); + failDownload(aSource, _("Invalid size")); return false; } @@ -282,7 +281,7 @@ try { QueueManager::getInstance()->setFile(d); } catch(const FileException& e) { - failDownload(aSource, STRING(COULD_NOT_OPEN_TARGET_FILE) + e.getError()); + failDownload(aSource, str(F_("Could not open target file: %1%") % e.getError())); return false; } catch(const Exception& e) { failDownload(aSource, e.getError()); @@ -321,7 +320,7 @@ d->addPos(d->getFile()->write(aData, aLen), aLen); if(d->getPos() > d->getSize()) { - throw Exception(STRING(TOO_MUCH_DATA)); + throw Exception(_("More data was sent than was expected")); } else if(d->getPos() == d->getSize()) { handleEndData(aSource); aSource->setLineMode(0); @@ -351,7 +350,7 @@ if(!(d->getTTH() == d->getTigerTree().getRoot())) { // This tree is for a different file, remove from queue... removeDownload(d); - fire(DownloadManagerListener::Failed(), d, STRING(INVALID_TREE)); + fire(DownloadManagerListener::Failed(), d, _("Full tree does not match TTH root")); QueueManager::getInstance()->removeSource(d->getPath(), aSource->getUser(), QueueItem::Source::FLAG_BAD_TREE, false); @@ -417,9 +416,9 @@ if(!crcMatch) { File::deleteFile(d->getDownloadTarget()); dcdebug("DownloadManager: CRC32 mismatch for %s\n", d->getPath().c_str()); - LogManager::getInstance()->message(STRING(SFV_INCONSISTENCY) + " (" + STRING(FILE) + ": " + d->getPath() + ")"); + LogManager::getInstance()->message(str(F_("CRC32 inconsistency (SFV-Check) (File: %1%)") % d->getPath())); removeDownload(d); - fire(DownloadManagerListener::Failed(), d, STRING(SFV_INCONSISTENCY)); + fire(DownloadManagerListener::Failed(), d, _("CRC32 inconsistency (SFV-Check)")); QueueManager::getInstance()->removeSource(d->getPath(), aSource->getUser(), QueueItem::Source::FLAG_CRC_WARN, false); QueueManager::getInstance()->putDownload(d, false); @@ -460,7 +459,7 @@ return; } - failDownload(aSource, STRING(NO_SLOTS_AVAILABLE)); + failDownload(aSource, _("No slots available")); } void DownloadManager::on(UserConnectionListener::Error, UserConnection* aSource, const string& aError) throw() { @@ -545,7 +544,7 @@ dcdebug("File Not Available: %s\n", d->getPath().c_str()); removeDownload(d); - fire(DownloadManagerListener::Failed(), d, d->getTargetFileName() + ": " + STRING(FILE_NOT_AVAILABLE)); + fire(DownloadManagerListener::Failed(), d, str(F_("%1%: File not available") % d->getTargetFileName())); QueueManager::getInstance()->removeSource(d->getPath(), aSource->getUser(), d->getType() == Transfer::TYPE_TREE ? QueueItem::Source::FLAG_NO_TREE : QueueItem::Source::FLAG_FILE_NOT_AVAILABLE, false); Modified: dcplusplus/trunk/dcpp/FavoriteManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/FavoriteManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/FavoriteManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -22,7 +22,6 @@ #include "FavoriteManager.h" #include "ClientManager.h" -#include "ResourceManager.h" #include "CryptoManager.h" #include "HttpConnection.h" @@ -436,11 +435,11 @@ static const char kickstr[] = "$To: %[userNI] From: %[myNI] $<%[myNI]> You are being kicked because: %[line:Reason]|<%[myNI]> %[myNI] is kicking %[userNI] because: %[line:Reason]|$Kick %[userNI]|"; addUserCommand(UserCommand::TYPE_RAW_ONCE, UserCommand::CONTEXT_CHAT | UserCommand::CONTEXT_SEARCH, UserCommand::FLAG_NOSAVE, - STRING(KICK_USER), kickstr, "op"); + _("Kick user(s)"), kickstr, "op"); static const char redirstr[] = "$OpForceMove $Who:%[userNI]$Where:%[line:Target Server]$Msg:%[line:Message]|"; addUserCommand(UserCommand::TYPE_RAW_ONCE, UserCommand::CONTEXT_CHAT | UserCommand::CONTEXT_SEARCH, UserCommand::FLAG_NOSAVE, - STRING(REDIRECT_USER), redirstr, "op"); + _("Redirect user(s)"), redirstr, "op"); try { SimpleXML xml; Modified: dcplusplus/trunk/dcpp/HashManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/HashManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/HashManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -20,7 +20,6 @@ #include "DCPlusPlus.h" #include "HashManager.h" -#include "ResourceManager.h" #include "SimpleXML.h" #include "LogManager.h" #include "File.h" @@ -71,7 +70,7 @@ Lock l(cs); store.addFile(aFileName, aTimeStamp, tth, true); } catch(const Exception& e) { - LogManager::getInstance()->message(STRING(HASHING_FAILED) + e.getError()); + LogManager::getInstance()->message(str(F_("Hashing failed: %1%") % e.getError())); return; } @@ -85,9 +84,9 @@ fn.insert(0, "..."); } if(speed > 0) { - LogManager::getInstance()->message(STRING(HASHING_FINISHED) + fn + " (" + Util::formatBytes(speed) + "/s)"); + LogManager::getInstance()->message(str(F_("Finished hashing: %1% (%2%/s)") % fn % Util::formatBytes(speed))); } else { - LogManager::getInstance()->message(STRING(HASHING_FINISHED) + fn); + LogManager::getInstance()->message(str(F_("Finished hashing: %1%") % fn)); } } @@ -116,7 +115,7 @@ 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()); + LogManager::getInstance()->message(str(F_("Error saving hash data: %1%") % e.getError())); } } } @@ -129,7 +128,7 @@ int64_t pos = 0; size_t n = sizeof(pos); if(f.read(&pos, n) != sizeof(pos)) - throw HashException(STRING(HASH_READ_FAILED)); + throw HashException(_("Unable to read hash data file")); // Check if we should grow the file, we grow by a meg at a time... int64_t datsz = f.getSize(); @@ -275,7 +274,7 @@ dirty = true; save(); } catch(const Exception& e) { - LogManager::getInstance()->message(STRING(HASHING_FAILED) + e.getError()); + LogManager::getInstance()->message(str(F_("Hashing failed: %1%") % e.getError())); } } @@ -331,7 +330,7 @@ dirty = false; } catch(const FileException& e) { - LogManager::getInstance()->message(STRING(ERROR_SAVING_HASH) + e.getError()); + LogManager::getInstance()->message(str(F_("Error saving hash data: %1%") % e.getError())); } } } @@ -454,7 +453,7 @@ dat.write(&start, sizeof(start)); } catch(const FileException& e) { - LogManager::getInstance()->message(STRING(ERROR_CREATING_HASH_DATA_FILE) + e.getError()); + LogManager::getInstance()->message(str(F_("Error creating hash data file: %1%") % e.getError())); } } @@ -675,7 +674,7 @@ if(rebuild) { HashManager::getInstance()->doRebuild(); rebuild = false; - LogManager::getInstance()->message(STRING(HASH_REBUILT)); + LogManager::getInstance()->message(_("Hash database rebuilt")); continue; } { @@ -765,12 +764,12 @@ speed = size * _LL(1000) / (end - start); } if(xcrc32 && xcrc32->getValue() != sfv.getCRC()) { - LogManager::getInstance()->message(fname + STRING(NO_CRC32_MATCH)); + LogManager::getInstance()->message(str(F_("%1% not shared; calculated CRC32 does not match the one found in SFV file.") % fname)); } else { HashManager::getInstance()->hashDone(fname, timestamp, *tth, speed); } } catch(const FileException& e) { - LogManager::getInstance()->message(STRING(ERROR_HASHING) + fname + ": " + e.getError()); + LogManager::getInstance()->message(str(F_("Error hashing %1%: %2%") % fname % e.getError())); } } { Modified: dcplusplus/trunk/dcpp/MerkleCheckOutputStream.h =================================================================== --- dcplusplus/trunk/dcpp/MerkleCheckOutputStream.h 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/MerkleCheckOutputStream.h 2008-01-23 19:46:22 UTC (rev 974) @@ -50,7 +50,7 @@ cur.finalize(); if(cur.getLeaves().size() == real.getLeaves().size()) { if (cur.getRoot() != real.getRoot()) - throw FileException(STRING(TTH_INCONSISTENCY)); + throw FileException(_("TTH inconsistency")); } else { checkTrees(); } @@ -110,7 +110,7 @@ if(cur.getLeaves().size() > real.getLeaves().size() || !(cur.getLeaves()[verified] == real.getLeaves()[verified])) { - throw FileException(STRING(TTH_INCONSISTENCY)); + throw FileException(_("TTH inconsistency")); } verified++; } Modified: dcplusplus/trunk/dcpp/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/NmdcHub.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/NmdcHub.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -21,7 +21,6 @@ #include "NmdcHub.h" -#include "ResourceManager.h" #include "ClientManager.h" #include "SearchManager.h" #include "ShareManager.h" @@ -271,7 +270,7 @@ if(seeker.compare(0, 4, "Hub:") == 0) fire(ClientListener::SearchFlood(), this, seeker.substr(4)); else - fire(ClientListener::SearchFlood(), this, seeker + STRING(NICK_UNKNOWN)); + fire(ClientListener::SearchFlood(), this, str(F_("%1% (Nick unknown)") % seeker)); flooders.push_back(make_pair(seeker, tick)); return; Modified: dcplusplus/trunk/dcpp/QueueManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/QueueManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/QueueManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -381,7 +381,7 @@ void QueueManager::addPfs(const UserPtr& aUser, const string& aDir) throw(QueueException) { if(aUser == ClientManager::getInstance()->getMe()) { - throw QueueException(STRING(NO_DOWNLOADS_FROM_SELF)); + throw QueueException(_("You're trying to download from yourself!")); } if(!aUser->isOnline()) @@ -405,13 +405,13 @@ // Check that we're not downloading from ourselves... if(aUser == ClientManager::getInstance()->getMe()) { - throw QueueException(STRING(NO_DOWNLOADS_FROM_SELF)); + throw QueueException(_("You're trying to download from yourself!")); } // Check if we're not downloading something already in our share if(BOOLSETTING(DONT_DL_ALREADY_SHARED)){ if (ShareManager::getInstance()->isTTHShared(root)){ - throw QueueException(STRING(TTH_ALREADY_SHARED)); + throw QueueException(_("A file with the same hash already exists in your share")); } } @@ -434,7 +434,7 @@ QueueItem::List ql; fileQueue.find(ql, root); if(!ql.empty()) { - throw QueueException(STRING(FILE_IS_ALREADY_QUEUED)); + throw QueueException(_("This file is already queued")); } } @@ -444,10 +444,10 @@ fire(QueueManagerListener::Added(), q); } else { if(q->getSize() != aSize) { - throw QueueException(STRING(FILE_WITH_DIFFERENT_SIZE)); + throw QueueException(_("A file with a different size already exists in the queue")); } if(!(root == q->getTTH())) { - throw QueueException(STRING(FILE_WITH_DIFFERENT_TTH)); + throw QueueException(_("A file with different tth root already exists in the queue")); } q->setFlag(aFlags); @@ -479,20 +479,20 @@ string QueueManager::checkTarget(const string& aTarget, int64_t aSize, int& flags) throw(QueueException, FileException) { #ifdef _WIN32 if(aTarget.length() > MAX_PATH) { - throw QueueException(STRING(TARGET_FILENAME_TOO_LONG)); + throw QueueException(_("Target filename too long")); } // Check that target starts with a drive or is an UNC path if( (aTarget[1] != ':' || aTarget[2] != '\\') && (aTarget[0] != '\\' && aTarget[1] != '\\') ) { - throw QueueException(STRING(INVALID_TARGET_FILE)); + throw QueueException(_("Invalid target file (missing directory, check default download directory setting)")); } #else if(aTarget.length() > PATH_MAX) { - throw QueueException(STRING(TARGET_FILENAME_TOO_LONG)); + throw QueueException(_("Target filename too long")); } // Check that target contains at least one directory...we don't want headless files... if(aTarget[0] != '/') { - throw QueueException(STRING(INVALID_TARGET_FILE)); + throw QueueException(_("Invalid target file (missing directory, check default download directory setting)")); } #endif @@ -501,7 +501,7 @@ // Check that the file doesn't already exist... int64_t sz = File::getSize(target); if( (aSize != -1) && (aSize <= sz) ) { - throw FileException(STRING(LARGER_TARGET_FILE_EXISTS)); + throw FileException(_("A file of equal or larger size already exists at the target location")); } if(sz > 0) flags |= QueueItem::FLAG_EXISTS; @@ -514,11 +514,11 @@ bool wantConnection = (qi->getPriority() != QueueItem::PAUSED) && !userQueue.getRunning(aUser); if(qi->isSource(aUser)) { - throw QueueException(STRING(DUPLICATE_SOURCE) + ": " + Util::getFileName(qi->getTarget())); + throw QueueException(str(F_("Duplicate source: %1%") % Util::getFileName(qi->getTarget()))); } if(qi->isBadSourceExcept(aUser, addBad)) { - throw QueueException(STRING(DUPLICATE_SOURCE) + ": " + Util::getFileName(qi->getTarget())); + throw QueueException(str(F_("Duplicate source: %1%") % Util::getFileName(qi->getTarget()))); } qi->addSource(aUser); @@ -767,7 +767,7 @@ QueueItem* qi = fileQueue.find(d->getPath()); if(!qi) { - throw QueueException(STRING(TARGET_REMOVED)); + throw QueueException(_("Target removed")); } string target = d->getDownloadTarget(); @@ -955,7 +955,7 @@ try { dirList.loadFile(name); } catch(const Exception&) { - LogManager::getInstance()->message(STRING(UNABLE_TO_OPEN_FILELIST) + name); + LogManager::getInstance()->message(str(F_("Unable to open filelist: %1%") % name)); return; } Modified: dcplusplus/trunk/dcpp/SearchManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/SearchManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/SearchManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -24,7 +24,6 @@ #include "ClientManager.h" #include "ShareManager.h" -#include "ResourceManager.h" namespace dcpp { @@ -265,7 +264,7 @@ if(hubName.compare(0, 4, "TTH:") == 0) { tth = hubName.substr(4); StringList names = ClientManager::getInstance()->getHubNames(user->getCID()); - hubName = names.empty() ? STRING(OFFLINE) : Util::toString(names); + hubName = names.empty() ? _("Offline") : Util::toString(names); } if(tth.empty() && type == SearchResult::TYPE_FILE) { @@ -327,9 +326,9 @@ if(!file.empty() && freeSlots != -1 && size != -1) { StringList names = ClientManager::getInstance()->getHubNames(from->getCID()); - string hubName = names.empty() ? STRING(OFFLINE) : Util::toString(names); + string hubName = names.empty() ? _("Offline") : Util::toString(names); StringList hubs = ClientManager::getInstance()->getHubs(from->getCID()); - string hub = hubs.empty() ? STRING(OFFLINE) : Util::toString(hubs); + string hub = hubs.empty() ? _("Offline") : Util::toString(hubs); SearchResult::Types type = (file[file.length() - 1] == '\\' ? SearchResult::TYPE_DIRECTORY : SearchResult::TYPE_FILE); if(type == SearchResult::TYPE_FILE && tth.empty()) Modified: dcplusplus/trunk/dcpp/ShareManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ShareManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/ShareManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -20,7 +20,6 @@ #include "DCPlusPlus.h" #include "ShareManager.h" -#include "ResourceManager.h" #include "CryptoManager.h" #include "ClientManager.h" @@ -401,11 +400,11 @@ void ShareManager::addDirectory(const string& realPath, const string& virtualName) throw(ShareException) { if(realPath.empty() || virtualName.empty()) { - throw ShareException(STRING(NO_DIRECTORY_SPECIFIED)); + throw ShareException(_("No directory specified")); } if(Util::stricmp(SETTING(TEMP_DOWNLOAD_DIRECTORY), realPath) == 0) { - throw ShareException(STRING(DONT_SHARE_TEMP_DIRECTORY)); + throw ShareException(_("The temporary download directory cannot be shared")); } string vName = validateVirtual(virtualName); @@ -416,15 +415,15 @@ for(Directory::MapIter i = directories.begin(); i != directories.end(); ++i) { if(Util::strnicmp(realPath, i->first, i->first.length()) == 0) { // Trying to share an already shared directory - throw ShareException(STRING(DIRECTORY_ALREADY_SHARED)); + throw ShareException(_("Directory already shared")); } else if(Util::strnicmp(realPath, i->first, realPath.length()) == 0) { // Trying to share a parent directory - throw ShareException(STRING(REMOVE_ALL_SUBDIRECTORIES)); + throw ShareException(_("Remove all subdirectories before adding this one")); } } if(hasVirtual(vName)) { - throw ShareException(STRING(VIRTUAL_NAME_EXISTS)); + throw ShareException(_("Virtual directory name already exists")); } } @@ -466,7 +465,7 @@ Lock l(cs); //Find the virtual name if (hasVirtual(vName)) { - throw ShareException(STRING(VIRTUAL_NAME_EXISTS)); + throw ShareException(_("Virtual directory name already exists")); } Directory::MapIter j = directories.find(realPath); @@ -743,7 +742,8 @@ dir.size+=f.getSize(); } else { if(!SETTING(LIST_DUPES)) { - LogManager::getInstance()->message(STRING(DUPLICATE_FILE_NOT_SHARED) + dir.getFullName() + f.getName() + " (" + STRING(SIZE) + ": " + Util::toString(f.getSize()) + " " + STRING(B) + ") " + STRING(DUPLICATE_MATCH) + j->second->getParent()->getFullName() + j->second->getName() ); + LogManager::getInstance()->message(str(F_("Duplicate file will not be shared: %1%%2% (Size: %3% B) Dupe matched against: %4%%5%") + % dir.getFullName() % f.getName() % Util::toString(f.getSize()) % j->second->getParent()->getFullName() % j->second->getName())); dir.files.erase(i); return; } @@ -757,7 +757,7 @@ void ShareManager::refresh(bool dirs /* = false */, bool aUpdate /* = true */, bool block /* = false */) throw() { if(Thread::safeExchange(refreshing, 1) == 1) { - LogManager::getInstance()->message(STRING(FILE_LIST_REFRRESH_IN_PROGRESS)); + LogManager::getInstance()->message(_("File list refresh in progress, please wait for it to finish before trying to refresh again")); return; } @@ -777,7 +777,7 @@ setThreadPriority(Thread::LOW); } } catch(const ThreadException& e) { - LogManager::getInstance()->message(STRING(FILE_LIST_REFRESH_FAILED) + e.getError()); + LogManager::getInstance()->message(str(F_("File list refresh failed: %1%") % e.getError())); } } @@ -799,7 +799,7 @@ { if(refreshDirs) { - LogManager::getInstance()->message(STRING(FILE_LIST_REFRESH_INITIATED)); + LogManager::getInstance()->message(_("File list refresh initiated")); lastFullUpdate = GET_TICK(); @@ -821,7 +821,7 @@ } refreshDirs = false; - LogManager::getInstance()->message(STRING(FILE_LIST_REFRESH_FINISHED)); + LogManager::getInstance()->message(_("File list refresh finished")); } } Modified: dcplusplus/trunk/dcpp/Socket.cpp =================================================================== --- dcplusplus/trunk/dcpp/Socket.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/Socket.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -22,7 +22,6 @@ #include "Socket.h" #include "SettingsManager.h" -#include "ResourceManager.h" #include "TimerManager.h" namespace dcpp { @@ -53,9 +52,7 @@ string msg = Util::translateError(aError); if(msg.empty()) { - char tmp[64]; - snprintf(tmp, sizeof(tmp), CSTRING(UNKNOWN_ERROR), aError); - msg = tmp; + msg = str(F_("Unknown error: 0x%1%") % aError); } return msg; } @@ -155,7 +152,7 @@ } uint64_t now = GET_TICK(); if(start + timeout < now) - throw SocketException(STRING(CONNECTION_TIMEOUT)); + throw SocketException(_("Connection timeout")); return start + timeout - now; } } @@ -163,7 +160,7 @@ void Socket::socksConnect(const string& aAddr, uint16_t aPort, uint32_t timeout) throw(SocketException) { if(SETTING(SOCKS_SERVER).empty() || SETTING(SOCKS_PORT) == 0) { - throw SocketException(STRING(SOCKS_FAILED)); + throw SocketException(_("The socks server failed establish a connection")); } bool oldblock = getBlocking(); @@ -174,7 +171,7 @@ connect(SETTING(SOCKS_SERVER), static_cast<uint16_t>(SETTING(SOCKS_PORT))); if(wait(timeLeft(start, timeout), WAIT_CONNECT) != WAIT_CONNECT) { - throw SocketException(STRING(SOCKS_FAILED)); + throw SocketException(_("The socks server failed establish a connection")); } socksAuth(timeLeft(start, timeout)); @@ -207,11 +204,11 @@ // We assume we'll get a ipv4 address back...therefore, 10 bytes... /// @todo add support for ipv6 if(readAll(&connStr[0], 10, timeLeft(start, timeout)) != 10) { - throw SocketException(STRING(SOCKS_FAILED)); + throw SocketException(_("The socks server failed establish a connection")); } if(connStr[0] != 5 || connStr[1] != 0) { - throw SocketException(STRING(SOCKS_FAILED)); + throw SocketException(_("The socks server failed establish a connection")); } in_addr sock_addr; @@ -238,11 +235,11 @@ writeAll(&connStr[0], 3, timeLeft(start, timeout)); if(readAll(&connStr[0], 2, timeLeft(start, timeout)) != 2) { - throw SocketException(STRING(SOCKS_FAILED)); + throw SocketException(_("The socks server failed establish a connection")); } if(connStr[1] != 0) { - throw SocketException(STRING(SOCKS_NEEDS_AUTH)); + throw SocketException(_("The socks server requires authentication")); } } else { // We try the username and password auth type (no, we don't support gssapi) @@ -253,10 +250,10 @@ writeAll(&connStr[0], 3, timeLeft(start, timeout)); if(readAll(&connStr[0], 2, timeLeft(start, timeout)) != 2) { - throw SocketException(STRING(SOCKS_FAILED)); + throw SocketException(_("The socks server failed establish a connection")); } if(connStr[1] != 2) { - throw SocketException(STRING(SOCKS_AUTH_UNSUPPORTED)); + throw SocketException(_("The socks server doesn't support login / password authentication")); } connStr.clear(); @@ -270,11 +267,11 @@ writeAll(&connStr[0], connStr.size(), timeLeft(start, timeout)); if(readAll(&connStr[0], 2, timeLeft(start, timeout)) != 2) { - throw SocketException(STRING(SOCKS_AUTH_FAILED)); + throw SocketException(_("Socks server authentication failed (bad login / password?)")); } if(connStr[1] != 0) { - throw SocketException(STRING(SOCKS_AUTH_FAILED)); + throw SocketException(_("Socks server authentication failed (bad login / password?)")); } } } @@ -409,7 +406,7 @@ int sent; if(SETTING(OUTGOING_CONNECTIONS) == SettingsManager::OUTGOING_SOCKS5 && proxy) { if(udpServer.empty() || udpPort == 0) { - throw SocketException(STRING(SOCKS_SETUP_ERROR)); + throw SocketException(_("Failed to set up the socks server for UDP relay (check socks address and port)")); } serv_addr.sin_port = htons(udpPort); Modified: dcplusplus/trunk/dcpp/Thread.cpp =================================================================== --- dcplusplus/trunk/dcpp/Thread.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/Thread.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -21,8 +21,6 @@ #include "Thread.h" -#include "ResourceManager.h" - namespace dcpp { #ifndef _WIN32 @@ -33,7 +31,7 @@ void Thread::start() throw(ThreadException) { join(); if( (threadHandle = CreateThread(NULL, 0, &starter, this, 0, &threadId)) == NULL) { - throw ThreadException(STRING(UNABLE_TO_CREATE_THREAD)); + throw ThreadException(_("Unable to create thread")); } } @@ -41,7 +39,7 @@ void Thread::start() throw(ThreadException) { join(); if(pthread_create(&threadHandle, NULL, &starter, this) != 0) { - throw ThreadException(STRING(UNABLE_TO_CREATE_THREAD)); + throw ThreadException(_("Unable to create thread")); } } #endif Modified: dcplusplus/trunk/dcpp/Transfer.cpp =================================================================== --- dcplusplus/trunk/dcpp/Transfer.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/Transfer.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -22,7 +22,6 @@ #include "Transfer.h" #include "UserConnection.h" -#include "ResourceManager.h" #include "ClientManager.h" namespace dcpp { @@ -61,11 +60,11 @@ params["userI4"] = aSource.getRemoteIp(); StringList hubNames = ClientManager::getInstance()->getHubNames(aSource.getUser()->getCID()); if(hubNames.empty()) - hubNames.push_back(STRING(OFFLINE)); + hubNames.push_back(_("Offline")); params["hub"] = Util::toString(hubNames); StringList hubs = ClientManager::getInstance()->getHubs(aSource.getUser()->getCID()); if(hubs.empty()) - hubs.push_back(STRING(OFFLINE)); + hubs.push_back(_("Offline")); params["hubURL"] = Util::toString(hubs); params["fileSI"] = Util::toString(getSize()); params["fileSIshort"] = Util::formatBytes(getSize()); Modified: dcplusplus/trunk/dcpp/UploadManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/UploadManager.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/UploadManager.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -27,7 +27,6 @@ #include "ClientManager.h" #include "FilteredFile.h" #include "ZUtils.h" -#include "ResourceManager.h" #include "HashManager.h" #include "AdcCommand.h" #include "FavoriteManager.h" @@ -147,7 +146,7 @@ aSource.fileNotAvail(e.getError()); return false; } catch(const Exception& e) { - LogManager::getInstance()->message(STRING(UNABLE_TO_SEND_FILE) + sourceFile + ": " + e.getError()); + LogManager::getInstance()->message(str(F_("Unable to send file %1%: %2%") % sourceFile % e.getError())); aSource.fileNotAvail(); return false; } @@ -448,7 +447,7 @@ } for(UserList::iterator i = disconnects.begin(); i != disconnects.end(); ++i) { - LogManager::getInstance()->message(STRING(DISCONNECTED_USER) + Util::toString(ClientManager::getInstance()->getNicks((*i)->getCID()))); + LogManager::getInstance()->message(str(F_("Disconnected user leaving the hub: %1%") % Util::toString(ClientManager::getInstance()->getNicks((*i)->getCID())))); ConnectionManager::getInstance()->disconnect(*i, false); } } Modified: dcplusplus/trunk/dcpp/UserConnection.cpp =================================================================== --- dcplusplus/trunk/dcpp/UserConnection.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/UserConnection.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -21,7 +21,6 @@ #include "UserConnection.h" #include "ClientManager.h" -#include "ResourceManager.h" #include "StringTokenizer.h" #include "AdcCommand.h" Modified: dcplusplus/trunk/dcpp/ZUtils.cpp =================================================================== --- dcplusplus/trunk/dcpp/ZUtils.cpp 2008-01-22 22:47:59 UTC (rev 973) +++ dcplusplus/trunk/dcpp/ZUtils.cpp 2008-01-23 19:46:22 UTC (rev 974) @@ -21,7 +21,6 @@ #include "ZUtils.h" #include "Exception.h" -#include "ResourceManager.h" namespace dcpp { @@ -31,7 +30,7 @@ memset(&zs, 0, sizeof(zs)); if(deflateInit(&zs, 3) != Z_OK) { - throw Exception(STRING(COMPRESSION_ERROR)); + throw Exception(_("Error during compression")); } } @@ -52,7 +51,7 @@ zs.avail_in = 0; zs.avail_out = outsize; if(deflateParams(&zs, 0, Z_DEFAULT_STRATEGY) != Z_OK) { - throw Exception(STRING(COMPRESSION_ERROR)); + throw Exception(_("Error during compression")); } zs.avail_in = insize; compressing = false; @@ -74,7 +73,7 @@ if(insize == 0) { int err = ::deflate(&zs, Z_FINISH); if(err != Z_OK && err != Z_STREAM_END) - throw Exception(STRING(COMPRESSION_ERROR)); + throw Exception(_("Error during compression")); outsize = outsize - zs.avail_out; insize = insize - zs.avail_in; @@ -84,7 +83,7 @@ } else { int err = ::deflate(&zs, Z_NO_FLUSH); if(err != Z_OK) - throw Exception(STRING(COMPRESSION_ERROR)); + throw Exception(_("Error during compression")); outsize = outsize - zs.avail_out; insize = insize - zs.avail_in; @@ -98,7 +97,7 @@ memset(&zs, 0, sizeof(zs)); if(inflateInit(&zs) != Z_OK) - throw Exception(STRING(DECOMPRESSION_ERROR)); + throw Exception(_("Error during decompression")); } UnZFilter::~UnZFilter() { @@ -121,7 +120,7 @@ // with a dummy byte if at end of stream - since we don't do this it's not a real // error if(!(err == Z_OK || err == Z_STREAM_END || (err == Z_BUF_ERROR && in == NULL))) - throw Exception(STRING(DECOMPRESSION_ERROR)); + throw Exception(_("Error during decompression")); outsize = outsize - zs.avail_out; insize = insize - zs.avail_in; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-02-05 09:33:12
|
Revision: 989 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=989&view=rev Author: arnetheduck Date: 2008-02-05 01:32:59 -0800 (Tue, 05 Feb 2008) Log Message: ----------- Use libdcpp to avoid launchpad bugs Modified Paths: -------------- dcplusplus/trunk/dcpp/DCPlusPlus.h dcplusplus/trunk/dcpp/SConscript Modified: dcplusplus/trunk/dcpp/DCPlusPlus.h =================================================================== --- dcplusplus/trunk/dcpp/DCPlusPlus.h 2008-02-05 09:31:54 UTC (rev 988) +++ dcplusplus/trunk/dcpp/DCPlusPlus.h 2008-02-05 09:32:59 UTC (rev 989) @@ -169,7 +169,7 @@ extern void shutdown(); #ifdef BUILDING_DCPP -#define PACKAGE "dcpp" +#define PACKAGE "libdcpp" #define LOCALEDIR Util::getLocalePath().c_str() #define _(String) dgettext(PACKAGE, String) #define F_(String) boost::format(dgettext(PACKAGE, String)) Modified: dcplusplus/trunk/dcpp/SConscript =================================================================== --- dcplusplus/trunk/dcpp/SConscript 2008-02-05 09:31:54 UTC (rev 988) +++ dcplusplus/trunk/dcpp/SConscript 2008-02-05 09:32:59 UTC (rev 989) @@ -39,7 +39,7 @@ env.Append(CPPDEFINES=["BUILDING_DCPP=1"]) -dev.i18n(source_path, env, sources, 'dcpp') +dev.i18n(source_path, env, sources, 'libdcpp') ret = env.StaticLibrary(target, sources) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |