|
From: <arn...@us...> - 2006-09-19 19:21:18
|
Revision: 653
http://svn.sourceforge.net/dcplusplus/?rev=653&view=rev
Author: arnetheduck
Date: 2006-09-19 12:20:45 -0700 (Tue, 19 Sep 2006)
Log Message:
-----------
search socket fix, init order
Modified Paths:
--------------
dcplusplus/trunk/DCPlusPlus.rc
dcplusplus/trunk/Example.xml
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/client/AdcHub.cpp
dcplusplus/trunk/client/ConnectionManager.cpp
dcplusplus/trunk/client/ConnectionManager.h
dcplusplus/trunk/client/SearchManager.cpp
dcplusplus/trunk/client/SearchManager.h
dcplusplus/trunk/client/StringDefs.cpp
dcplusplus/trunk/client/StringDefs.h
dcplusplus/trunk/client/version.h
dcplusplus/trunk/windows/SearchFrm.cpp
dcplusplus/trunk/windows/main.cpp
Modified: dcplusplus/trunk/DCPlusPlus.rc
===================================================================
--- dcplusplus/trunk/DCPlusPlus.rc 2006-09-19 13:00:44 UTC (rev 652)
+++ dcplusplus/trunk/DCPlusPlus.rc 2006-09-19 19:20:45 UTC (rev 653)
@@ -942,8 +942,8 @@
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,6,9,5
- PRODUCTVERSION 0,6,9,5
+ FILEVERSION 0,6,9,6
+ PRODUCTVERSION 0,6,9,6
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -960,12 +960,12 @@
BEGIN
VALUE "Comments", "http://dcplusplus.sourceforge.net"
VALUE "FileDescription", "DC++"
- VALUE "FileVersion", "0, 6, 9, 5"
+ VALUE "FileVersion", "0, 6, 9, 6"
VALUE "InternalName", "DC++"
VALUE "LegalCopyright", "Copyright 2001-2006 Jacek Sieka"
VALUE "OriginalFilename", "DCPlusPlus.exe"
VALUE "ProductName", "DC++"
- VALUE "ProductVersion", "0, 6, 9, 5"
+ VALUE "ProductVersion", "0, 6, 9, 6"
END
END
BLOCK "VarFileInfo"
Modified: dcplusplus/trunk/Example.xml
===================================================================
--- dcplusplus/trunk/Example.xml 2006-09-19 13:00:44 UTC (rev 652)
+++ dcplusplus/trunk/Example.xml 2006-09-19 19:20:45 UTC (rev 653)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<Language Name="Example Language" Native="English" Code="en" Author="arnetheduck" Version="0.695" Revision="1" RightToLeft="0">
+<Language Name="Example Language" Native="English" Code="en" Author="arnetheduck" Version="0.696" Revision="1" RightToLeft="0">
<Strings>
<String Name="Active">Active</String>
<String Name="ActiveSearchString">Enabled / Search String</String>
@@ -304,6 +304,7 @@
<String Name="NoUsers">No users</String>
<String Name="NoUsersToDownloadFrom">No users to download from</String>
<String Name="Normal">Normal</String>
+ <String Name="NotListening">Not listening for connections - please restart DC++</String>
<String Name="Notepad">Notepad</String>
<String Name="Offline">Offline</String>
<String Name="Online">Online</String>
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2006-09-19 13:00:44 UTC (rev 652)
+++ dcplusplus/trunk/changelog.txt 2006-09-19 19:20:45 UTC (rev 653)
@@ -1,4 +1,4 @@
--- --
+-- 0.696 --
* Fixed a possible deadlock
* [bug 1058] Removed some whitespace (big thanks to pothead)
* Removed the possibility to download files without TTH
Modified: dcplusplus/trunk/client/AdcHub.cpp
===================================================================
--- dcplusplus/trunk/client/AdcHub.cpp 2006-09-19 13:00:44 UTC (rev 652)
+++ dcplusplus/trunk/client/AdcHub.cpp 2006-09-19 19:20:45 UTC (rev 653)
@@ -30,6 +30,8 @@
#include "UserCommand.h"
#include "FavoriteManager.h"
#include "CryptoManager.h"
+#include "ResourceManager.h"
+#include "LogManager.h"
const string AdcHub::CLIENT_PROTOCOL("ADC/0.10");
const string AdcHub::SECURE_CLIENT_PROTOCOL("ADCS/0.10");
@@ -383,7 +385,11 @@
const string& proto = secure ? SECURE_CLIENT_PROTOCOL : CLIENT_PROTOCOL;
short port = secure ? ConnectionManager::getInstance()->getSecurePort() : ConnectionManager::getInstance()->getPort();
-
+ if(port == 0) {
+ // Oops?
+ LogManager::getInstance()->message(STRING(NOT_LISTENING));
+ return;
+ }
if(ClientManager::getInstance()->isActive()) {
send(AdcCommand(AdcCommand::CMD_CTM, user.getIdentity().getSID()).addParam(proto).addParam(Util::toString(port)).addParam(token));
} else {
Modified: dcplusplus/trunk/client/ConnectionManager.cpp
===================================================================
--- dcplusplus/trunk/client/ConnectionManager.cpp 2006-09-19 13:00:44 UTC (rev 652)
+++ dcplusplus/trunk/client/ConnectionManager.cpp 2006-09-19 19:20:45 UTC (rev 653)
@@ -51,6 +51,7 @@
server = new Server(false, port, SETTING(BIND_ADDRESS));
if(!CryptoManager::getInstance()->TLSOk()) {
+ dcdebug("Skipping secure port: %d\n", SETTING(USE_TLS));
return;
}
Modified: dcplusplus/trunk/client/ConnectionManager.h
===================================================================
--- dcplusplus/trunk/client/ConnectionManager.h 2006-09-19 13:00:44 UTC (rev 652)
+++ dcplusplus/trunk/client/ConnectionManager.h 2006-09-19 19:20:45 UTC (rev 653)
@@ -115,8 +115,8 @@
void listen() throw(SocketException);
void disconnect() throw();
- unsigned short getPort() { return static_cast<unsigned short>(server->getPort()); }
- unsigned short getSecurePort() { return static_cast<unsigned short>(secureServer->getPort()); }
+ unsigned short getPort() { return server ? static_cast<unsigned short>(server->getPort()) : 0; }
+ unsigned short getSecurePort() { return secureServer ? static_cast<unsigned short>(secureServer->getPort()) : 0; }
private:
class Server : public Thread {
Modified: dcplusplus/trunk/client/SearchManager.cpp
===================================================================
--- dcplusplus/trunk/client/SearchManager.cpp 2006-09-19 13:00:44 UTC (rev 652)
+++ dcplusplus/trunk/client/SearchManager.cpp 2006-09-19 19:20:45 UTC (rev 653)
@@ -96,37 +96,14 @@
return getFile().substr(i + 1);
}
-void SearchManager::listen() throw(Exception) {
- unsigned short lastPort = (unsigned short)SETTING(UDP_PORT);
+void SearchManager::listen() throw(SocketException) {
- if(lastPort == 0)
- lastPort = (unsigned short)Util::rand(1025, 32000);
-
- unsigned short firstPort = lastPort;
-
disconnect();
- while(true) {
- try {
- if(socket != NULL) {
- disconnect();
- } else {
- socket = new Socket();
- }
+ socket = new Socket();
+ socket->create(Socket::TYPE_UDP);
+ port = socket->bind(static_cast<short>(SETTING(UDP_PORT)));
- socket->create(Socket::TYPE_UDP);
- socket->bind(lastPort);
- port = lastPort;
- break;
- } catch(const Exception&) {
- short newPort = (short)((lastPort == 32000) ? 1025 : lastPort + 1);
- if(!SettingsManager::getInstance()->isDefault(SettingsManager::UDP_PORT) || (firstPort == newPort)) {
- throw Exception("Could not find a suitable free port");
- }
- lastPort = newPort;
- }
- }
-
start();
}
Modified: dcplusplus/trunk/client/SearchManager.h
===================================================================
--- dcplusplus/trunk/client/SearchManager.h 2006-09-19 13:00:44 UTC (rev 652)
+++ dcplusplus/trunk/client/SearchManager.h 2006-09-19 19:20:45 UTC (rev 653)
@@ -38,6 +38,7 @@
#include "AdcCommand.h"
class SearchManager;
+class SocketException;
class SearchResult : public FastAlloc<SearchResult> {
public:
@@ -146,7 +147,7 @@
return port;
}
- void listen() throw(Exception);
+ void listen() throw(SocketException);
void disconnect() throw();
void onSearchResult(const string& aLine) {
onData((const u_int8_t*)aLine.data(), aLine.length(), Util::emptyString);
Modified: dcplusplus/trunk/client/StringDefs.cpp
===================================================================
--- dcplusplus/trunk/client/StringDefs.cpp 2006-09-19 13:00:44 UTC (rev 652)
+++ dcplusplus/trunk/client/StringDefs.cpp 2006-09-19 19:20:45 UTC (rev 653)
@@ -305,6 +305,7 @@
"No users",
"No users to download from",
"Normal",
+"Not listening for connections - please restart DC++",
"Notepad",
"Offline",
"Online",
@@ -931,6 +932,7 @@
"NoUsers",
"NoUsersToDownloadFrom",
"Normal",
+"NotListening",
"Notepad",
"Offline",
"Online",
Modified: dcplusplus/trunk/client/StringDefs.h
===================================================================
--- dcplusplus/trunk/client/StringDefs.h 2006-09-19 13:00:44 UTC (rev 652)
+++ dcplusplus/trunk/client/StringDefs.h 2006-09-19 19:20:45 UTC (rev 653)
@@ -308,6 +308,7 @@
NO_USERS, // "No users"
NO_USERS_TO_DOWNLOAD_FROM, // "No users to download from"
NORMAL, // "Normal"
+ NOT_LISTENING, // "Not listening for connections - please restart DC++"
NOTEPAD, // "Notepad"
OFFLINE, // "Offline"
ONLINE, // "Online"
Modified: dcplusplus/trunk/client/version.h
===================================================================
--- dcplusplus/trunk/client/version.h 2006-09-19 13:00:44 UTC (rev 652)
+++ dcplusplus/trunk/client/version.h 2006-09-19 19:20:45 UTC (rev 653)
@@ -17,8 +17,8 @@
*/
#define APPNAME "DC++"
-#define VERSIONSTRING "0.695"
-#define VERSIONFLOAT 0.695
+#define VERSIONSTRING "0.696"
+#define VERSIONFLOAT 0.696
/* Update the .rc file as well... */
Modified: dcplusplus/trunk/windows/SearchFrm.cpp
===================================================================
--- dcplusplus/trunk/windows/SearchFrm.cpp 2006-09-19 13:00:44 UTC (rev 652)
+++ dcplusplus/trunk/windows/SearchFrm.cpp 2006-09-19 19:20:45 UTC (rev 653)
@@ -778,7 +778,9 @@
ucParams["fileFN"] = sr->getFile();
ucParams["fileSI"] = Util::toString(sr->getSize());
ucParams["fileSIshort"] = Util::formatBytes(sr->getSize());
- ucParams["fileTR"] = sr->getTTH().toBase32();
+ if(sr->getType() == SearchResult::TYPE_FILE) {
+ ucParams["fileTR"] = sr->getTTH().toBase32();
+ }
// compatibility with 0.674 and earlier
ucParams["file"] = ucParams["fileFN"];
@@ -854,8 +856,9 @@
if(ctrlResults.GetSelectedCount() == 1) {
int i = ctrlResults.GetNextItem(-1, LVNI_SELECTED);
SearchResult* sr = ctrlResults.getItemData(i)->sr;
-
- WinUtil::searchHash(sr->getTTH());
+ if(sr->getType() == SearchResult::TYPE_FILE) {
+ WinUtil::searchHash(sr->getTTH());
+ }
}
return 0;
@@ -865,7 +868,9 @@
if(ctrlResults.GetSelectedCount() == 1) {
int i = ctrlResults.GetNextItem(-1, LVNI_SELECTED);
SearchResult* sr = ctrlResults.getItemData(i)->sr;
- WinUtil::bitziLink(sr->getTTH());
+ if(sr->getType() == SearchResult::TYPE_FILE) {
+ WinUtil::bitziLink(sr->getTTH());
+ }
}
return 0;
}
@@ -874,7 +879,9 @@
if(ctrlResults.GetSelectedCount() == 1) {
int i = ctrlResults.GetNextItem(-1, LVNI_SELECTED);
SearchResult* sr = ctrlResults.getItemData(i)->sr;
- WinUtil::copyMagnet(sr->getTTH(), Text::toT(sr->getFileName()));
+ if(sr->getType() == SearchResult::TYPE_FILE) {
+ WinUtil::copyMagnet(sr->getTTH(), Text::toT(sr->getFileName()));
+ }
}
return 0;
}
@@ -1140,7 +1147,9 @@
if(!tmpCountry.empty())
columns[COLUMN_IP] = tmpCountry + _T(" (") + columns[COLUMN_IP] + _T(")");
}
- columns[COLUMN_TTH] = Text::toT(sr->getTTH().toBase32());
+ if(sr->getType() == SearchResult::TYPE_FILE) {
+ columns[COLUMN_TTH] = Text::toT(sr->getTTH().toBase32());
+ }
columns[COLUMN_CID] = Text::toT(sr->getUser()->getCID().toBase32());
}
Modified: dcplusplus/trunk/windows/main.cpp
===================================================================
--- dcplusplus/trunk/windows/main.cpp 2006-09-19 13:00:44 UTC (rev 652)
+++ dcplusplus/trunk/windows/main.cpp 2006-09-19 19:20:45 UTC (rev 653)
@@ -212,8 +212,6 @@
CMessageLoop theLoop;
_Module.AddMessageLoop(&theLoop);
- MainFrame wndMain;
-
CEdit dummy;
CEdit splash;
@@ -249,6 +247,8 @@
SettingsManager::getInstance()->setDefault(SettingsManager::BACKGROUND_COLOR, (int)(GetSysColor(COLOR_WINDOW)));
SettingsManager::getInstance()->setDefault(SettingsManager::TEXT_COLOR, (int)(GetSysColor(COLOR_WINDOWTEXT)));
+ MainFrame wndMain;
+
rc = wndMain.rcDefault;
if( (SETTING(MAIN_WINDOW_POS_X) != CW_USEDEFAULT) &&
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <arn...@us...> - 2006-09-20 09:53:47
|
Revision: 654
http://svn.sourceforge.net/dcplusplus/?rev=654&view=rev
Author: arnetheduck
Date: 2006-09-20 02:53:26 -0700 (Wed, 20 Sep 2006)
Log Message:
-----------
Some minor fixes here and there
Modified Paths:
--------------
dcplusplus/trunk/client/AdcHub.cpp
dcplusplus/trunk/client/AdcHub.h
dcplusplus/trunk/client/ClientManager.cpp
dcplusplus/trunk/client/ClientManager.h
dcplusplus/trunk/client/FinishedManager.cpp
dcplusplus/trunk/client/NmdcHub.cpp
dcplusplus/trunk/client/NmdcHub.h
dcplusplus/trunk/client/QueueManager.cpp
dcplusplus/trunk/client/QueueManager.h
dcplusplus/trunk/client/SearchManager.cpp
dcplusplus/trunk/client/ShareManager.cpp
dcplusplus/trunk/windows/DirectoryListingFrm.cpp
dcplusplus/trunk/windows/SearchFrm.cpp
dcplusplus/trunk/windows/SearchFrm.h
Modified: dcplusplus/trunk/client/AdcHub.cpp
===================================================================
--- dcplusplus/trunk/client/AdcHub.cpp 2006-09-19 19:20:45 UTC (rev 653)
+++ dcplusplus/trunk/client/AdcHub.cpp 2006-09-20 09:53:26 UTC (rev 654)
@@ -49,21 +49,21 @@
}
OnlineUser& AdcHub::getUser(const u_int32_t aSID, const CID& aCID) {
- OnlineUser* u = findUser(aSID);
- if(u) {
- return *u;
+ OnlineUser* ou = findUser(aSID);
+ if(ou) {
+ return *ou;
}
User::Ptr p = ClientManager::getInstance()->getUser(aCID);
{
Lock l(cs);
- u = users.insert(make_pair(aSID, new OnlineUser(p, *this, aSID))).first->second;
+ ou = users.insert(make_pair(aSID, new OnlineUser(p, *this, aSID))).first->second;
}
- if(!aCID.isZero())
- ClientManager::getInstance()->putOnline(*u);
- return *u;
+ if(aSID != AdcCommand::HUB_SID)
+ ClientManager::getInstance()->putOnline(*ou);
+ return *ou;
}
OnlineUser* AdcHub::findUser(const u_int32_t aSID) const {
@@ -73,25 +73,35 @@
}
void AdcHub::putUser(const u_int32_t aSID) {
- Lock l(cs);
- SIDIter i = users.find(aSID);
- if(i == users.end())
- return;
+ OnlineUser* ou = 0;
+ {
+ Lock l(cs);
+ SIDIter i = users.find(aSID);
+ if(i == users.end())
+ return;
+ ou = i->second;
+ users.erase(i);
+ }
+
if(aSID != AdcCommand::HUB_SID)
- ClientManager::getInstance()->putOffline(*i->second);
- fire(ClientListener::UserRemoved(), this, *i->second);
- delete i->second;
- users.erase(i);
+ ClientManager::getInstance()->putOffline(*ou);
+
+ fire(ClientListener::UserRemoved(), this, *ou);
+ delete ou;
}
void AdcHub::clearUsers() {
- Lock l(cs);
- for(SIDIter i = users.begin(); i != users.end(); ++i) {
+ SIDMap tmp;
+ {
+ Lock l(cs);
+ users.swap(tmp);
+ }
+
+ for(SIDIter i = tmp.begin(); i != tmp.end(); ++i) {
if(i->first != AdcCommand::HUB_SID)
ClientManager::getInstance()->putOffline(*i->second);
delete i->second;
}
- users.clear();
}
@@ -312,29 +322,30 @@
FavoriteManager::getInstance()->addUserCommand(once ? UserCommand::TYPE_RAW_ONCE : UserCommand::TYPE_RAW, ctx, UserCommand::FLAG_NOSAVE, name, txt, getHubUrl());
}
-void AdcHub::sendUDP(const AdcCommand& cmd) {
- try {
- Socket s;
- s.create(Socket::TYPE_UDP);
-
+void AdcHub::sendUDP(const AdcCommand& cmd) throw() {
+ string command;
+ string ip;
+ short port;
+ {
Lock l(cs);
SIDMap::const_iterator i = users.find(cmd.getTo());
if(i == users.end()) {
dcdebug("AdcHub::sendUDP: invalid user\n");
return;
}
- OnlineUser& u = *i->second;
- string tmp = cmd.toString(u.getUser()->getCID());
- if(u.getIdentity().isUdpActive()) {
- try {
- s.writeTo(u.getIdentity().getIp(), (short)Util::toInt(u.getIdentity().getUdpPort()), tmp);
- } catch(const SocketException& e) {
- dcdebug("AdcHub::sendUDP: write failed: %s\n", e.getError().c_str());
- }
+ OnlineUser& ou = *i->second;
+ if(!ou.getIdentity().isUdpActive()) {
+ return;
}
- } catch(SocketException&) {
- dcdebug("Can't create UDP socket\n");
+ ip = ou.getIdentity().getIp();
+ port = static_cast<short>(Util::toInt(ou.getIdentity().getUdpPort()));
+ command = cmd.toString(ou.getUser()->getCID());
}
+ try {
+ udp.writeTo(ip, port, command);
+ } catch(const SocketException& e) {
+ dcdebug("AdcHub::sendUDP: write failed: %s\n", e.getError().c_str());
+ }
}
void AdcHub::handle(AdcCommand::STA, AdcCommand& c) throw() {
Modified: dcplusplus/trunk/client/AdcHub.h
===================================================================
--- dcplusplus/trunk/client/AdcHub.h 2006-09-19 19:20:45 UTC (rev 653)
+++ dcplusplus/trunk/client/AdcHub.h 2006-09-20 09:53:26 UTC (rev 654)
@@ -73,6 +73,7 @@
typedef HASH_MAP<u_int32_t, OnlineUser*> SIDMap;
typedef SIDMap::iterator SIDIter;
+ Socket udp;
SIDMap users;
StringMap lastInfoMap;
mutable CriticalSection cs;
@@ -113,7 +114,7 @@
//Speaker<AdcHubListener>::fire(t, this, c);
}
- void sendUDP(const AdcCommand& cmd);
+ void sendUDP(const AdcCommand& cmd) throw();
virtual void on(Connecting) throw() { fire(ClientListener::Connecting(), this); }
virtual void on(Connected) throw();
Modified: dcplusplus/trunk/client/ClientManager.cpp
===================================================================
--- dcplusplus/trunk/client/ClientManager.cpp 2006-09-19 19:20:45 UTC (rev 653)
+++ dcplusplus/trunk/client/ClientManager.cpp 2006-09-20 09:53:26 UTC (rev 654)
@@ -51,6 +51,7 @@
}
c->addListener(this);
+
return c;
}
@@ -309,7 +310,7 @@
u.getClient().send(cmd);
} else {
try {
- s.writeTo(u.getIdentity().getIp(), static_cast<short>(Util::toInt(u.getIdentity().getUdpPort())), cmd.toString(getMe()->getCID()));
+ udp.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");
}
@@ -376,7 +377,7 @@
port = 412;
for(SearchResult::Iter i = l.begin(); i != l.end(); ++i) {
SearchResult* sr = *i;
- s.writeTo(ip, port, sr->toSR(*aClient));
+ udp.writeTo(ip, port, sr->toSR(*aClient));
sr->decRef();
}
} catch(const SocketException& /* e */) {
Modified: dcplusplus/trunk/client/ClientManager.h
===================================================================
--- dcplusplus/trunk/client/ClientManager.h 2006-09-19 19:20:45 UTC (rev 653)
+++ dcplusplus/trunk/client/ClientManager.h 2006-09-20 09:53:26 UTC (rev 654)
@@ -115,7 +115,7 @@
User::Ptr me;
- Socket s;
+ Socket udp;
string cachedIp;
CID pid;
Modified: dcplusplus/trunk/client/FinishedManager.cpp
===================================================================
--- dcplusplus/trunk/client/FinishedManager.cpp 2006-09-19 19:20:45 UTC (rev 653)
+++ dcplusplus/trunk/client/FinishedManager.cpp 2006-09-20 09:53:26 UTC (rev 654)
@@ -23,12 +23,12 @@
#include "ClientManager.h"
FinishedManager::~FinishedManager() throw() {
+ DownloadManager::getInstance()->removeListener(this);
+ UploadManager::getInstance()->removeListener(this);
+
Lock l(cs);
for_each(downloads.begin(), downloads.end(), DeleteFunction());
for_each(uploads.begin(), uploads.end(), DeleteFunction());
- DownloadManager::getInstance()->removeListener(this);
- UploadManager::getInstance()->removeListener(this);
-
}
void FinishedManager::remove(FinishedItem *item, bool upload /* = false */) {
Modified: dcplusplus/trunk/client/NmdcHub.cpp
===================================================================
--- dcplusplus/trunk/client/NmdcHub.cpp 2006-09-19 19:20:45 UTC (rev 653)
+++ dcplusplus/trunk/client/NmdcHub.cpp 2006-09-20 09:53:26 UTC (rev 654)
@@ -118,17 +118,17 @@
}
void NmdcHub::putUser(const string& aNick) {
- OnlineUser* u = NULL;
+ OnlineUser* ou = NULL;
{
Lock l(cs);
NickIter i = users.find(aNick);
if(i == users.end())
return;
- u = i->second;
+ ou = i->second;
users.erase(i);
}
- ClientManager::getInstance()->putOffline(*u);
- delete u;
+ ClientManager::getInstance()->putOffline(*ou);
+ delete ou;
}
void NmdcHub::clearUsers() {
@@ -136,8 +136,7 @@
{
Lock l(cs);
- u2 = users;
- users.clear();
+ u2.swap(users);
}
for(NickIter i = u2.begin(); i != u2.end(); ++i) {
@@ -261,33 +260,31 @@
i = j + 1;
- {
- Lock l(cs);
- u_int32_t tick = GET_TICK();
+ u_int32_t tick = GET_TICK();
+ clearFlooders(tick);
- seekers.push_back(make_pair(seeker, tick));
+ seekers.push_back(make_pair(seeker, tick));
- // First, check if it's a flooder
- for(FloodIter fi = flooders.begin(); fi != flooders.end(); ++fi) {
- if(fi->first == seeker) {
- return;
- }
+ // First, check if it's a flooder
+ for(FloodIter fi = flooders.begin(); fi != flooders.end(); ++fi) {
+ if(fi->first == seeker) {
+ return;
}
+ }
- int count = 0;
- for(FloodIter fi = seekers.begin(); fi != seekers.end(); ++fi) {
- if(fi->first == seeker)
- count++;
+ int count = 0;
+ for(FloodIter fi = seekers.begin(); fi != seekers.end(); ++fi) {
+ if(fi->first == seeker)
+ count++;
- if(count > 7) {
- if(seeker.compare(0, 4, "Hub:") == 0)
- fire(ClientListener::SearchFlood(), this, seeker.substr(4));
- else
- fire(ClientListener::SearchFlood(), this, seeker + STRING(NICK_UNKNOWN));
+ if(count > 7) {
+ if(seeker.compare(0, 4, "Hub:") == 0)
+ fire(ClientListener::SearchFlood(), this, seeker.substr(4));
+ else
+ fire(ClientListener::SearchFlood(), this, seeker + STRING(NICK_UNKNOWN));
- flooders.push_back(make_pair(seeker, tick));
- return;
- }
+ flooders.push_back(make_pair(seeker, tick));
+ return;
}
}
@@ -880,6 +877,16 @@
}
}
+void NmdcHub::clearFlooders(u_int32_t aTick) {
+ while(!seekers.empty() && seekers.front().second + (5 * 1000) < aTick) {
+ seekers.pop_front();
+ }
+
+ while(!flooders.empty() && flooders.front().second + (120 * 1000) < aTick) {
+ flooders.pop_front();
+ }
+}
+
// TimerManagerListener
void NmdcHub::on(Second, u_int32_t aTick) throw() {
if(state == STATE_CONNECTED && (getLastActivity() + getReconnDelay() * 1000) < aTick) {
@@ -891,18 +898,6 @@
connect();
}
- {
- Lock l(cs);
-
- while(!seekers.empty() && seekers.front().second + (5 * 1000) < aTick) {
- seekers.pop_front();
- }
-
- while(!flooders.empty() && flooders.front().second + (120 * 1000) < aTick) {
- flooders.pop_front();
- }
- }
-
Client::on(Second(), aTick);
}
Modified: dcplusplus/trunk/client/NmdcHub.h
===================================================================
--- dcplusplus/trunk/client/NmdcHub.h 2006-09-19 19:20:45 UTC (rev 653)
+++ dcplusplus/trunk/client/NmdcHub.h 2006-09-20 09:53:26 UTC (rev 654)
@@ -114,6 +114,7 @@
void revConnectToMe(const OnlineUser& aUser);
void myInfo(bool alwaysSend);
void supports(const StringList& feat);
+ void clearFlooders(u_int32_t tick);
void updateFromTag(Identity& id, const string& tag);
Modified: dcplusplus/trunk/client/QueueManager.cpp
===================================================================
--- dcplusplus/trunk/client/QueueManager.cpp 2006-09-19 19:20:45 UTC (rev 653)
+++ dcplusplus/trunk/client/QueueManager.cpp 2006-09-20 09:53:26 UTC (rev 654)
@@ -721,18 +721,9 @@
}
}
-void QueueManager::getTargetsBySize(StringList& sl, int64_t aSize, const string& suffix) throw() {
+void QueueManager::getTargets(const TTHValue& tth, StringList& sl) {
Lock l(cs);
QueueItem::List ql;
- fileQueue.find(ql, aSize, suffix);
- for(QueueItem::Iter i = ql.begin(); i != ql.end(); ++i) {
- sl.push_back((*i)->getTarget());
- }
-}
-
-void QueueManager::getTargetsByRoot(StringList& sl, const TTHValue& tth) {
- Lock l(cs);
- QueueItem::List ql;
fileQueue.find(ql, tth);
for(QueueItem::Iter i = ql.begin(); i != ql.end(); ++i) {
sl.push_back((*i)->getTarget());
@@ -753,8 +744,8 @@
QueueItem* q = userQueue.getNext(aUser);
- if(q == NULL)
- return NULL;
+ if(!q)
+ return 0;
userQueue.setRunning(q, aUser);
Modified: dcplusplus/trunk/client/QueueManager.h
===================================================================
--- dcplusplus/trunk/client/QueueManager.h 2006-09-19 19:20:45 UTC (rev 653)
+++ dcplusplus/trunk/client/QueueManager.h 2006-09-20 09:53:26 UTC (rev 654)
@@ -99,8 +99,7 @@
void setPriority(const string& aTarget, QueueItem::Priority p) throw();
- void getTargetsBySize(StringList& sl, int64_t aSize, const string& suffix) throw();
- void getTargetsByRoot(StringList& sl, const TTHValue& tth);
+ void getTargets(const TTHValue& tth, StringList& sl);
QueueItem::StringMap& lockQueue() throw() { cs.enter(); return fileQueue.getQueue(); } ;
void unlockQueue() throw() { cs.leave(); }
Modified: dcplusplus/trunk/client/SearchManager.cpp
===================================================================
--- dcplusplus/trunk/client/SearchManager.cpp 2006-09-19 19:20:45 UTC (rev 653)
+++ dcplusplus/trunk/client/SearchManager.cpp 2006-09-20 09:53:26 UTC (rev 654)
@@ -220,6 +220,7 @@
if( (j = x.rfind(')')) == string::npos) {
return;
}
+
string hubIpPort = x.substr(i, j-i);
string url = ClientManager::getInstance()->findHub(hubIpPort);
@@ -237,9 +238,12 @@
StringList names = ClientManager::getInstance()->getHubNames(user->getCID());
hubName = names.empty() ? STRING(OFFLINE) : Util::toString(names);
}
- if(tth.empty())
+
+ if(tth.empty() && type == SearchResult::TYPE_FILE) {
return;
+ }
+
SearchResult* sr = new SearchResult(user, type, slots, freeSlots, size,
file, hubName, url, remoteIp, TTHValue(tth), Util::emptyString);
fire(SearchManagerListener::SR(), sr);
Modified: dcplusplus/trunk/client/ShareManager.cpp
===================================================================
--- dcplusplus/trunk/client/ShareManager.cpp 2006-09-19 19:20:45 UTC (rev 653)
+++ dcplusplus/trunk/client/ShareManager.cpp 2006-09-20 09:53:26 UTC (rev 654)
@@ -116,7 +116,6 @@
}
string ShareManager::translateFileName(const string& aFile) throw(ShareException) {
- RLock<> l(cs);
if(aFile == "MyList.DcLst") {
throw ShareException("NMDC-style lists no longer supported, please upgrade your client");
} else if(aFile == DownloadManager::USER_LIST_NAME || aFile == DownloadManager::USER_LIST_NAME_BZ) {
@@ -128,6 +127,8 @@
string file;
+ RLock<> l(cs);
+
// Check for tth root identifier
if(aFile.compare(0, 4, "TTH/") == 0) {
file = translateTTH(aFile.substr(4));
@@ -141,7 +142,6 @@
if(i == string::npos)
throw ShareException(UserConnection::FILE_NOT_AVAILABLE);
- RLock<> l(cs);
StringPairIter j = lookupVirtual(file.substr(1, i-1));
if(j == virtualMap.end()) {
throw ShareException(UserConnection::FILE_NOT_AVAILABLE);
@@ -1243,7 +1243,7 @@
i->second->getParent()->getFullName() + i->second->getName(), i->second->getTTH());
results.push_back(sr);
- ShareManager::getInstance()->setHits(ShareManager::getInstance()->getHits()+1);
+ ShareManager::getInstance()->addHits(1);
}
}
return;
Modified: dcplusplus/trunk/windows/DirectoryListingFrm.cpp
===================================================================
--- dcplusplus/trunk/windows/DirectoryListingFrm.cpp 2006-09-19 19:20:45 UTC (rev 653)
+++ dcplusplus/trunk/windows/DirectoryListingFrm.cpp 2006-09-20 09:53:26 UTC (rev 654)
@@ -632,7 +632,7 @@
n = 0;
targetMenu.AppendMenu(MF_STRING, IDC_DOWNLOADTO, CTSTRING(BROWSE));
targets.clear();
- QueueManager::getInstance()->getTargetsByRoot(targets, ii->file->getTTH());
+ QueueManager::getInstance()->getTargets(ii->file->getTTH(), targets);
if(targets.size() > 0) {
targetMenu.AppendMenu(MF_SEPARATOR);
Modified: dcplusplus/trunk/windows/SearchFrm.cpp
===================================================================
--- dcplusplus/trunk/windows/SearchFrm.cpp 2006-09-19 19:20:45 UTC (rev 653)
+++ dcplusplus/trunk/windows/SearchFrm.cpp 2006-09-20 09:53:26 UTC (rev 654)
@@ -347,8 +347,11 @@
}
if(isHash) {
- if(Util::stricmp(Text::toT(aResult->getTTH().toBase32()), search[0]) != 0)
+ if(aResult->getType() != SearchResult::TYPE_FILE || TTHValue(Text::fromT(search[0])) != aResult->getTTH()) {
+ droppedResults++;
+ PostMessage(WM_SPEAKER, FILTER_RESULT);
return;
+ }
} else {
// match all here
for(TStringIter j = search.begin(); j != search.end(); ++j) {
@@ -357,23 +360,21 @@
)
{
droppedResults++;
- PostMessage(WM_SPEAKER, FILTER_RESULT, NULL);
+ PostMessage(WM_SPEAKER, FILTER_RESULT);
return;
}
}
}
}
- // Reject results without free slots or tth if selected
- // but always show directories
+ // Reject results without free slots
if((onlyFree && aResult->getFreeSlots() < 1))
{
droppedResults++;
- ctrlStatus.SetText(3, Text::toT(Util::toString(droppedResults) + ' ' + STRING(FILTERED)).c_str());
+ PostMessage(WM_SPEAKER, FILTER_RESULT);
return;
}
-
SearchInfo* i = new SearchInfo(aResult);
PostMessage(WM_SPEAKER, ADD_RESULT, (LPARAM)i);
}
@@ -400,10 +401,11 @@
ctrlStatus.SetText(3, _T(""));
return 0;
}
+
void SearchFrame::SearchInfo::view() {
try {
if(sr->getType() == SearchResult::TYPE_FILE) {
- QueueManager::getInstance()->add(Util::getTempPath() + Text::fromT(columns[COLUMN_FILENAME]),
+ QueueManager::getInstance()->add(Util::getTempPath() + sr->getFileName(),
sr->getSize(), sr->getTTH(), sr->getUser(),
QueueItem::FLAG_CLIENT_VIEW | QueueItem::FLAG_TEXT);
}
@@ -430,12 +432,13 @@
void SearchFrame::SearchInfo::DownloadWhole::operator()(SearchInfo* si) {
try {
+ QueueItem::Priority prio = WinUtil::isShift() ? QueueItem::HIGHEST : QueueItem::DEFAULT;
if(si->sr->getType() == SearchResult::TYPE_FILE) {
- QueueManager::getInstance()->addDirectory(Text::fromT(si->columns[COLUMN_PATH]), si->sr->getUser(), Text::fromT(tgt),
- WinUtil::isShift() ? QueueItem::HIGHEST : QueueItem::DEFAULT);
+ QueueManager::getInstance()->addDirectory(Text::fromT(si->columns[COLUMN_PATH]),
+ si->sr->getUser(), Text::fromT(tgt), prio);
} else {
- QueueManager::getInstance()->addDirectory(si->sr->getFile(), si->sr->getUser(), Text::fromT(tgt),
- WinUtil::isShift() ? QueueItem::HIGHEST : QueueItem::DEFAULT);
+ QueueManager::getInstance()->addDirectory(si->sr->getFile(), si->sr->getUser(),
+ Text::fromT(tgt), prio);
}
} catch(const Exception&) {
}
@@ -475,7 +478,7 @@
}
}
-void SearchFrame::SearchInfo::CheckSize::operator()(SearchInfo* si) {
+void SearchFrame::SearchInfo::CheckTTH::operator()(SearchInfo* si) {
if(firstTTH) {
tth = si->columns[COLUMN_TTH];
hasTTH = true;
@@ -486,19 +489,6 @@
}
}
- if(si->sr->getType() == SearchResult::TYPE_FILE) {
- if(ext.empty()) {
- ext = Util::getFileExt(si->columns[COLUMN_FILENAME]);
- size = si->sr->getSize();
- } else if(size != -1) {
- if((si->sr->getSize() != size) || (Util::stricmp(ext, Util::getFileExt(si->columns[COLUMN_FILENAME])) != 0)) {
- size = -1;
- }
- }
- } else {
- size = -1;
- }
-
if(firstHubs && hubs.empty()) {
hubs = ClientManager::getInstance()->getHubs(si->sr->getUser()->getCID());
firstHubs = false;
@@ -965,15 +955,11 @@
}
}
- SearchInfo::CheckSize cs = ctrlResults.forEachSelectedT(SearchInfo::CheckSize());
+ SearchInfo::CheckTTH cs = ctrlResults.forEachSelectedT(SearchInfo::CheckTTH());
- if(cs.size != -1 || cs.hasTTH) {
+ if(cs.hasTTH) {
targets.clear();
- if(cs.hasTTH) {
- QueueManager::getInstance()->getTargetsByRoot(targets, TTHValue(Text::fromT(cs.tth)));
- } else {
- QueueManager::getInstance()->getTargetsBySize(targets, cs.size, Text::fromT(cs.ext));
- }
+ QueueManager::getInstance()->getTargets(TTHValue(Text::fromT(cs.tth)), targets);
if(targets.size() > 0) {
targetMenu.AppendMenu(MF_SEPARATOR);
Modified: dcplusplus/trunk/windows/SearchFrm.h
===================================================================
--- dcplusplus/trunk/windows/SearchFrm.h 2006-09-19 19:20:45 UTC (rev 653)
+++ dcplusplus/trunk/windows/SearchFrm.h 2006-09-20 09:53:26 UTC (rev 654)
@@ -258,11 +258,9 @@
void operator()(SearchInfo* si);
const tstring& tgt;
};
- struct CheckSize {
- CheckSize() : size(-1), op(true), firstHubs(true), hasTTH(false), firstTTH(true) { }
+ struct CheckTTH {
+ CheckTTH() : op(true), firstHubs(true), hasTTH(false), firstTTH(true) { }
void operator()(SearchInfo* si);
- tstring ext;
- int64_t size;
bool firstHubs;
StringList hubs;
bool op;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <arn...@us...> - 2006-09-22 21:23:51
|
Revision: 655
http://svn.sourceforge.net/dcplusplus/?rev=655&view=rev
Author: arnetheduck
Date: 2006-09-22 14:23:35 -0700 (Fri, 22 Sep 2006)
Log Message:
-----------
patches
Modified Paths:
--------------
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/client/AdcHub.cpp
dcplusplus/trunk/client/NmdcHub.cpp
dcplusplus/trunk/windows/LogPage.cpp
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2006-09-20 09:53:26 UTC (rev 654)
+++ dcplusplus/trunk/changelog.txt 2006-09-22 21:23:35 UTC (rev 655)
@@ -13,6 +13,9 @@
* Fixed some SSL connection issues
* Fixed on-the-fly compression of file lists
* [bug 1055] Stopped files.xml.bz2 from being deleted on linux (thanks dorian)
+* [bug 1061] Log page fix (thanks fleetcommand)
+* [bug 1033] Altered NMDC hubname/description detection slightly (thanks fleetcommand)
+* [bug 1059] Fixed the possibility for users to become hidden in some cases (thanks fleetcommand)
-- 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/AdcHub.cpp
===================================================================
--- dcplusplus/trunk/client/AdcHub.cpp 2006-09-20 09:53:26 UTC (rev 654)
+++ dcplusplus/trunk/client/AdcHub.cpp 2006-09-22 21:23:35 UTC (rev 655)
@@ -395,13 +395,13 @@
return;
const string& proto = secure ? SECURE_CLIENT_PROTOCOL : CLIENT_PROTOCOL;
- short port = secure ? ConnectionManager::getInstance()->getSecurePort() : ConnectionManager::getInstance()->getPort();
- if(port == 0) {
- // Oops?
- LogManager::getInstance()->message(STRING(NOT_LISTENING));
- return;
- }
if(ClientManager::getInstance()->isActive()) {
+ short port = secure ? ConnectionManager::getInstance()->getSecurePort() : ConnectionManager::getInstance()->getPort();
+ if(port == 0) {
+ // Oops?
+ LogManager::getInstance()->message(STRING(NOT_LISTENING));
+ return;
+ }
send(AdcCommand(AdcCommand::CMD_CTM, user.getIdentity().getSID()).addParam(proto).addParam(Util::toString(port)).addParam(token));
} else {
send(AdcCommand(AdcCommand::CMD_RCM, user.getIdentity().getSID()).addParam(proto));
Modified: dcplusplus/trunk/client/NmdcHub.cpp
===================================================================
--- dcplusplus/trunk/client/NmdcHub.cpp 2006-09-20 09:53:26 UTC (rev 654)
+++ dcplusplus/trunk/client/NmdcHub.cpp 2006-09-22 21:23:35 UTC (rev 655)
@@ -340,6 +340,12 @@
OnlineUser& u = getUser(nick);
+ // If he is already considered to be the hub (thus hidden), probably should appear in the UserList
+ if(u.getIdentity().isHidden()) {
+ u.getIdentity().setHidden(false);
+ u.getIdentity().setHub(false);
+ }
+
j = param.find('$', i);
if(j == string::npos)
return;
@@ -453,14 +459,22 @@
} else if(cmd == "$SR") {
SearchManager::getInstance()->onSearchResult(aLine);
} else if(cmd == "$HubName") {
- // Hack - first word goes to hub name, rest to description
- string::size_type i = param.find(' ');
+ // If " - " found, the first part goes to hub name, rest to description
+ // If no " - " found, first word goes to hub name, rest to description
+
+ string::size_type i = param.find(" - ");
if(i == string::npos) {
- getHubIdentity().setNick(unescape(param));
- getHubIdentity().setDescription(Util::emptyString);
+ i = param.find(' ');
+ if(i == string::npos) {
+ getHubIdentity().setNick(unescape(param));
+ getHubIdentity().setDescription(Util::emptyString);
+ } else {
+ getHubIdentity().setNick(unescape(param.substr(0, i)));
+ getHubIdentity().setDescription(unescape(param.substr(i+1)));
+ }
} else {
getHubIdentity().setNick(unescape(param.substr(0, i)));
- getHubIdentity().setDescription(unescape(param.substr(i+1)));
+ getHubIdentity().setDescription(unescape(param.substr(i+3)));
}
fire(ClientListener::HubUpdated(), this);
} else if(cmd == "$Supports") {
Modified: dcplusplus/trunk/windows/LogPage.cpp
===================================================================
--- dcplusplus/trunk/windows/LogPage.cpp 2006-09-20 09:53:26 UTC (rev 654)
+++ dcplusplus/trunk/windows/LogPage.cpp 2006-09-22 21:23:35 UTC (rev 655)
@@ -65,6 +65,9 @@
options.push_back(pair);
}
+ ::EnableWindow(GetDlgItem(IDC_LOG_FORMAT), false);
+ ::EnableWindow(GetDlgItem(IDC_LOG_FILE), false);
+
oldSelection = -1;
// Do specialized reading here
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <arn...@us...> - 2006-10-04 01:47:39
|
Revision: 660
http://svn.sourceforge.net/dcplusplus/?rev=660&view=rev
Author: arnetheduck
Date: 2006-09-29 08:41:55 -0700 (Fri, 29 Sep 2006)
Log Message:
-----------
New version
Modified Paths:
--------------
dcplusplus/trunk/DCPlusPlus.rc
dcplusplus/trunk/Example.xml
dcplusplus/trunk/client/version.h
Modified: dcplusplus/trunk/DCPlusPlus.rc
===================================================================
--- dcplusplus/trunk/DCPlusPlus.rc 2006-09-29 13:34:42 UTC (rev 659)
+++ dcplusplus/trunk/DCPlusPlus.rc 2006-09-29 15:41:55 UTC (rev 660)
@@ -942,8 +942,8 @@
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,6,9,6
- PRODUCTVERSION 0,6,9,6
+ FILEVERSION 0,6,9,7
+ PRODUCTVERSION 0,6,9,7
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -960,12 +960,12 @@
BEGIN
VALUE "Comments", "http://dcplusplus.sourceforge.net"
VALUE "FileDescription", "DC++"
- VALUE "FileVersion", "0, 6, 9, 6"
+ VALUE "FileVersion", "0, 6, 9, 7"
VALUE "InternalName", "DC++"
VALUE "LegalCopyright", "Copyright 2001-2006 Jacek Sieka"
VALUE "OriginalFilename", "DCPlusPlus.exe"
VALUE "ProductName", "DC++"
- VALUE "ProductVersion", "0, 6, 9, 6"
+ VALUE "ProductVersion", "0, 6, 9, 7"
END
END
BLOCK "VarFileInfo"
Modified: dcplusplus/trunk/Example.xml
===================================================================
--- dcplusplus/trunk/Example.xml 2006-09-29 13:34:42 UTC (rev 659)
+++ dcplusplus/trunk/Example.xml 2006-09-29 15:41:55 UTC (rev 660)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<Language Name="Example Language" Native="English" Code="en" Author="arnetheduck" Version="0.696" Revision="1" RightToLeft="0">
+<Language Name="Example Language" Native="English" Code="en" Author="arnetheduck" Version="0.697" Revision="1" RightToLeft="0">
<Strings>
<String Name="Active">Active</String>
<String Name="ActiveSearchString">Enabled / Search String</String>
Modified: dcplusplus/trunk/client/version.h
===================================================================
--- dcplusplus/trunk/client/version.h 2006-09-29 13:34:42 UTC (rev 659)
+++ dcplusplus/trunk/client/version.h 2006-09-29 15:41:55 UTC (rev 660)
@@ -17,7 +17,7 @@
*/
#define APPNAME "DC++"
-#define VERSIONSTRING "0.696"
-#define VERSIONFLOAT 0.696
+#define VERSIONSTRING "0.697"
+#define VERSIONFLOAT 0.697
/* Update the .rc file as well... */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <arn...@us...> - 2006-10-04 01:47:41
|
Revision: 662
http://svn.sourceforge.net/dcplusplus/?rev=662&view=rev
Author: arnetheduck
Date: 2006-09-29 09:24:13 -0700 (Fri, 29 Sep 2006)
Log Message:
-----------
file patch
Modified Paths:
--------------
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/client/File.cpp
dcplusplus/trunk/client/File.h
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2006-09-29 16:05:42 UTC (rev 661)
+++ dcplusplus/trunk/changelog.txt 2006-09-29 16:24:13 UTC (rev 662)
@@ -1,4 +1,8 @@
-- --
+* [bug 1065] Code cleanup (thanks steven sheehy)
+
+
+-- 0.697 2006-09-29 --
* [ADC] Fixed a few protocol issues
* Some code cleanup
* Queue frame fixes and memory saves
Modified: dcplusplus/trunk/client/File.cpp
===================================================================
--- dcplusplus/trunk/client/File.cpp 2006-09-29 16:05:42 UTC (rev 661)
+++ dcplusplus/trunk/client/File.cpp 2006-09-29 16:24:13 UTC (rev 662)
@@ -66,6 +66,10 @@
return 0;
}
+bool File::isOpen() throw() {
+ return h != INVALID_HANDLE_VALUE;
+}
+
void File::close() throw() {
if(isOpen()) {
CloseHandle(h);
@@ -133,7 +137,7 @@
}
}
-size_t File::flush() throw(Exception) {
+size_t File::flush() throw(FileException) {
if(isOpen() && !FlushFileBuffers(h))
throw FileException(Util::translateError(GetLastError()));
return 0;
@@ -153,6 +157,11 @@
}
}
+void File::deleteFile(const string& aFileName) throw()
+{
+ ::DeleteFile(Text::toT(aFileName).c_str());
+}
+
int64_t File::getSize(const string& aFileName) throw() {
WIN32_FIND_DATA fd;
HANDLE hFind;
@@ -185,7 +194,7 @@
return path.size() > 2 && (path[1] == ':' || path[0] == '/' || path[0] == '\\');
}
-#else // _WIN32
+#else // !_WIN32
File::File(const string& aFileName, int access, int mode) throw(FileException) {
dcassert(access == WRITE || access == READ || access == (READ | WRITE));
@@ -218,6 +227,10 @@
return (u_int32_t)s.st_mtime;
}
+bool File::isOpen() throw() {
+ return h != -1;
+}
+
void File::close() throw() {
if(h != -1) {
::close(h);
@@ -302,7 +315,7 @@
}
size_t File::flush() throw(FileException) {
- if(h != -1 && fsync(h) == -1)
+ if(isOpen() && fsync(h) == -1)
throw FileException(Util::translateError(errno));
return 0;
}
@@ -342,6 +355,10 @@
}
}
+void File::deleteFile(const string& aFileName) throw() {
+ ::unlink(aFileName.c_str());
+}
+
int64_t File::getSize(const string& aFileName) throw() {
struct stat s;
if(stat(aFileName.c_str(), &s) == -1)
@@ -363,7 +380,7 @@
return path.size() > 1 && path[0] = '/';
}
-#endif // _WIN32
+#endif // !_WIN32
string File::read(size_t len) throw(FileException) {
string s(len, 0);
Modified: dcplusplus/trunk/client/File.h
===================================================================
--- dcplusplus/trunk/client/File.h 2006-09-29 16:05:42 UTC (rev 661)
+++ dcplusplus/trunk/client/File.h 2006-09-29 16:24:13 UTC (rev 662)
@@ -48,8 +48,33 @@
CREATE = 0x02,
TRUNCATE = 0x04
};
+
+#ifdef _WIN32
+ enum {
+ READ = GENERIC_READ,
+ WRITE = GENERIC_WRITE,
+ RW = READ | WRITE
+ };
+
+ static u_int32_t convertTime(FILETIME* f);
+
+#else // !_WIN32
+
+ enum {
+ READ = 0x01,
+ WRITE = 0x02,
+ RW = READ | WRITE
+ };
+
+ // some ftruncate implementations can't extend files like SetEndOfFile,
+ // not sure if the client code needs this...
+ int extendFile(int64_t len) throw();
+
+#endif // !_WIN32
+
File(const string& aFileName, int access, int mode) throw(FileException);
+ bool isOpen() throw();
virtual void close() throw();
virtual int64_t getSize() throw();
virtual void setSize(int64_t newSize) throw(FileException);
@@ -68,41 +93,13 @@
static void copyFile(const string& src, const string& target) throw(FileException);
static void renameFile(const string& source, const string& target) throw(FileException);
+ static void deleteFile(const string& aFileName) throw();
static int64_t getSize(const string& aFileName) throw();
- static void ensureDirectory(const string& aFile);
- static bool isAbsolute(const string& path);
+ static void ensureDirectory(const string& aFile) throw();
+ static bool isAbsolute(const string& path) throw();
-#ifdef _WIN32
- enum {
- READ = GENERIC_READ,
- WRITE = GENERIC_WRITE,
- RW = READ | WRITE
- };
-
- static u_int32_t convertTime(FILETIME* f);
- bool isOpen() { return h != INVALID_HANDLE_VALUE; }
-
- static void deleteFile(const string& aFileName) throw() { ::DeleteFile(Text::toT(aFileName).c_str()); }
-
-#else // _WIN32
-
- enum {
- READ = 0x01,
- WRITE = 0x02,
- RW = READ | WRITE
- };
-
- bool isOpen() { return h != -1; }
- static void deleteFile(const string& aFileName) throw() { ::unlink(aFileName.c_str()); }
-
- // some ftruncate implementations can't extend files like SetEndOfFile,
- // not sure if the client code needs this...
- int extendFile(int64_t len);
-
-#endif // _WIN32
-
virtual ~File() throw() { File::close(); }
string read(size_t len) throw(FileException);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <arn...@us...> - 2006-10-06 21:19:07
|
Revision: 663
http://svn.sourceforge.net/dcplusplus/?rev=663&view=rev
Author: arnetheduck
Date: 2006-10-06 14:18:32 -0700 (Fri, 06 Oct 2006)
Log Message:
-----------
Janitory
Modified Paths:
--------------
dcplusplus/trunk/Compile.txt
dcplusplus/trunk/Example.xml
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/client/DownloadManager.cpp
dcplusplus/trunk/client/DownloadManager.h
dcplusplus/trunk/client/FinishedManager.cpp
dcplusplus/trunk/client/QueueManager.cpp
dcplusplus/trunk/client/QueueManager.h
dcplusplus/trunk/client/SettingsManager.cpp
dcplusplus/trunk/client/ShareManager.cpp
dcplusplus/trunk/client/ShareManager.h
dcplusplus/trunk/client/StringDefs.cpp
dcplusplus/trunk/client/StringDefs.h
dcplusplus/trunk/client/UploadManager.cpp
dcplusplus/trunk/client/UploadManager.h
dcplusplus/trunk/client/UserConnection.cpp
dcplusplus/trunk/client/UserConnection.h
dcplusplus/trunk/help/changelog.html
dcplusplus/trunk/windows/TransferView.cpp
Modified: dcplusplus/trunk/Compile.txt
===================================================================
--- dcplusplus/trunk/Compile.txt 2006-09-29 16:24:13 UTC (rev 662)
+++ dcplusplus/trunk/Compile.txt 2006-10-06 21:18:32 UTC (rev 663)
@@ -43,7 +43,7 @@
Linux / Unix:
I've made some rudimentary autoconf/automake scripts now, so you can compile the client part into a library
without too much hassle (I don't check if it compiles very often though...). You'll need the latest versions
-of automake and autoconf, and after getting the source (from CVS is easiest), do
+of automake and autoconf, and after getting the source (from SVN is easiest), do
"aclocal && automake && autoconf && configure && make" and you'll have the client part nicely compiled.
When / if I test it I do it on a Gentoo AMD64 box with the latest gcc in 64-bit mode, so I don't have a clue
if the 32-bit compile works...
@@ -56,7 +56,7 @@
ugly code, abusable features, feature that I don't like that bloat the application and incompatibility with other
modifications I've already done.
To increase the chances of your patch being accepted, post them in the DC++ bugzilla as diffs against the latest
-code you can find (in the cvs repository on sourceforge most probably). You can find a lot of
+code you can find (in the SVN repository on sourceforge most probably). You can find a lot of
information about diff and patch by googling for it. I like unified format (diff -u). When diffing, apply diff to
the folders of the two versions, so that the paths will be included in the diff.
By submitting a patch, you agree to that I get copyright of it. This to avoid stupid situations later on where
Modified: dcplusplus/trunk/Example.xml
===================================================================
--- dcplusplus/trunk/Example.xml 2006-09-29 16:24:13 UTC (rev 662)
+++ dcplusplus/trunk/Example.xml 2006-10-06 21:18:32 UTC (rev 663)
@@ -581,6 +581,7 @@
<String Name="UnableToCreateThread">Unable to create thread</String>
<String Name="UnableToOpenFilelist">Unable to open filelist: </String>
<String Name="UnableToRename">Unable to rename </String>
+ <String Name="UnableToSendFile">Unable to send file </String>
<String Name="Unknown">Unknown</String>
<String Name="UnknownAddress">Unknown address</String>
<String Name="UnknownCommand">Unknown command: </String>
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2006-09-29 16:24:13 UTC (rev 662)
+++ dcplusplus/trunk/changelog.txt 2006-10-06 21:18:32 UTC (rev 663)
@@ -1,7 +1,10 @@
-- --
* [bug 1065] Code cleanup (thanks steven sheehy)
+* Fixed readme.txt (thanks ullner)
+* More code cleanup
+* Fixed trusted/untrusted upload view
+* Fixed crash on invalid remote command during upload
-
-- 0.697 2006-09-29 --
* [ADC] Fixed a few protocol issues
* Some code cleanup
Modified: dcplusplus/trunk/client/DownloadManager.cpp
===================================================================
--- dcplusplus/trunk/client/DownloadManager.cpp 2006-09-29 16:24:13 UTC (rev 662)
+++ dcplusplus/trunk/client/DownloadManager.cpp 2006-10-06 21:18:32 UTC (rev 663)
@@ -45,23 +45,27 @@
static const string DOWNLOAD_AREA = "Downloads";
const string Download::ANTI_FRAG_EXT = ".antifrag";
-const string DownloadManager::USER_LIST_NAME = "files.xml";
-const string DownloadManager::USER_LIST_NAME_BZ = "files.xml.bz2";
-
-Download::Download() throw() : file(NULL),
+Download::Download(UserConnection& conn) throw() : Transfer(conn), file(0),
crcCalc(NULL), treeValid(false) {
+ conn.setDownload(this);
}
-Download::Download(QueueItem* qi) throw() :
- target(qi->getTarget()), tempTarget(qi->getTempTarget()), file(NULL),
- crcCalc(NULL), tth(qi->getTTH()), treeValid(false) {
-
- setSize(qi->getSize());
- if(qi->isSet(QueueItem::FLAG_USER_LIST))
+Download::Download(UserConnection& conn, QueueItem& qi) throw() : Transfer(conn),
+ target(qi.getTarget()), tempTarget(qi.getTempTarget()), file(0),
+ crcCalc(NULL), treeValid(false)
+{
+ conn.setDownload(this);
+
+ setTTH(qi.getTTH());
+ setSize(qi.getSize());
+ if(qi.isSet(QueueItem::FLAG_USER_LIST))
setFlag(Download::FLAG_USER_LIST);
- if(qi->isSet(QueueItem::FLAG_RESUME))
+ if(qi.isSet(QueueItem::FLAG_RESUME))
setFlag(Download::FLAG_RESUME);
}
+Download::~Download() {
+ getUserConnection().setDownload(0);
+}
AdcCommand Download::getCommand(bool zlib) {
AdcCommand cmd(AdcCommand::CMD_GET);
@@ -126,7 +130,7 @@
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_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;
@@ -139,9 +143,9 @@
(filesizeOk && BOOLSETTING(AUTODROP_ALL));
if(speedTooLow && onlineSourcesOk && dropIt) {
if(BOOLSETTING(AUTODROP_DISCONNECT) && !((*i)->isSet(Download::FLAG_USER_LIST))) {
- (*i)->getUserConnection()->disconnect();
+ (*i)->getUserConnection().disconnect();
} else {
- dropTargets.push_back(make_pair((*i)->getTarget(), (*i)->getUserConnection()->getUser()));
+ dropTargets.push_back(make_pair((*i)->getTarget(), (*i)->getUser()));
}
}
}
@@ -271,7 +275,7 @@
}
}
- Download* d = QueueManager::getInstance()->getDownload(aConn->getUser(), aConn->isSet(UserConnection::FLAG_SUPPORTS_TTHL));
+ Download* d = QueueManager::getInstance()->getDownload(*aConn, aConn->isSet(UserConnection::FLAG_SUPPORTS_TTHL));
if(!d) {
Lock l(cs);
@@ -279,9 +283,6 @@
return;
}
- d->setUserConnection(aConn);
- aConn->setDownload(d);
-
aConn->setState(UserConnection::STATE_FILELENGTH);
if(d->isSet(Download::FLAG_RESUME)) {
@@ -323,9 +324,9 @@
if(d->isSet(Download::FLAG_USER_LIST)) {
if(aConn->isSet(UserConnection::FLAG_SUPPORTS_XML_BZLIST)) {
- d->setSource(USER_LIST_NAME_BZ);
+ d->setSource(Transfer::USER_LIST_NAME_BZ);
} else {
- d->setSource(USER_LIST_NAME);
+ d->setSource(Transfer::USER_LIST_NAME);
}
}
@@ -482,7 +483,6 @@
}
if(d->getPos() >= d->getSize()) {
// Already finished?
- aSource->setDownload(NULL);
removeDownload(d);
QueueManager::getInstance()->putDownload(d, true);
removeConnection(aSource);
@@ -561,7 +561,7 @@
dcassert(d->getPos() != -1);
d->setStart(GET_TICK());
- aSource->setState(UserConnection::STATE_DONE);
+ aSource->setState(UserConnection::STATE_RUNNING);
fire(DownloadManagerListener::Starting(), d);
@@ -598,7 +598,7 @@
/** Download finished! */
void DownloadManager::handleEndData(UserConnection* aSource) {
- dcassert(aSource->getState() == UserConnection::STATE_DONE);
+ dcassert(aSource->getState() == UserConnection::STATE_RUNNING);
Download* d = aSource->getDownload();
dcassert(d != NULL);
@@ -620,7 +620,6 @@
QueueManager::getInstance()->removeSource(d->getTarget(), aSource->getUser(), QueueItem::Source::FLAG_BAD_TREE, false);
- aSource->setDownload(NULL);
QueueManager::getInstance()->putDownload(d, false);
checkDownloads(aSource);
@@ -680,7 +679,6 @@
removeDownload(d);
fire(DownloadManagerListener::Complete(), d);
- aSource->setDownload(NULL);
QueueManager::getInstance()->putDownload(d, true);
checkDownloads(aSource);
}
@@ -720,7 +718,6 @@
fire(DownloadManagerListener::Failed(), d, STRING(SFV_INCONSISTENCY));
QueueManager::getInstance()->removeSource(d->getTarget(), aSource->getUser(), QueueItem::Source::FLAG_CRC_WARN, false);
- aSource->setDownload(NULL);
QueueManager::getInstance()->putDownload(d, false);
checkDownloads(aSource);
@@ -734,29 +731,15 @@
return true;
}
+void Download::getParams(const UserConnection& aSource, StringMap& params) {
+ Transfer::getParams(aSource, params);
+ params["target"] = getTarget();
+ params["sfv"] = Util::toString(isSet(Download::FLAG_CRC32_OK) ? 1 : 0);
+}
+
void DownloadManager::logDownload(UserConnection* aSource, Download* d) {
StringMap params;
- params["target"] = d->getTarget();
- params["userNI"] = Util::toString(ClientManager::getInstance()->getNicks(aSource->getUser()->getCID()));
- params["userI4"] = aSource->getRemoteIp();
- StringList hubNames = ClientManager::getInstance()->getHubNames(aSource->getUser()->getCID());
- if(hubNames.empty())
- hubNames.push_back(STRING(OFFLINE));
- params["hub"] = Util::toString(hubNames);
- StringList hubs = ClientManager::getInstance()->getHubs(aSource->getUser()->getCID());
- if(hubs.empty())
- hubs.push_back(STRING(OFFLINE));
- params["hubURL"] = Util::toString(hubs);
- params["fileSI"] = Util::toString(d->getSize());
- params["fileSIshort"] = Util::formatBytes(d->getSize());
- params["fileSIchunk"] = Util::toString(d->getTotal());
- params["fileSIchunkshort"] = Util::formatBytes(d->getTotal());
- params["fileSIactual"] = Util::toString(d->getActual());
- params["fileSIactualshort"] = Util::formatBytes(d->getActual());
- params["speed"] = Util::formatBytes(d->getAverageSpeed()) + "/s";
- params["time"] = Util::formatSeconds((GET_TICK() - d->getStart()) / 1000);
- params["sfv"] = Util::toString(d->isSet(Download::FLAG_CRC32_OK) ? 1 : 0);
- params["fileTR"] = d->getTTH().toBase32();
+ d->getParams(*aSource, params);
LOG(LogManager::DOWNLOAD, params);
}
@@ -798,6 +781,10 @@
failDownload(aSource, STRING(NO_SLOTS_AVAILABLE));
}
+void DownloadManager::on(UserConnectionListener::Error, UserConnection* aSource, const string& aError) throw() {
+ failDownload(aSource, aError);
+}
+
void DownloadManager::on(UserConnectionListener::Failed, UserConnection* aSource, const string& aError) throw() {
failDownload(aSource, aError);
}
@@ -809,7 +796,6 @@
removeDownload(d);
fire(DownloadManagerListener::Failed(), d, reason);
- aSource->setDownload(0);
QueueManager::getInstance()->putDownload(d, false);
}
removeConnection(aSource);
@@ -893,8 +879,6 @@
removeDownload(d);
fire(DownloadManagerListener::Failed(), d, d->getTargetFileName() + ": " + STRING(FILE_NOT_AVAILABLE));
- aSource->setDownload(NULL);
-
QueueManager::getInstance()->removeSource(d->getTarget(), aSource->getUser(), d->isSet(Download::FLAG_TREE_DOWNLOAD) ? QueueItem::Source::FLAG_NO_TREE : QueueItem::Source::FLAG_FILE_NOT_AVAILABLE, false);
QueueManager::getInstance()->putDownload(d, false);
Modified: dcplusplus/trunk/client/DownloadManager.h
===================================================================
--- dcplusplus/trunk/client/DownloadManager.h 2006-09-29 16:24:13 UTC (rev 662)
+++ dcplusplus/trunk/client/DownloadManager.h 2006-10-06 21:18:32 UTC (rev 663)
@@ -60,11 +60,13 @@
FLAG_TTH_CHECK = 0x800
};
- Download() throw();
- Download(QueueItem* qi) throw();
+ Download(UserConnection& conn) throw();
+ Download(UserConnection& conn, QueueItem& qi) throw();
- virtual ~Download() { }
+ virtual void getParams(const UserConnection& aSource, StringMap& params);
+ virtual ~Download();
+
/**
* @remarks This function is only used from DownloadManager but its
* functionality could be useful in TransferView.
@@ -72,12 +74,7 @@
* @return Target filename without path.
*/
string getTargetFileName() {
- string::size_type i = getTarget().rfind('\\');
- if(i != string::npos) {
- return getTarget().substr(i + 1);
- } else {
- return getTarget();
- }
+ return Util::getFileName(getTarget());
}
/** @internal */
@@ -98,7 +95,6 @@
GETSET(string, tempTarget, TempTarget);
GETSET(OutputStream*, file, File);
GETSET(CrcOS*, crcCalc, CrcCalc);
- GETSET(TTHValue, tth, TTH);
GETSET(bool, treeValid, TreeValid);
private:
@@ -198,8 +194,6 @@
return downloads.size();
}
- static const string USER_LIST_NAME;
- static const string USER_LIST_NAME_BZ;
private:
enum { MOVER_LIMIT = 10*1024*1024 };
class FileMover : public Thread {
@@ -248,6 +242,7 @@
// UserConnectionListener
virtual void on(Data, UserConnection*, const u_int8_t*, size_t) throw();
+ virtual void on(Error, UserConnection*, const string&) throw();
virtual void on(Failed, UserConnection*, const string&) throw();
virtual void on(Sending, UserConnection*, int64_t) throw();
virtual void on(FileLength, UserConnection*, int64_t) throw();
Modified: dcplusplus/trunk/client/FinishedManager.cpp
===================================================================
--- dcplusplus/trunk/client/FinishedManager.cpp 2006-09-29 16:24:13 UTC (rev 662)
+++ dcplusplus/trunk/client/FinishedManager.cpp 2006-10-06 21:18:32 UTC (rev 663)
@@ -66,8 +66,8 @@
{
if(!d->isSet(Download::FLAG_TREE_DOWNLOAD) && (!d->isSet(Download::FLAG_USER_LIST) || BOOLSETTING(LOG_FILELIST_TRANSFERS))) {
FinishedItem *item = new FinishedItem(
- d->getTarget(), Util::toString(ClientManager::getInstance()->getNicks(d->getUserConnection()->getUser()->getCID())),
- Util::toString(ClientManager::getInstance()->getHubNames(d->getUserConnection()->getUser()->getCID())),
+ d->getTarget(), Util::toString(ClientManager::getInstance()->getNicks(d->getUser()->getCID())),
+ Util::toString(ClientManager::getInstance()->getHubNames(d->getUser()->getCID())),
d->getSize(), d->getTotal(), (GET_TICK() - d->getStart()), GET_TIME(), d->isSet(Download::FLAG_CRC32_OK));
{
Lock l(cs);
@@ -82,8 +82,8 @@
{
if(!u->isSet(Upload::FLAG_TTH_LEAVES) && (!u->isSet(Upload::FLAG_USER_LIST) || BOOLSETTING(LOG_FILELIST_TRANSFERS))) {
FinishedItem *item = new FinishedItem(
- u->getLocalFileName(), Util::toString(ClientManager::getInstance()->getNicks(u->getUserConnection()->getUser()->getCID())),
- Util::toString(ClientManager::getInstance()->getHubNames(u->getUserConnection()->getUser()->getCID())),
+ u->getSourceFile(), Util::toString(ClientManager::getInstance()->getNicks(u->getUser()->getCID())),
+ Util::toString(ClientManager::getInstance()->getHubNames(u->getUser()->getCID())),
u->getSize(), u->getTotal(), (GET_TICK() - u->getStart()), GET_TIME());
{
Lock l(cs);
Modified: dcplusplus/trunk/client/QueueManager.cpp
===================================================================
--- dcplusplus/trunk/client/QueueManager.cpp 2006-09-29 16:24:13 UTC (rev 662)
+++ dcplusplus/trunk/client/QueueManager.cpp 2006-10-06 21:18:32 UTC (rev 663)
@@ -724,13 +724,14 @@
}
}
-Download* QueueManager::getDownload(User::Ptr& aUser, bool supportsTrees) throw() {
+Download* QueueManager::getDownload(UserConnection& aSource, bool supportsTrees) throw() {
Lock l(cs);
+ User::Ptr& aUser = aSource.getUser();
// First check PFS's...
PfsIter pi = pfsQueue.find(aUser->getCID());
if(pi != pfsQueue.end()) {
- Download* d = new Download();
+ Download* d = new Download(aSource);
d->setFlag(Download::FLAG_PARTIAL_LIST);
d->setSource(pi->second);
return d;
@@ -743,7 +744,7 @@
userQueue.setRunning(q, aUser);
- Download* d = new Download(q);
+ Download* d = new Download(aSource, *q);
q->setCurrentDownload(d);
@@ -783,18 +784,18 @@
Lock l(cs);
if(aDownload->isSet(Download::FLAG_PARTIAL_LIST)) {
- pair<PfsIter, PfsIter> range = pfsQueue.equal_range(aDownload->getUserConnection()->getUser()->getCID());
+ pair<PfsIter, PfsIter> range = pfsQueue.equal_range(aDownload->getUser()->getCID());
PfsIter i = find_if(range.first, range.second, CompareSecond<CID, string>(aDownload->getSource()));
if(i != range.second) {
pfsQueue.erase(i);
- fire(QueueManagerListener::PartialList(), aDownload->getUserConnection()->getUser(), aDownload->getPFS());
+ fire(QueueManagerListener::PartialList(), aDownload->getUser(), aDownload->getPFS());
}
} else {
QueueItem* q = fileQueue.find(aDownload->getTarget());
if(q) {
if(aDownload->isSet(Download::FLAG_USER_LIST)) {
- if(aDownload->getSource() == DownloadManager::USER_LIST_NAME_BZ) {
+ if(aDownload->getSource() == Transfer::USER_LIST_NAME_BZ) {
q->setFlag(QueueItem::FLAG_XML_BZLIST);
} else {
q->unsetFlag(QueueItem::FLAG_XML_BZLIST);
@@ -861,7 +862,6 @@
}
}
}
- aDownload->setUserConnection(0);
delete aDownload;
}
Modified: dcplusplus/trunk/client/QueueManager.h
===================================================================
--- dcplusplus/trunk/client/QueueManager.h 2006-09-29 16:24:13 UTC (rev 662)
+++ dcplusplus/trunk/client/QueueManager.h 2006-10-06 21:18:32 UTC (rev 663)
@@ -103,7 +103,7 @@
QueueItem::StringMap& lockQueue() throw() { cs.enter(); return fileQueue.getQueue(); } ;
void unlockQueue() throw() { cs.leave(); }
- Download* getDownload(User::Ptr& aUser, bool supportsTrees) throw();
+ Download* getDownload(UserConnection& aSource, bool supportsTrees) throw();
void putDownload(Download* aDownload, bool finished) throw();
bool hasDownload(const User::Ptr& aUser, QueueItem::Priority minPrio = QueueItem::LOWEST) throw() {
Modified: dcplusplus/trunk/client/SettingsManager.cpp
===================================================================
--- dcplusplus/trunk/client/SettingsManager.cpp 2006-09-29 16:24:13 UTC (rev 662)
+++ dcplusplus/trunk/client/SettingsManager.cpp 2006-10-06 21:18:32 UTC (rev 663)
@@ -152,8 +152,8 @@
setDefault(USE_OEM_MONOFONT, false);
setDefault(POPUP_PMS, true);
setDefault(MIN_UPLOAD_SPEED, 0);
- setDefault(LOG_FORMAT_POST_DOWNLOAD, "%Y-%m-%d %H:%M: %[target]" + STRING(DOWNLOADED_FROM) + "%[userNI] (%[userCID]), %[fileSI] (%[fileSIchunk]), %[speed], %[time]");
- setDefault(LOG_FORMAT_POST_UPLOAD, "%Y-%m-%d %H:%M: %[source]" + STRING(UPLOADED_TO) + "%[userNI] (%[userCID]), %[fileSI] (%[fileSIchunk]), %[speed], %[time]");
+ setDefault(LOG_FORMAT_POST_DOWNLOAD, "%Y-%m-%d %H:%M: %[target]" + STRING(DOWNLOADED_FROM) + "%[userNI] (%[userCID]), %[fileSI] (%[fileSIchunk]), %[speed], %[time], %[fileTR]");
+ setDefault(LOG_FORMAT_POST_UPLOAD, "%Y-%m-%d %H:%M: %[source]" + STRING(UPLOADED_TO) + "%[userNI] (%[userCID]), %[fileSI] (%[fileSIchunk]), %[speed], %[time], %[fileTR]");
setDefault(LOG_FORMAT_MAIN_CHAT, "[%Y-%m-%d %H:%M] %[message]");
setDefault(LOG_FORMAT_PRIVATE_CHAT, "[%Y-%m-%d %H:%M] %[message]");
setDefault(LOG_FORMAT_STATUS, "[%Y-%m-%d %H:%M] %[message]");
Modified: dcplusplus/trunk/client/ShareManager.cpp
===================================================================
--- dcplusplus/trunk/client/ShareManager.cpp 2006-09-29 16:24:13 UTC (rev 662)
+++ dcplusplus/trunk/client/ShareManager.cpp 2006-10-06 21:18:32 UTC (rev 663)
@@ -82,9 +82,8 @@
}
}
-string ShareManager::translateTTH(const string& TTH) throw(ShareException) {
- TTHValue v(TTH);
- HashFileIter i = tthIndex.find(v);
+string ShareManager::translateTTH(const TTHValue& tth) throw(ShareException) {
+ HashFileIter i = tthIndex.find(tth);
if(i != tthIndex.end()) {
return i->second->getADCPath();
} else {
@@ -92,67 +91,64 @@
}
}
-string ShareManager::translateFileName(const string& aFile) throw(ShareException) {
- if(aFile == "MyList.DcLst") {
+string ShareManager::translateFileName(const string& virtualFile) throw(ShareException) {
+ if(virtualFile == "MyList.DcLst") {
throw ShareException("NMDC-style lists no longer supported, please upgrade your client");
- } else if(aFile == DownloadManager::USER_LIST_NAME || aFile == DownloadManager::USER_LIST_NAME_BZ) {
+ } else if(virtualFile == Transfer::USER_LIST_NAME_BZ || virtualFile == Transfer::USER_LIST_NAME) {
generateXmlList();
return getBZXmlFile();
} else {
- if(aFile.length() < 3)
- throw ShareException(UserConnection::FILE_NOT_AVAILABLE);
-
- string file;
-
+ string realFile;
Lock l(cs);
- // Check for tth root identifier
- if(aFile.compare(0, 4, "TTH/") == 0) {
- file = translateTTH(aFile.substr(4));
- } else if(aFile[0] != '/') {
+ Directory::File::Iter it;
+ if(!checkFile(virtualFile, realFile, it)) {
throw ShareException(UserConnection::FILE_NOT_AVAILABLE);
- } else {
- file = aFile;
}
+ return realFile;
+ }
+}
- string::size_type i = file.find('/', 1);
- if(i == string::npos)
- throw ShareException(UserConnection::FILE_NOT_AVAILABLE);
+TTHValue ShareManager::getTTH(const string& virtualName) throw(ShareException) {
+ Lock l(cs);
+ string realName;
+ Directory::File::Iter it;
+ if(!checkFile(virtualName, realName, it))
+ throw ShareException();
+ return it->getTTH();
+}
- StringPairIter j = lookupVirtual(file.substr(1, i-1));
- if(j == virtualMap.end()) {
- throw ShareException(UserConnection::FILE_NOT_AVAILABLE);
+MemoryInputStream* ShareManager::getTree(const string& aFile) {
+ TigerTree tree;
+ if(aFile.compare(0, 4, "TTH/") == 0) {
+ if(!HashManager::getInstance()->getTree(TTHValue(aFile.substr(4)), tree))
+ return 0;
+ } else {
+ try {
+ TTHValue tth = getTTH(aFile);
+ HashManager::getInstance()->getTree(tth, tree);
+ } catch(const Exception&) {
+ return 0;
}
-
- file = file.substr(i + 1);
- Directory::File::Iter it;
- if(!checkFile(j->second, file, it)) {
- throw ShareException(UserConnection::FILE_NOT_AVAILABLE);
- }
-
-#ifdef _WIN32
- for(i = 0; i < file.length(); ++i) {
- if(file[i] == '/')
- file[i] = '\\';
- }
-#endif
- return j->second + file;
}
+
+ vector<u_int8_t> buf = tree.getLeafData();
+ return new MemoryInputStream(&buf[0], buf.size());
}
AdcCommand ShareManager::getFileInfo(const string& aFile) throw(ShareException) {
- if(aFile == DownloadManager::USER_LIST_NAME) {
+ if(aFile == Transfer::USER_LIST_NAME) {
generateXmlList();
/** todo fix size... */
AdcCommand cmd(AdcCommand::CMD_RES);
- cmd.addParam("FN", DownloadManager::USER_LIST_NAME);
+ cmd.addParam("FN", aFile);
cmd.addParam("TR", xmlRoot.toBase32());
return cmd;
- } else if(aFile == DownloadManager::USER_LIST_NAME_BZ) {
+ } else if(aFile == Transfer::USER_LIST_NAME_BZ) {
generateXmlList();
AdcCommand cmd(AdcCommand::CMD_RES);
- cmd.addParam("FN", DownloadManager::USER_LIST_NAME_BZ);
+ cmd.addParam("FN", aFile);
cmd.addParam("SI", Util::toString(File::getSize(getBZXmlFile())));
cmd.addParam("TR", xmlbzRoot.toBase32());
return cmd;
@@ -176,42 +172,68 @@
return cmd;
}
-StringPairIter ShareManager::findVirtual(const string& name) {
+StringPairIter ShareManager::findVirtual(const string& realName) {
for(StringPairIter i = virtualMap.begin(); i != virtualMap. end(); ++i) {
- if(Util::stricmp(name, i->second) == 0)
+ if(Util::stricmp(realName, i->second) == 0)
return i;
}
return virtualMap.end();
}
-StringPairIter ShareManager::lookupVirtual(const string& name) {
+StringPairIter ShareManager::findReal(const string& virtualName) {
for(StringPairIter i = virtualMap.begin(); i != virtualMap. end(); ++i) {
- if(Util::stricmp(name, i->first) == 0)
+ if(Util::stricmp(virtualName, i->first) == 0)
return i;
}
return virtualMap.end();
}
-bool ShareManager::checkFile(const string& dir, const string& aFile, Directory::File::Iter& it) {
- Directory::MapIter mi = directories.find(dir);
+bool ShareManager::checkFile(const string& virtualFile, string& realFile, Directory::File::Iter& it) {
+ string file;
+ if(virtualFile.compare(0, 4, "TTH/") == 0) {
+ file = translateTTH(TTHValue(virtualFile.substr(4)));
+ } else if(virtualFile.empty() || virtualFile[0] != '/') {
+ return false;
+ } else {
+ file = virtualFile;
+ }
+
+ string::size_type i = file.find('/', 1);
+ if(i == string::npos || i == 1) {
+ return false;
+ }
+
+ StringPairIter k = findReal(file.substr(1, i-1));
+ if(k == virtualMap.end()) {
+ return false;
+ }
+
+ file = file.substr(i + 1);
+
+ Directory::MapIter mi = directories.find(k->second);
if(mi == directories.end())
return false;
Directory* d = mi->second;
- string::size_type i;
string::size_type j = 0;
- while( (i = aFile.find('/', j)) != string::npos) {
- mi = d->directories.find(aFile.substr(j, i-j));
+ while( (i = file.find('/', j)) != string::npos) {
+ mi = d->directories.find(file.substr(j, i-j));
j = i + 1;
if(mi == d->directories.end())
return false;
d = mi->second;
}
- it = find_if(d->files.begin(), d->files.end(), Directory::File::StringComp(aFile.substr(j)));
+ it = find_if(d->files.begin(), d->files.end(), Directory::File::StringComp(file.substr(j)));
if(it == d->files.end())
return false;
+
+#ifdef _WIN32
+ replace_if(file.begin(), file.end(), bind2nd(equal_to<char>(), '/'), '\\');
+#endif
+
+ realFile = k->second + file;
return true;
}
@@ -249,7 +271,7 @@
newVirt = validateVirtual(newVirt);
// add only unique directories
- if(lookupVirtual(newVirt) == virtualMap.end()) {
+ if(findReal(newVirt) == virtualMap.end()) {
Directory* dp = new Directory(newVirt);
directories[d] = dp;
virtualMap.push_back(make_pair(newVirt, d));
@@ -381,7 +403,7 @@
}
}
- if(lookupVirtual(vName) != virtualMap.end()) {
+ if(findReal(vName) != virtualMap.end()) {
throw ShareException(STRING(VIRTUAL_NAME_EXISTS));
}
}
@@ -427,13 +449,12 @@
}
void ShareManager::renameDirectory(const string& oName, const string& nName) throw(ShareException) {
- StringPairIter i;
Lock l(cs);
//Find the virtual name
- i = lookupVirtual(oName);
- if (lookupVirtual(nName) != virtualMap.end()) {
+ if (findReal(nName) != virtualMap.end()) {
throw ShareException(STRING(VIRTUAL_NAME_EXISTS));
} else {
+ StringPairIter i = findReal(oName);
// Valid newName, lets rename
i->first = nName;
@@ -886,7 +907,7 @@
if(first) {
first = false;
- StringPairIter k = lookupVirtual(dir.substr(j, i-j));
+ StringPairIter k = findReal(dir.substr(j, i-j));
if(k == virtualMap.end())
return NULL;
it = directories.find(k->second);
@@ -911,47 +932,6 @@
return new MemoryInputStream(xml);
}
-bool ShareManager::getTTH(const string& aFile, TTHValue& tth) throw() {
- if(aFile.length() < 3 || aFile[0] != '/')
- return false;
-
- string::size_type i = aFile.find('/', 1);
- if(i == string::npos)
- return false;
-
- Lock l(cs);
- StringPairIter j = lookupVirtual(aFile.substr(1, i-1));
- if(j == virtualMap.end()) {
- return false;
- }
-
- Directory::File::Iter it;
- if(!checkFile(j->second, aFile.substr(i + 1), it))
- return false;
-
- tth = it->getTTH();
- return true;
-}
-
-MemoryInputStream* ShareManager::getTree(const string& aFile) {
- TigerTree tree;
- if(aFile.compare(0, 4, "TTH/") == 0) {
- if(!HashManager::getInstance()->getTree(TTHValue(aFile.substr(4)), tree))
- return NULL;
- } else {
- try {
- TTHValue tth;
- if(getTTH(aFile, tth))
- HashManager::getInstance()->getTree(tth, tree);
- } catch(const Exception&) {
- return NULL;
- }
- }
-
- vector<u_int8_t> buf = tree.getLeafData();
- return new MemoryInputStream(&buf[0], buf.size());
-}
-
static const string& escaper(const string& n, string& tmp) {
if(SimpleXML::needsEscape(n, true, false)) {
tmp.clear();
Modified: dcplusplus/trunk/client/ShareManager.h
===================================================================
--- dcplusplus/trunk/client/ShareManager.h 2006-09-29 16:24:13 UTC (rev 662)
+++ dcplusplus/trunk/client/ShareManager.h 2006-10-06 21:18:32 UTC (rev 663)
@@ -57,9 +57,10 @@
void addDirectory(const string& aDirectory, const string & aName) throw(ShareException);
void removeDirectory(const string& aName, bool duringRefresh = false);
void renameDirectory(const string& oName, const string& nName) throw(ShareException);
- string translateTTH(const string& TTH) throw(ShareException);
+ string translateTTH(const TTHValue& tth) throw(ShareException);
string translateFileName(const string& aFile) throw(ShareException);
- bool getTTH(const string& aFile, TTHValue& tth) throw();
+ TTHValue getTTH(const string& aFile) throw(ShareException);
+
void refresh(bool dirs = false, bool aUpdate = true, bool block = false) throw(ThreadException, ShareException);
void setDirty() { xmlDirty = true; }
@@ -283,11 +284,11 @@
BloomFilter<5> bloom;
/** Find virtual name from real name */
- StringPairIter findVirtual(const string& name);
+ StringPairIter findVirtual(const string& realName);
/** Find real name from virtual name */
- StringPairIter lookupVirtual(const string& name);
+ StringPairIter findReal(const string& virtualName);
- bool checkFile(const string& aDir, const string& aFile, Directory::File::Iter& it);
+ bool checkFile(const string& virtualFile, string& realFile, Directory::File::Iter& it);
Directory* buildTree(const string& aName, Directory* aParent);
void addTree(Directory* aDirectory);
Modified: dcplusplus/trunk/client/StringDefs.cpp
===================================================================
--- dcplusplus/trunk/client/StringDefs.cpp 2006-09-29 16:24:13 UTC (rev 662)
+++ dcplusplus/trunk/client/StringDefs.cpp 2006-10-06 21:18:32 UTC (rev 663)
@@ -582,6 +582,7 @@
"Unable to create thread",
"Unable to open filelist: ",
"Unable to rename ",
+"Unable to send file ",
"Unknown",
"Unknown address",
"Unknown command: ",
@@ -1210,6 +1211,7 @@
"UnableToCreateTh...
[truncated message content] |
|
From: <arn...@us...> - 2006-10-07 15:02:29
|
Revision: 664
http://svn.sourceforge.net/dcplusplus/?rev=664&view=rev
Author: arnetheduck
Date: 2006-10-07 08:02:06 -0700 (Sat, 07 Oct 2006)
Log Message:
-----------
more cleanup
Modified Paths:
--------------
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/client/ClientManager.cpp
dcplusplus/trunk/client/ConnectionManager.cpp
dcplusplus/trunk/client/DownloadManager.cpp
dcplusplus/trunk/client/DownloadManager.h
dcplusplus/trunk/client/QueueManager.cpp
dcplusplus/trunk/client/QueueManager.h
dcplusplus/trunk/client/UploadManager.cpp
dcplusplus/trunk/client/UploadManager.h
dcplusplus/trunk/client/UserConnection.cpp
dcplusplus/trunk/windows/MainFrm.cpp
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2006-10-06 21:18:32 UTC (rev 663)
+++ dcplusplus/trunk/changelog.txt 2006-10-07 15:02:06 UTC (rev 664)
@@ -4,6 +4,8 @@
* More code cleanup
* Fixed trusted/untrusted upload view
* Fixed crash on invalid remote command during upload
+* [ADC] Improved GFI command support
+* Lowest priority downloads are no longer started if there are other downloads running
-- 0.697 2006-09-29 --
* [ADC] Fixed a few protocol issues
Modified: dcplusplus/trunk/client/ClientManager.cpp
===================================================================
--- dcplusplus/trunk/client/ClientManager.cpp 2006-10-06 21:18:32 UTC (rev 663)
+++ dcplusplus/trunk/client/ClientManager.cpp 2006-10-07 15:02:06 UTC (rev 664)
@@ -24,7 +24,6 @@
#include "ShareManager.h"
#include "SearchManager.h"
#include "CryptoManager.h"
-#include "ConnectionManager.h"
#include "FavoriteManager.h"
#include "SimpleXML.h"
#include "UserCommand.h"
Modified: dcplusplus/trunk/client/ConnectionManager.cpp
===================================================================
--- dcplusplus/trunk/client/ConnectionManager.cpp 2006-10-06 21:18:32 UTC (rev 663)
+++ dcplusplus/trunk/client/ConnectionManager.cpp 2006-10-07 15:02:06 UTC (rev 664)
@@ -131,9 +131,6 @@
ConnectionQueueItem::List removed;
User::List idlers;
- bool tooMany = ((SETTING(DOWNLOAD_SLOTS) != 0) && DownloadManager::getInstance()->getDownloadCount() >= (size_t)SETTING(DOWNLOAD_SLOTS));
- bool tooFast = ((SETTING(MAX_DOWNLOAD_SPEED) != 0 && DownloadManager::getInstance()->getAverageSpeed() >= (SETTING(MAX_DOWNLOAD_SPEED)*1024)));
-
{
Lock l(cs);
@@ -161,19 +158,15 @@
if( ((cqi->getLastAttempt() + 60*1000) < aTick) && !attemptDone ) {
cqi->setLastAttempt(aTick);
- if(!QueueManager::getInstance()->hasDownload(cqi->getUser())) {
+ QueueItem::Priority prio = QueueManager::getInstance()->hasDownload(cqi->getUser());
+
+ if(prio == QueueItem::PAUSED) {
removed.push_back(cqi);
continue;
}
- // Always start high-priority downloads unless we have 3 more than maxdownslots already...
- bool startDown = !tooMany && !tooFast;
-
- if(!startDown) {
- bool extraFull = (SETTING(DOWNLOAD_SLOTS) != 0) && (DownloadManager::getInstance()->getDownloadCount() >= (size_t)(SETTING(DOWNLOAD_SLOTS)+3));
- startDown = !extraFull && QueueManager::getInstance()->hasDownload(cqi->getUser(), QueueItem::HIGHEST);
- }
-
+ bool startDown = DownloadManager::getInstance()->startDownload(prio);
+
if(cqi->getState() == ConnectionQueueItem::WAITING) {
if(startDown) {
cqi->setState(ConnectionQueueItem::CONNECTING);
Modified: dcplusplus/trunk/client/DownloadManager.cpp
===================================================================
--- dcplusplus/trunk/client/DownloadManager.cpp 2006-10-06 21:18:32 UTC (rev 663)
+++ dcplusplus/trunk/client/DownloadManager.cpp 2006-10-07 15:02:06 UTC (rev 664)
@@ -22,9 +22,7 @@
#include "DownloadManager.h"
#include "ResourceManager.h"
-#include "ConnectionManager.h"
#include "QueueManager.h"
-#include "CryptoManager.h"
#include "HashManager.h"
#include "LogManager.h"
@@ -33,7 +31,6 @@
#include "File.h"
#include "FilteredFile.h"
#include "MerkleCheckOutputStream.h"
-#include "ClientManager.h"
#include <limits>
@@ -91,6 +88,12 @@
return cmd;
}
+void Download::getParams(const UserConnection& aSource, StringMap& params) {
+ Transfer::getParams(aSource, params);
+ params["target"] = getTarget();
+ params["sfv"] = Util::toString(isSet(Download::FLAG_CRC32_OK) ? 1 : 0);
+}
+
DownloadManager::DownloadManager() {
TimerManager::getInstance()->addListener(this);
}
@@ -261,20 +264,36 @@
checkDownloads(conn);
}
-void DownloadManager::checkDownloads(UserConnection* aConn) {
- dcassert(aConn->getDownload() == NULL);
+bool DownloadManager::startDownload(QueueItem::Priority prio) {
+ size_t downloadCount = getDownloadCount();
- bool slotsFull = (SETTING(DOWNLOAD_SLOTS) != 0) && (getDownloadCount() >= (size_t)SETTING(DOWNLOAD_SLOTS));
- bool speedFull = (SETTING(MAX_DOWNLOAD_SPEED) != 0) && (getAverageSpeed() >= (SETTING(MAX_DOWNLOAD_SPEED)*1024));
+ bool full = (SETTING(DOWNLOAD_SLOTS) != 0) && (downloadCount >= (size_t)SETTING(DOWNLOAD_SLOTS));
+ full = full || (SETTING(MAX_DOWNLOAD_SPEED) != 0) && (getRunningAverage() >= (SETTING(MAX_DOWNLOAD_SPEED)*1024));
- if( slotsFull || speedFull ) {
+ if(full) {
bool extraFull = (SETTING(DOWNLOAD_SLOTS) != 0) && (getDownloadCount() >= (size_t)(SETTING(DOWNLOAD_SLOTS)+3));
- if(extraFull || !QueueManager::getInstance()->hasDownload(aConn->getUser(), QueueItem::HIGHEST)) {
- removeConnection(aConn);
- return;
+ if(extraFull) {
+ return false;
}
+ return prio == QueueItem::HIGHEST;
}
+ if(downloadCount > 0) {
+ return prio != QueueItem::LOWEST;
+ }
+
+ return true;
+}
+
+void DownloadManager::checkDownloads(UserConnection* aConn) {
+ dcassert(aConn->getDownload() == NULL);
+
+ QueueItem::Priority prio = QueueManager::getInstance()->hasDownload(aConn->getUser());
+ if(!startDownload(prio)) {
+ removeConnection(aConn);
+ return;
+ }
+
Download* d = QueueManager::getInstance()->getDownload(*aConn, aConn->isSet(UserConnection::FLAG_SUPPORTS_TTHL));
if(!d) {
@@ -731,10 +750,14 @@
return true;
}
-void Download::getParams(const UserConnection& aSource, StringMap& params) {
- Transfer::getParams(aSource, params);
- params["target"] = getTarget();
- params["sfv"] = Util::toString(isSet(Download::FLAG_CRC32_OK) ? 1 : 0);
+int64_t DownloadManager::getRunningAverage() {
+ Lock l(cs);
+ int64_t avg = 0;
+ for(Download::Iter i = downloads.begin(); i != downloads.end(); ++i) {
+ Download* d = *i;
+ avg += d->getRunningAverage();
+ }
+ return avg;
}
void DownloadManager::logDownload(UserConnection* aSource, Download* d) {
Modified: dcplusplus/trunk/client/DownloadManager.h
===================================================================
--- dcplusplus/trunk/client/DownloadManager.h 2006-10-06 21:18:32 UTC (rev 663)
+++ dcplusplus/trunk/client/DownloadManager.h 2006-10-07 15:02:06 UTC (rev 664)
@@ -30,8 +30,8 @@
#include "FilteredFile.h"
#include "ZUtils.h"
#include "MerkleTree.h"
+#include "QueueItem.h"
-class QueueItem;
class ConnectionQueueItem;
/**
@@ -67,12 +67,7 @@
virtual ~Download();
- /**
- * @remarks This function is only used from DownloadManager but its
- * functionality could be useful in TransferView.
- *
- * @return Target filename without path.
- */
+ /** @return Target filename without path. */
string getTargetFileName() {
return Util::getFileName(getTarget());
}
@@ -99,14 +94,12 @@
private:
Download(const Download&);
-
Download& operator=(const Download&);
TigerTree tt;
string pfs;
};
-
/**
* Use this listener interface to get progress information for downloads.
*
@@ -172,21 +165,8 @@
void addConnection(UserConnection::Ptr conn);
void checkIdle(const User::Ptr& user);
- /**
- * @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.
- *
- * @return Average download speed in Bytes/s
- */
- int getAverageSpeed() {
- Lock l(cs);
- int avg = 0;
- for(Download::Iter i = downloads.begin(); i != downloads.end(); ++i) {
- Download* d = *i;
- avg += (int)d->getRunningAverage();
- }
- return avg;
- }
+ /** @return Running average download speed in Bytes/s */
+ int64_t getRunningAverage();
/** @return Number of downloads. */
size_t getDownloadCount() {
@@ -194,6 +174,7 @@
return downloads.size();
}
+ bool startDownload(QueueItem::Priority prio);
private:
enum { MOVER_LIMIT = 10*1024*1024 };
class FileMover : public Thread {
Modified: dcplusplus/trunk/client/QueueManager.cpp
===================================================================
--- dcplusplus/trunk/client/QueueManager.cpp 2006-10-06 21:18:32 UTC (rev 663)
+++ dcplusplus/trunk/client/QueueManager.cpp 2006-10-07 15:02:06 UTC (rev 664)
@@ -613,6 +613,18 @@
return sz;
}
+QueueItem::Priority QueueManager::hasDownload(const User::Ptr& aUser) throw() {
+ Lock l(cs);
+ if(pfsQueue.find(aUser->getCID()) != pfsQueue.end()) {
+ return QueueItem::HIGHEST;
+ }
+ QueueItem* qi = userQueue.getNext(aUser, QueueItem::LOWEST);
+ if(!qi) {
+ return QueueItem::PAUSED;
+ }
+ return qi->getPriority();
+}
+
typedef HASH_MULTIMAP<u_int32_t, QueueItem*> SizeMap;
typedef SizeMap::iterator SizeIter;
typedef pair<SizeIter, SizeIter> SizePair;
Modified: dcplusplus/trunk/client/QueueManager.h
===================================================================
--- dcplusplus/trunk/client/QueueManager.h 2006-10-06 21:18:32 UTC (rev 663)
+++ dcplusplus/trunk/client/QueueManager.h 2006-10-07 15:02:06 UTC (rev 664)
@@ -106,10 +106,8 @@
Download* getDownload(UserConnection& aSource, bool supportsTrees) throw();
void putDownload(Download* aDownload, bool finished) throw();
- bool hasDownload(const User::Ptr& aUser, QueueItem::Priority minPrio = QueueItem::LOWEST) throw() {
- Lock l(cs);
- return (pfsQueue.find(aUser->getCID()) != pfsQueue.end()) || (userQueue.getNext(aUser, minPrio) != NULL);
- }
+ /** @return The highest priority download the user has, PAUSED may also mean no downloads */
+ QueueItem::Priority hasDownload(const User::Ptr& aUser) throw();
int countOnlineSources(const string& aTarget);
Modified: dcplusplus/trunk/client/UploadManager.cpp
===================================================================
--- dcplusplus/trunk/client/UploadManager.cpp 2006-10-06 21:18:32 UTC (rev 663)
+++ dcplusplus/trunk/client/UploadManager.cpp 2006-10-07 15:02:06 UTC (rev 664)
@@ -214,7 +214,6 @@
if(partList)
u->setFlag(Upload::FLAG_PARTIAL_LIST);
- dcassert(aSource.getUpload() == NULL);
uploads.push_back(u);
if(!aSource.isSet(UserConnection::FLAG_HASSLOT)) {
@@ -238,6 +237,16 @@
return true;
}
+int64_t UploadManager::getRunningAverage() {
+ Lock l(cs);
+ int64_t avg = 0;
+ for(Upload::Iter i = uploads.begin(); i != uploads.end(); ++i) {
+ Upload* u = *i;
+ avg += (int)u->getRunningAverage();
+ }
+ return avg;
+}
+
bool UploadManager::getAutoSlot() {
/** A 0 in settings means disable */
if(SETTING(MIN_UPLOAD_SPEED) == 0)
@@ -246,7 +255,7 @@
if(GET_TICK() < getLastGrant() + 30*1000)
return false;
/** Grant if upload speed is less than the threshold speed */
- return getAverageSpeed() < (SETTING(MIN_UPLOAD_SPEED)*1024);
+ return getRunningAverage() < (SETTING(MIN_UPLOAD_SPEED)*1024);
}
void UploadManager::removeUpload(Upload* aUpload) {
@@ -362,7 +371,7 @@
void UploadManager::addFailedUpload(const UserConnection& source, string filename) {
{
Lock l(cs);
- if (!count_if(waitingUsers.begin(), waitingUsers.end(), UserMatch(source.getUser())))
+ if (!count_if(waitingUsers.begin(), waitingUsers.end(), CompareFirst<User::Ptr, u_int32_t>(source.getUser())))
waitingUsers.push_back(WaitingUser(source.getUser(), GET_TICK()));
waitingFiles[source.getUser()].insert(filename); //files for which user's asked
}
@@ -373,7 +382,7 @@
void UploadManager::clearUserFiles(const User::Ptr& source) {
Lock l(cs);
//run this when a user's got a slot or goes offline.
- UserList::iterator sit = find_if(waitingUsers.begin(), waitingUsers.end(), UserMatch(source));
+ UserList::iterator sit = find_if(waitingUsers.begin(), waitingUsers.end(), CompareFirst<User::Ptr, u_int32_t>(source));
if (sit == waitingUsers.end()) return;
FilesMap::iterator fit = waitingFiles.find(sit->first);
Modified: dcplusplus/trunk/client/UploadManager.h
===================================================================
--- dcplusplus/trunk/client/UploadManager.h 2006-10-06 21:18:32 UTC (rev 663)
+++ dcplusplus/trunk/client/UploadManager.h 2006-10-07 15:02:06 UTC (rev 664)
@@ -86,17 +86,9 @@
* @remarks This is only used in the tray icons. Could be used in
* MainFrame too.
*
- * @return Average download speed in Bytes/s
+ * @return Running average download speed in Bytes/s
*/
- int getAverageSpeed() {
- Lock l(cs);
- int avg = 0;
- for(Upload::Iter i = uploads.begin(); i != uploads.end(); ++i) {
- Upload* u = *i;
- avg += (int)u->getRunningAverage();
- }
- return avg;
- }
+ int64_t getRunningAverage();
/** @return Number of free slots. */
int getFreeSlots() { return max((SETTING(SLOTS) - running), 0); }
@@ -133,14 +125,6 @@
typedef pair<User::Ptr, u_int32_t> WaitingUser;
typedef list<WaitingUser> UserList;
- struct UserMatch {
- UserMatch(const User::Ptr& u) : u(u) { }
- const User::Ptr& u;
- bool operator()(const WaitingUser& wu) { return wu.first == u; }
- private:
- UserMatch& operator=(const UserMatch&);
- };
-
struct WaitingUserFresh {
bool operator()(const WaitingUser& wu) { return wu.second > GET_TICK() - 5*60*1000; }
};
Modified: dcplusplus/trunk/client/UserConnection.cpp
===================================================================
--- dcplusplus/trunk/client/UserConnection.cpp 2006-10-06 21:18:32 UTC (rev 663)
+++ dcplusplus/trunk/client/UserConnection.cpp 2006-10-07 15:02:06 UTC (rev 664)
@@ -53,12 +53,11 @@
void Transfer::updateRunningAverage() {
u_int32_t tick = GET_TICK();
- if(tick > lastTick) {
+ // Update 4 times/sec at most
+ if(tick > (lastTick + 250)) {
u_int32_t diff = tick - lastTick;
int64_t tot = getTotal();
- if(diff == 0) {
- // No time passed, don't update runningAverage;
- } else if( ((tick - getStart()) < AVG_PERIOD) ) {
+ if( ((tick - getStart()) < AVG_PERIOD) ) {
runningAverage = getAverageSpeed();
} else {
int64_t bdiff = tot - last;
Modified: dcplusplus/trunk/windows/MainFrm.cpp
===================================================================
--- dcplusplus/trunk/windows/MainFrm.cpp 2006-10-06 21:18:32 UTC (rev 663)
+++ dcplusplus/trunk/windows/MainFrm.cpp 2006-10-07 15:02:06 UTC (rev 664)
@@ -1011,9 +1011,9 @@
nid.hWnd = m_hWnd;
nid.uID = 0;
nid.uFlags = NIF_TIP;
- _tcsncpy(nid.szTip, Text::toT("D: " + Util::formatBytes(DownloadManager::getInstance()->getAverageSpeed()) + "/s (" +
+ _tcsncpy(nid.szTip, Text::toT("D: " + Util::formatBytes(DownloadManager::getInstance()->getRunningAverage()) + "/s (" +
Util::toString(DownloadManager::getInstance()->getDownloadCount()) + ")\r\nU: " +
- Util::formatBytes(UploadManager::getInstance()->getAverageSpeed()) + "/s (" +
+ Util::formatBytes(UploadManager::getInstance()->getRunningAverage()) + "/s (" +
Util::toString(UploadManager::getInstance()->getUploadCount()) + ")").c_str(), 64);
::Shell_NotifyIcon(NIM_MODIFY, &nid);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <arn...@us...> - 2006-10-08 20:01:23
|
Revision: 666
http://svn.sourceforge.net/dcplusplus/?rev=666&view=rev
Author: arnetheduck
Date: 2006-10-08 12:59:43 -0700 (Sun, 08 Oct 2006)
Log Message:
-----------
cleanup, bugfixes
Modified Paths:
--------------
dcplusplus/trunk/Compile.txt
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/client/AdcCommand.cpp
dcplusplus/trunk/client/AdcCommand.h
dcplusplus/trunk/client/AdcHub.cpp
dcplusplus/trunk/client/AdcHub.h
dcplusplus/trunk/client/BitInputStream.h
dcplusplus/trunk/client/BitOutputStream.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/ConnectionManager.cpp
dcplusplus/trunk/client/ConnectionManager.h
dcplusplus/trunk/client/CryptoManager.cpp
dcplusplus/trunk/client/CryptoManager.h
dcplusplus/trunk/client/DownloadManager.cpp
dcplusplus/trunk/client/DownloadManager.h
dcplusplus/trunk/client/Encoder.cpp
dcplusplus/trunk/client/Encoder.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.cpp
dcplusplus/trunk/client/File.h
dcplusplus/trunk/client/FilteredFile.h
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/MerkleCheckOutputStream.h
dcplusplus/trunk/client/MerkleTree.h
dcplusplus/trunk/client/NmdcHub.cpp
dcplusplus/trunk/client/NmdcHub.h
dcplusplus/trunk/client/QueueItem.h
dcplusplus/trunk/client/QueueManager.cpp
dcplusplus/trunk/client/QueueManager.h
dcplusplus/trunk/client/SFVReader.h
dcplusplus/trunk/client/SSLSocket.cpp
dcplusplus/trunk/client/SSLSocket.h
dcplusplus/trunk/client/SearchManager.cpp
dcplusplus/trunk/client/SearchManager.h
dcplusplus/trunk/client/Semaphore.h
dcplusplus/trunk/client/ShareManager.cpp
dcplusplus/trunk/client/ShareManager.h
dcplusplus/trunk/client/Socket.cpp
dcplusplus/trunk/client/Socket.h
dcplusplus/trunk/client/Streams.h
dcplusplus/trunk/client/StringSearch.h
dcplusplus/trunk/client/Text.cpp
dcplusplus/trunk/client/Text.h
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/UserConnection.cpp
dcplusplus/trunk/client/UserConnection.h
dcplusplus/trunk/client/Util.cpp
dcplusplus/trunk/client/Util.h
dcplusplus/trunk/client/ZUtils.h
dcplusplus/trunk/client/config.h
dcplusplus/trunk/client/stdinc.cpp
dcplusplus/trunk/client/stdinc.h
dcplusplus/trunk/windows/AboutDlg.h
dcplusplus/trunk/windows/HashProgressDlg.h
dcplusplus/trunk/windows/HubFrame.cpp
dcplusplus/trunk/windows/MainFrm.cpp
dcplusplus/trunk/windows/MainFrm.h
dcplusplus/trunk/windows/QueueFrame.h
dcplusplus/trunk/windows/SpyFrame.cpp
dcplusplus/trunk/windows/SpyFrame.h
dcplusplus/trunk/windows/StatsFrame.cpp
dcplusplus/trunk/windows/StatsFrame.h
dcplusplus/trunk/windows/TransferView.h
dcplusplus/trunk/windows/WinUtil.cpp
Removed Paths:
-------------
dcplusplus/trunk/Makefile.am
dcplusplus/trunk/acinclude.m4
dcplusplus/trunk/client/Makefile.am
dcplusplus/trunk/configure.ac
Modified: dcplusplus/trunk/Compile.txt
===================================================================
--- dcplusplus/trunk/Compile.txt 2006-10-07 21:51:27 UTC (rev 665)
+++ dcplusplus/trunk/Compile.txt 2006-10-08 19:59:43 UTC (rev 666)
@@ -2,7 +2,10 @@
How to compile in 3 easy steps:
-1) Download the source and STLPort from the DC++ download site. Unpack the DC++ source. Unpack the STLport source into the stlport directory.
+1) Download the source DC++ download site. Unpack the DC++ source.
+ Download STLPort 5.0.2 from http://sf.net/stlport and unpack it to a temporary folder. Inside you'll
+ find a folder named stlport which contains files such as "algorithm". Copy the contents of this folder
+ to the stlport folder where you unpacked DC++.
Download WTL from http://sf.net/projects/wtl. Unpack it to the wtl folder.
2) You most probably have to update your Platform SDK, http://msdn.microsoft.com will tell you how.
@@ -10,29 +13,24 @@
one file, you can ask someone at the dev hub to supply it for you (or look for it in the DC++
bugzilla, it's attached to one of the bugs).
-3) Open the solution and press your build button. If you find your executable unreasonably large, you
- probably compiled in debug mode - switch to release once you're done testing the code.
+3) Open the solution in vc7.1 (2004) and press your build button. If you find your executable unreasonably large,
+ you probably compiled in debug mode - switch to release once you're done testing the code.
-Note 1; I now use vc7.1 (2003). I don't care particularly if you use an older MS compiler (6.0, 7.0),
- because these don't even come close to supporting the c++ standard. If you want to try anyway,
- you're on your own. You will need a new Platform SDK if you're using VS 6.0.
- The client part usually compiles fine with g++ 3.4+, There's a bug in 3.3
- (and probably older versions) that prevents a few files from being compiled.
-Note 2; You'll need DBGHELP.dll from the binary distribution unless you're using WinXP, otherwise
+Note; You'll need DBGHELP.dll from the binary distribution unless you're using WinXP, otherwise
you'll get errors saying symbols are missing when running your compiled executable. My copy
says version 5.1.2600.1106 right now.
-Note 3; If you have problems, read the forum posts before posting. Somebody else has probably made your
+Note; If you have problems, read the forum posts before posting. Somebody else has probably made your
mistake already. The word to note in the last sentence is 'your', so let me articulate a bit more,
it works on my computer, so it's yours that is not correctly set up.
-Note 4; To build the HTML Help file, you will need to download and install the HTML Help Workshop
+Note; To build the HTML Help file, you will need to download and install the HTML Help Workshop
application. The custom build setup relies on it being installed to the default path, which
is: "C:\Program Files\HTML Help Workshop\"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/htmlhelp/html/hwMicrosoftHTMLHelpDownloads.asp
-Note 5; You need to have python installed if you change StringDefs.h, as a small python script is automatically
+Note; You need to have python installed if you change StringDefs.h, as a small python script is automatically
run to generate StringDefs.cpp and Example.xml. To turn it off or change python path, go to
client->Header Files->StringDefs.h->Properties->Custom build step and change the appropriate values.
The help file's changelog.html is also updated via a python script (courtesy of fusbar).
@@ -41,12 +39,7 @@
to generate some nice docs...just check that the paths in doxyfile are correct (graphviz)...
Linux / Unix:
-I've made some rudimentary autoconf/automake scripts now, so you can compile the client part into a library
-without too much hassle (I don't check if it compiles very often though...). You'll need the latest versions
-of automake and autoconf, and after getting the source (from SVN is easiest), do
-"aclocal && automake && autoconf && configure && make" and you'll have the client part nicely compiled.
-When / if I test it I do it on a Gentoo AMD64 box with the latest gcc in 64-bit mode, so I don't have a clue
-if the 32-bit compile works...
+Look at linuxdcpp.berlios.de for the *nix port of DC++ - they'll gladly accept any help.
Submitting patches
@@ -55,12 +48,17 @@
completely random, which just might be the case. Popular reasons for rejecting a patch include, but are not limited to,
ugly code, abusable features, feature that I don't like that bloat the application and incompatibility with other
modifications I've already done.
-To increase the chances of your patch being accepted, post them in the DC++ bugzilla as diffs against the latest
-code you can find (in the SVN repository on sourceforge most probably). You can find a lot of
-information about diff and patch by googling for it. I like unified format (diff -u). When diffing, apply diff to
-the folders of the two versions, so that the paths will be included in the diff.
+
+To increase the chances of your patch being accepted, do like this:
+1) Check out the latest code from SVN (see http://sf.net/projects/dcplusplus for instructions)
+2) Make your modification. If you make other modifications apart from the one you want to submit, do them
+ on a separate copy of the DC++ source code and then copy them to this folder.
+3) In the source root folder (the one with this file in it) do "svn diff > my-patch.diff".
+4) Post the file in the DC++ bugzilla (don't forget to hand over copyright, see below).
+
By submitting a patch, you agree to that I get copyright of it. This to avoid stupid situations later on where
the copyright is split out over a million people, each of which could stop further distribution of DC++, and also
to make it easier for us to defend the gpl against violators. If you don't like this policy, start your own
distribution, if you're lucky it might become more popular than the original =). Please
-state explicitly in the email that you give me copyright over the code if the submission is larger than trivial.
+state explicitly in the bugzilla that you give me copyright over the code if the submission is larger than trivial.
+
Deleted: dcplusplus/trunk/Makefile.am
===================================================================
--- dcplusplus/trunk/Makefile.am 2006-10-07 21:51:27 UTC (rev 665)
+++ dcplusplus/trunk/Makefile.am 2006-10-08 19:59:43 UTC (rev 666)
@@ -1 +0,0 @@
-SUBDIRS=client
Deleted: dcplusplus/trunk/acinclude.m4
===================================================================
--- dcplusplus/trunk/acinclude.m4 2006-10-07 21:51:27 UTC (rev 665)
+++ dcplusplus/trunk/acinclude.m4 2006-10-08 19:59:43 UTC (rev 666)
@@ -1,21 +0,0 @@
-
-# Check for STLPort
-AC_DEFUN([AX_LIB_STLPORT],
-[
- AC_MSG_CHECKING([for STLPort])
- AC_LANG_PUSH(C++)
- AC_COMPILE_IFELSE(
- [
- AC_LANG_PROGRAM
- ([[
-#include <string>
-#ifndef _STLPORT_VERSION
-#error No STLPort
-#endif
- ]])
- ],
- [AC_DEFINE([HAVE_STLPORT], 1, [If you have STLPort installed]) AC_MSG_RESULT([yes])],
- [AC_MSG_RESULT([no])]
- )
- AC_LANG_POP
-])
\ No newline at end of file
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2006-10-07 21:51:27 UTC (rev 665)
+++ dcplusplus/trunk/changelog.txt 2006-10-08 19:59:43 UTC (rev 666)
@@ -6,6 +6,12 @@
* Fixed crash on invalid remote command during upload
* [ADC] Improved GFI command support
* Lowest priority downloads are no longer started if there are other downloads running
+* Upgraded to STLport 5.0.2
+* Updated compile instructions
+* Updated unsigned types to C99
+* Removed unmaintained autoconf files
+* Reworked match listing to make it slightly faster
+* Fixed a few random crashes
-- 0.697 2006-09-29 --
* [ADC] Fixed a few protocol issues
Modified: dcplusplus/trunk/client/AdcCommand.cpp
===================================================================
--- dcplusplus/trunk/client/AdcCommand.cpp 2006-10-07 21:51:27 UTC (rev 665)
+++ dcplusplus/trunk/client/AdcCommand.cpp 2006-10-08 19:59:43 UTC (rev 666)
@@ -22,8 +22,8 @@
#include "AdcCommand.h"
#include "ClientManager.h"
-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, char aType) : cmdInt(aCmd), from(0), to(aTarget), type(aType) { }
+AdcCommand::AdcCommand(uint32_t aCmd, char aType /* = TYPE_CLIENT */) : cmdInt(aCmd), from(0), type(aType) { }
+AdcCommand::AdcCommand(uint32_t aCmd, const uint32_t aTarget, char aType) : cmdInt(aCmd), from(0), to(aTarget), type(aType) { }
AdcCommand::AdcCommand(Severity sev, Error err, const string& desc, char aType /* = TYPE_CLIENT */) : cmdInt(CMD_STA), from(0), type(aType) {
addParam(Util::toString(sev * 100 + err));
addParam(desc);
@@ -161,7 +161,7 @@
return getHeaderString(aCID) + getParamString(false);
}
-string AdcCommand::toString(u_int32_t sid /* = 0 */, bool nmdc /* = false */) const {
+string AdcCommand::toString(uint32_t sid /* = 0 */, bool nmdc /* = false */) const {
return getHeaderString(sid, nmdc) + getParamString(nmdc);
}
@@ -183,7 +183,7 @@
return tmp;
}
-string AdcCommand::getHeaderString(u_int32_t sid, bool nmdc) const {
+string AdcCommand::getHeaderString(uint32_t sid, bool nmdc) const {
string tmp;
if(nmdc) {
tmp += "$ADC";
Modified: dcplusplus/trunk/client/AdcCommand.h
===================================================================
--- dcplusplus/trunk/client/AdcCommand.h 2006-10-07 21:51:27 UTC (rev 665)
+++ dcplusplus/trunk/client/AdcCommand.h 2006-10-08 19:59:43 UTC (rev 666)
@@ -32,7 +32,7 @@
class AdcCommand {
public:
- template<u_int32_t T>
+ template<uint32_t T>
struct Type {
enum { CMD = T };
};
@@ -82,9 +82,9 @@
static const char TYPE_UDP = 'U';
#if defined(_WIN32) || defined(__i386__) || defined(__x86_64__) || defined(__alpha)
-#define C(n, a, b, c) static const u_int32_t CMD_##n = (((u_int32_t)a) | (((u_int32_t)b)<<8) | (((u_int32_t)c)<<16)); typedef Type<CMD_##n> n
+#define C(n, a, b, c) static const uint32_t CMD_##n = (((uint32_t)a) | (((uint32_t)b)<<8) | (((uint32_t)c)<<16)); typedef Type<CMD_##n> n
#else
-#define C(n, a, b, c) static const u_int32_t CMD_##n = ((((u_int32_t)a)<<24) | (((u_int32_t)b)<<16) | (((u_int32_t)c)<<8)); typedef Type<CMD_##n> n
+#define C(n, a, b, c) static const uint32_t CMD_##n = ((((uint32_t)a)<<24) | (((uint32_t)b)<<16) | (((uint32_t)c)<<8)); typedef Type<CMD_##n> n
#endif
// Base commands
C(SUP, 'S','U','P');
@@ -107,15 +107,15 @@
C(CMD, 'C','M','D');
#undef C
- static const u_int32_t HUB_SID = 0x41414141; // AAAA in base32
+ static const uint32_t HUB_SID = 0x41414141; // AAAA in base32
- explicit AdcCommand(u_int32_t aCmd, char aType = TYPE_CLIENT);
- explicit AdcCommand(u_int32_t aCmd, const u_int32_t aTarget, char aType);
+ explicit AdcCommand(uint32_t aCmd, char aType = TYPE_CLIENT);
+ explicit AdcCommand(uint32_t aCmd, const uint32_t aTarget, char aType);
explicit AdcCommand(Severity sev, Error err, const string& desc, char aType = TYPE_CLIENT);
explicit AdcCommand(const string& aLine, bool nmdc = false) throw(ParseException);
void parse(const string& aLine, bool nmdc = false) throw(ParseException);
- u_int32_t getCommand() const { return cmdInt; }
+ uint32_t getCommand() const { return cmdInt; }
char getType() const { return type; }
void setType(char t) { type = t; }
@@ -125,7 +125,7 @@
const StringList& getParameters() const { return parameters; }
string toString(const CID& aCID) const;
- string toString(u_int32_t sid, bool nmdc = false) const;
+ string toString(uint32_t sid, bool nmdc = false) const;
AdcCommand& addParam(const string& name, const string& value) {
parameters.push_back(name);
@@ -142,30 +142,30 @@
/** Return a named parameter where the name is a two-letter code */
bool getParam(const char* name, size_t start, string& ret) const;
bool hasFlag(const char* name, size_t start) const;
- static u_int16_t toCode(const char* x) { return *((u_int16_t*)x); }
+ static uint16_t toCode(const char* x) { return *((uint16_t*)x); }
- bool operator==(u_int32_t aCmd) { return cmdInt == aCmd; }
+ bool operator==(uint32_t aCmd) { return cmdInt == aCmd; }
static string escape(const string& str, bool old);
- u_int32_t getTo() const { return to; }
- AdcCommand& setTo(const u_int32_t sid) { to = sid; return *this; }
- u_int32_t getFrom() const { return from; }
+ uint32_t getTo() const { return to; }
+ AdcCommand& setTo(const uint32_t sid) { to = sid; return *this; }
+ uint32_t getFrom() const { return from; }
- static u_int32_t toSID(const string& aSID) { return *reinterpret_cast<const u_int32_t*>(aSID.data()); }
- static string fromSID(const u_int32_t aSID) { return string(reinterpret_cast<const char*>(&aSID), sizeof(aSID)); }
+ static uint32_t toSID(const string& aSID) { return *reinterpret_cast<const uint32_t*>(aSID.data()); }
+ static string fromSID(const uint32_t aSID) { return string(reinterpret_cast<const char*>(&aSID), sizeof(aSID)); }
private:
string getHeaderString(const CID& cid) const;
- string getHeaderString(u_int32_t sid, bool nmdc) const;
+ string getHeaderString(uint32_t sid, bool nmdc) const;
string getParamString(bool nmdc) const;
StringList parameters;
string features;
union {
char cmdChar[4];
- u_int8_t cmd[4];
- u_int32_t cmdInt;
+ uint8_t cmd[4];
+ uint32_t cmdInt;
};
- u_int32_t from;
- u_int32_t to;
+ uint32_t from;
+ uint32_t to;
char type;
};
Modified: dcplusplus/trunk/client/AdcHub.cpp
===================================================================
--- dcplusplus/trunk/client/AdcHub.cpp 2006-10-07 21:51:27 UTC (rev 665)
+++ dcplusplus/trunk/client/AdcHub.cpp 2006-10-08 19:59:43 UTC (rev 666)
@@ -48,7 +48,7 @@
clearUsers();
}
-OnlineUser& AdcHub::getUser(const u_int32_t aSID, const CID& aCID) {
+OnlineUser& AdcHub::getUser(const uint32_t aSID, const CID& aCID) {
OnlineUser* ou = findUser(aSID);
if(ou) {
return *ou;
@@ -62,17 +62,17 @@
}
if(aSID != AdcCommand::HUB_SID)
- ClientManager::getInstance()->putOnline(*ou);
+ ClientManager::getInstance()->putOnline(ou);
return *ou;
}
-OnlineUser* AdcHub::findUser(const u_int32_t aSID) const {
+OnlineUser* AdcHub::findUser(const uint32_t aSID) const {
Lock l(cs);
SIDMap::const_iterator i = users.find(aSID);
return i == users.end() ? NULL : i->second;
}
-void AdcHub::putUser(const u_int32_t aSID) {
+void AdcHub::putUser(const uint32_t aSID) {
OnlineUser* ou = 0;
{
Lock l(cs);
@@ -84,7 +84,7 @@
}
if(aSID != AdcCommand::HUB_SID)
- ClientManager::getInstance()->putOffline(*ou);
+ ClientManager::getInstance()->putOffline(ou);
fire(ClientListener::UserRemoved(), this, *ou);
delete ou;
@@ -99,12 +99,11 @@
for(SIDIter i = tmp.begin(); i != tmp.end(); ++i) {
if(i->first != AdcCommand::HUB_SID)
- ClientManager::getInstance()->putOffline(*i->second);
+ ClientManager::getInstance()->putOffline(i->second);
delete i->second;
}
}
-
void AdcHub::handle(AdcCommand::INF, AdcCommand& c) throw() {
if(c.getParameters().empty())
return;
@@ -386,7 +385,7 @@
}
void AdcHub::connect(const OnlineUser& user) {
- u_int32_t r = Util::rand();
+ uint32_t r = Util::rand();
connect(user, Util::toString(r), CryptoManager::getInstance()->TLSOk() && user.getUser()->isSet(User::TLS));
}
@@ -460,7 +459,7 @@
return;
if(!salt.empty()) {
size_t saltBytes = salt.size() * 5 / 8;
- AutoArray<u_int8_t> buf(saltBytes);
+ AutoArray<uint8_t> buf(saltBytes);
Encoder::fromBase32(salt.c_str(), buf, saltBytes);
TigerHash th;
CID cid = getMyIdentity().getUser()->getCID();
@@ -568,7 +567,7 @@
string AdcHub::checkNick(const string& aNick) {
string tmp = aNick;
for(size_t i = 0; i < aNick.size(); ++i) {
- if(static_cast<u_int8_t>(tmp[i]) <= 32) {
+ if(static_cast<uint8_t>(tmp[i]) <= 32) {
tmp[i] = '_';
}
}
@@ -607,7 +606,7 @@
send(cmd.toString(sid));
}
-void AdcHub::on(Second, u_int32_t aTick) throw() {
+void AdcHub::on(Second, uint32_t aTick) throw() {
if(getAutoReconnect() && state == STATE_PROTOCOL && (getReconnecting() || ((getLastActivity() + getReconnDelay() * 1000) < aTick)) ) {
// Try to reconnect...
connect();
Modified: dcplusplus/trunk/client/AdcHub.h
===================================================================
--- dcplusplus/trunk/client/AdcHub.h 2006-10-07 21:51:27 UTC (rev 665)
+++ dcplusplus/trunk/client/AdcHub.h 2006-10-08 19:59:43 UTC (rev 666)
@@ -70,7 +70,7 @@
virtual ~AdcHub() throw();
/** Map session id to OnlineUser */
- typedef HASH_MAP<u_int32_t, OnlineUser*> SIDMap;
+ typedef HASH_MAP<uint32_t, OnlineUser*> SIDMap;
typedef SIDMap::iterator SIDIter;
Socket udp;
@@ -80,7 +80,7 @@
string salt;
- u_int32_t sid;
+ uint32_t sid;
bool reconnect;
static const string CLIENT_PROTOCOL;
@@ -91,9 +91,9 @@
virtual string checkNick(const string& nick);
- OnlineUser& getUser(const u_int32_t aSID, const CID& aCID);
- OnlineUser* findUser(const u_int32_t sid) const;
- void putUser(const u_int32_t sid);
+ OnlineUser& getUser(const uint32_t aSID, const CID& aCID);
+ OnlineUser* findUser(const uint32_t sid) const;
+ void putUser(const uint32_t sid);
void clearUsers();
@@ -121,7 +121,7 @@
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();
+ virtual void on(Second, uint32_t aTick) throw();
};
#endif // !defined(ADC_HUB_H)
Modified: dcplusplus/trunk/client/BitInputStream.h
===================================================================
--- dcplusplus/trunk/client/BitInputStream.h 2006-10-07 21:51:27 UTC (rev 665)
+++ dcplusplus/trunk/client/BitInputStream.h 2006-10-08 19:59:43 UTC (rev 666)
@@ -35,14 +35,14 @@
class BitInputStream
{
public:
- BitInputStream(const u_int8_t* aStream, size_t aStart, size_t aEnd) : bitPos(aStart*8), endPos(aEnd*8), is(aStream) { }
+ BitInputStream(const uint8_t* aStream, size_t aStart, size_t aEnd) : bitPos(aStart*8), endPos(aEnd*8), is(aStream) { }
~BitInputStream() { }
bool get() throw(BitStreamException) {
if(bitPos > endPos) {
throw BitStreamException(STRING(SEEK_BEYOND_END));
}
- bool ret = (((u_int8_t)is[bitPos>>3]) >> (bitPos&0x07)) & 0x01;
+ bool ret = (((uint8_t)is[bitPos>>3]) >> (bitPos&0x07)) & 0x01;
bitPos++;
return ret;
}
@@ -62,7 +62,7 @@
size_t bitPos;
size_t endPos;
- const u_int8_t* is;
+ const uint8_t* is;
};
#endif // !defined(BIT_INPUT_STREAM_H)
Modified: dcplusplus/trunk/client/BitOutputStream.h
===================================================================
--- dcplusplus/trunk/client/BitOutputStream.h 2006-10-07 21:51:27 UTC (rev 665)
+++ dcplusplus/trunk/client/BitOutputStream.h 2006-10-08 19:59:43 UTC (rev 666)
@@ -29,8 +29,8 @@
BitOutputStream(string& aStream) : is(aStream), bitPos(0), next(0) { }
~BitOutputStream() { }
- void put(vector<u_int8_t>& b) {
- for(vector<u_int8_t>::iterator i = b.begin(); i != b.end(); ++i) {
+ void put(vector<uint8_t>& b) {
+ for(vector<uint8_t>::iterator i = b.begin(); i != b.end(); ++i) {
next |= (*i) << bitPos++;
if(bitPos > 7) {
@@ -54,7 +54,7 @@
BitOutputStream& operator=(const BitOutputStream&);
string& is;
int bitPos;
- u_int8_t next;
+ uint8_t next;
};
#endif // !defined(BIT_OUTPUT_STREAM_H)
Modified: dcplusplus/trunk/client/BufferedSocket.cpp
===================================================================
--- dcplusplus/trunk/client/BufferedSocket.cpp 2006-10-07 21:51:27 UTC (rev 665)
+++ dcplusplus/trunk/client/BufferedSocket.cpp 2006-10-08 19:59:43 UTC (rev 666)
@@ -136,7 +136,7 @@
return;
fire(BufferedSocketListener::Connecting());
- u_int32_t startTime = GET_TICK();
+ uint32_t startTime = GET_TICK();
if(proxy) {
sock->socksConnect(aAddr, aPort, CONNECT_TIMEOUT);
} else {
@@ -180,7 +180,7 @@
const int BufSize = 1024;
// Special to autodetect nmdc connections...
string::size_type pos = 0;
- AutoArray<u_int8_t> buffer (BufSize);
+ AutoArray<uint8_t> buffer (BufSize);
size_t in;
l = line;
// decompress all input data and store in l.
@@ -269,8 +269,8 @@
size_t sockSize = (size_t)sock->getSocketOptInt(SO_SNDBUF);
size_t bufSize = max(sockSize, (size_t)64*1024);
- vector<u_int8_t> readBuf(bufSize);
- vector<u_int8_t> writeBuf(bufSize);
+ vector<uint8_t> readBuf(bufSize);
+ vector<uint8_t> writeBuf(bufSize);
size_t readPos = 0;
Modified: dcplusplus/trunk/client/BufferedSocket.h
===================================================================
--- dcplusplus/trunk/client/BufferedSocket.h 2006-10-07 21:51:27 UTC (rev 665)
+++ dcplusplus/trunk/client/BufferedSocket.h 2006-10-08 19:59:43 UTC (rev 666)
@@ -51,7 +51,7 @@
virtual void on(Connecting) throw() { }
virtual void on(Connected) throw() { }
virtual void on(Line, const string&) throw() { }
- virtual void on(Data, u_int8_t*, size_t) throw() { }
+ virtual void on(Data, uint8_t*, size_t) throw() { }
virtual void on(BytesSent, size_t, size_t) throw() { }
virtual void on(ModeChange) throw() { }
virtual void on(TransmitDone) throw() { }
@@ -158,9 +158,9 @@
size_t rollback;
bool failed;
string line;
- vector<u_int8_t> inbuf;
- vector<u_int8_t> writeBuf;
- vector<u_int8_t> sendBuf;
+ vector<uint8_t> inbuf;
+ vector<uint8_t> writeBuf;
+ vector<uint8_t> sendBuf;
Socket* sock;
bool disconnecting;
Modified: dcplusplus/trunk/client/CID.h
===================================================================
--- dcplusplus/trunk/client/CID.h 2006-10-07 21:51:27 UTC (rev 665)
+++ dcplusplus/trunk/client/CID.h 2006-10-08 19:59:43 UTC (rev 666)
@@ -34,7 +34,7 @@
size_t operator()(const CID& c) const { return c.toHash(); }
};
CID() { memset(cid, 0, sizeof(cid)); }
- explicit CID(const u_int8_t* data) { memcpy(cid, data, sizeof(cid)); }
+ explicit CID(const uint8_t* data) { memcpy(cid, data, sizeof(cid)); }
explicit CID(const string& base32) { Encoder::fromBase32(base32.c_str(), cid, sizeof(cid)); }
bool operator==(const CID& rhs) const { return memcmp(cid, rhs.cid, sizeof(cid)) == 0; }
@@ -44,20 +44,20 @@
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* data() const { return cid; }
+ const uint8_t* data() const { return cid; }
- bool isZero() const { return find_if(cid, cid+SIZE, bind2nd(not_equal_to<u_int8_t>(), 0)) == (cid+SIZE); }
+ bool isZero() const { return find_if(cid, cid+SIZE, bind2nd(not_equal_to<uint8_t>(), 0)) == (cid+SIZE); }
static CID generate() {
- u_int8_t data[CID::SIZE];
+ uint8_t data[CID::SIZE];
for(size_t i = 0; i < sizeof(data); ++i) {
- data[i] = (u_int8_t)Util::rand();
+ data[i] = (uint8_t)Util::rand();
}
return CID(data);
}
private:
- u_int8_t cid[SIZE];
+ uint8_t cid[SIZE];
};
#endif // !defined(CID_H)
Modified: dcplusplus/trunk/client/Client.cpp
===================================================================
--- dcplusplus/trunk/client/Client.cpp 2006-10-07 21:51:27 UTC (rev 665)
+++ dcplusplus/trunk/client/Client.cpp 2006-10-08 19:59:43 UTC (rev 666)
@@ -166,5 +166,5 @@
return lip;
}
-void Client::on(Second, u_int32_t) throw() {
+void Client::on(Second, uint32_t) throw() {
}
Modified: dcplusplus/trunk/client/Client.h
===================================================================
--- dcplusplus/trunk/client/Client.h 2006-10-07 21:51:27 UTC (rev 665)
+++ dcplusplus/trunk/client/Client.h 2006-10-08 19:59:43 UTC (rev 666)
@@ -149,8 +149,8 @@
GETSET(Identity, hubIdentity, HubIdentity);
GETSET(string, defpassword, Password);
- GETSET(u_int32_t, reconnDelay, ReconnDelay);
- GETSET(u_int32_t, lastActivity, LastActivity);
+ GETSET(uint32_t, reconnDelay, ReconnDelay);
+ GETSET(uint32_t, lastActivity, LastActivity);
GETSET(bool, registered, Registered);
GETSET(bool, autoReconnect, AutoReconnect);
GETSET(bool, reconnecting, Reconnecting);
@@ -183,7 +183,7 @@
virtual string checkNick(const string& nick) = 0;
// TimerManagerListener
- virtual void on(Second, u_int32_t aTick) throw();
+ virtual void on(Second, uint32_t aTick) throw();
private:
@@ -200,7 +200,7 @@
string hubUrl;
string address;
string ip;
- u_int16_t port;
+ uint16_t port;
char separator;
bool secure;
CountType countType;
Modified: dcplusplus/trunk/client/ClientManager.cpp
===================================================================
--- dcplusplus/trunk/client/ClientManager.cpp 2006-10-07 21:51:27 UTC (rev 665)
+++ dcplusplus/trunk/client/ClientManager.cpp 2006-10-08 19:59:43 UTC (rev 666)
@@ -33,7 +33,6 @@
#include "AdcHub.h"
#include "NmdcHub.h"
-
Client* ClientManager::getClient(const string& aHubURL) {
Client* c;
if(Util::strnicmp("adc://", aHubURL.c_str(), 6) == 0) {
@@ -67,41 +66,41 @@
delete aClient;
}
-size_t ClientManager::getUserCount() {
+size_t ClientManager::getUserCount() const {
Lock l(cs);
return onlineUsers.size();
}
-StringList ClientManager::getHubs(const CID& cid) {
+StringList ClientManager::getHubs(const CID& cid) const {
Lock l(cs);
StringList lst;
- OnlinePair op = onlineUsers.equal_range(cid);
- for(OnlineIter i = op.first; i != op.second; ++i) {
+ OnlinePairC op = onlineUsers.equal_range(cid);
+ for(OnlineIterC i = op.first; i != op.second; ++i) {
lst.push_back(i->second->getClient().getHubUrl());
}
return lst;
}
-StringList ClientManager::getHubNames(const CID& cid) {
+StringList ClientManager::getHubNames(const CID& cid) const {
Lock l(cs);
StringList lst;
- OnlinePair op = onlineUsers.equal_range(cid);
- for(OnlineIter i = op.first; i != op.second; ++i) {
+ OnlinePairC op = onlineUsers.equal_range(cid);
+ for(OnlineIterC i = op.first; i != op.second; ++i) {
lst.push_back(i->second->getClient().getHubName());
}
return lst;
}
-StringList ClientManager::getNicks(const CID& cid) {
+StringList ClientManag...
[truncated message content] |
|
From: <arn...@us...> - 2006-10-10 06:36:56
|
Revision: 669
http://svn.sourceforge.net/dcplusplus/?rev=669&view=rev
Author: arnetheduck
Date: 2006-10-09 23:36:40 -0700 (Mon, 09 Oct 2006)
Log Message:
-----------
lockup fix
Modified Paths:
--------------
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/client/AdcCommand.h
dcplusplus/trunk/client/ConnectionManager.h
dcplusplus/trunk/client/FavoriteManager.cpp
dcplusplus/trunk/client/QueueManager.cpp
dcplusplus/trunk/windows/HubFrame.cpp
dcplusplus/trunk/windows/HubFrame.h
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2006-10-08 22:22:19 UTC (rev 668)
+++ dcplusplus/trunk/changelog.txt 2006-10-10 06:36:40 UTC (rev 669)
@@ -12,6 +12,8 @@
* Removed unmaintained autoconf files
* Reworked match listing to make it slightly faster
* Fixed a few random crashes
+* [ADC] Removed obsolete DSC command
+* Fixed user list not being updated in some cases
-- 0.697 2006-09-29 --
* [ADC] Fixed a few protocol issues
Modified: dcplusplus/trunk/client/AdcCommand.h
===================================================================
--- dcplusplus/trunk/client/AdcCommand.h 2006-10-08 22:22:19 UTC (rev 668)
+++ dcplusplus/trunk/client/AdcCommand.h 2006-10-10 06:36:40 UTC (rev 669)
@@ -98,7 +98,6 @@
C(GPA, 'G','P','A');
C(PAS, 'P','A','S');
C(QUI, 'Q','U','I');
- C(DSC, 'D','S','C');
C(GET, 'G','E','T');
C(GFI, 'G','F','I');
C(SND, 'S','N','D');
@@ -190,7 +189,6 @@
C(GPA);
C(PAS);
C(QUI);
- C(DSC);
C(GET);
C(GFI);
C(SND);
Modified: dcplusplus/trunk/client/ConnectionManager.h
===================================================================
--- dcplusplus/trunk/client/ConnectionManager.h 2006-10-08 22:22:19 UTC (rev 668)
+++ dcplusplus/trunk/client/ConnectionManager.h 2006-10-10 06:36:40 UTC (rev 669)
@@ -70,7 +70,7 @@
expectedConnections.insert(make_pair(aNick, make_pair(aMyNick, aHubUrl)));
}
- pair<string, string> remove(const string& aNick) {
+ StringPair remove(const string& aNick) {
Lock l(cs);
ExpectMap::iterator i = expectedConnections.find(aNick);
Modified: dcplusplus/trunk/client/FavoriteManager.cpp
===================================================================
--- dcplusplus/trunk/client/FavoriteManager.cpp 2006-10-08 22:22:19 UTC (rev 668)
+++ dcplusplus/trunk/client/FavoriteManager.cpp 2006-10-10 06:36:40 UTC (rev 669)
@@ -404,12 +404,6 @@
addUserCommand(UserCommand::TYPE_RAW_ONCE, UserCommand::CONTEXT_CHAT | UserCommand::CONTEXT_SEARCH, UserCommand::FLAG_NOSAVE,
STRING(REDIRECT_USER), redirstr, "op");
- // Add ADC standard op commands
- static const char adc_disconnectstr[] =
- "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());
Modified: dcplusplus/trunk/client/QueueManager.cpp
===================================================================
--- dcplusplus/trunk/client/QueueManager.cpp 2006-10-08 22:22:19 UTC (rev 668)
+++ dcplusplus/trunk/client/QueueManager.cpp 2006-10-10 06:36:40 UTC (rev 669)
@@ -633,7 +633,11 @@
continue;
TTHMap::iterator j = tthMap.find(qi->getTTH());
if(j != tthMap.end() && i->second->getSize() == qi->getSize()) {
- addSource(qi, dl.getUser(), QueueItem::Source::FLAG_FILE_NOT_AVAILABLE);
+ try {
+ addSource(qi, dl.getUser(), QueueItem::Source::FLAG_FILE_NOT_AVAILABLE);
+ } catch(...) {
+ // Ignore...
+ }
matches++;
}
}
Modified: dcplusplus/trunk/windows/HubFrame.cpp
===================================================================
--- dcplusplus/trunk/windows/HubFrame.cpp 2006-10-08 22:22:19 UTC (rev 668)
+++ dcplusplus/trunk/windows/HubFrame.cpp 2006-10-10 06:36:40 UTC (rev 669)
@@ -1207,7 +1207,7 @@
}
}
-void HubFrame::on(Second, DWORD /*aTick*/) throw() {
+void HubFrame::on(Second, uint32_t /*aTick*/) throw() {
updateStatusBar();
if(updateUsers) {
updateUsers = false;
Modified: dcplusplus/trunk/windows/HubFrame.h
===================================================================
--- dcplusplus/trunk/windows/HubFrame.h 2006-10-08 22:22:19 UTC (rev 668)
+++ dcplusplus/trunk/windows/HubFrame.h 2006-10-10 06:36:40 UTC (rev 669)
@@ -375,7 +375,7 @@
void updateStatusBar() { if(m_hWnd) speak(STATS); }
// TimerManagerListener
- virtual void on(TimerManagerListener::Second, DWORD /*aTick*/) throw();
+ virtual void on(TimerManagerListener::Second, uint32_t /*aTick*/) throw();
// ClientListener
virtual void on(Connecting, Client*) throw();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <arn...@us...> - 2006-10-10 10:16:41
|
Revision: 672
http://svn.sourceforge.net/dcplusplus/?rev=672&view=rev
Author: arnetheduck
Date: 2006-10-10 03:16:29 -0700 (Tue, 10 Oct 2006)
Log Message:
-----------
patches
Modified Paths:
--------------
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/client/DownloadManager.cpp
dcplusplus/trunk/client/HashManager.cpp
dcplusplus/trunk/client/HashManager.h
dcplusplus/trunk/windows/HubFrame.cpp
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2006-10-10 08:45:25 UTC (rev 671)
+++ dcplusplus/trunk/changelog.txt 2006-10-10 10:16:29 UTC (rev 672)
@@ -14,6 +14,7 @@
* Fixed a few random crashes
* [ADC] Removed obsolete DSC command
* Fixed user list not being updated in some cases
+* [bug 1071] Added fasthash for unix (thanks steven sheehy)
-- 0.697 2006-09-29 --
* [ADC] Fixed a few protocol issues
Modified: dcplusplus/trunk/client/DownloadManager.cpp
===================================================================
--- dcplusplus/trunk/client/DownloadManager.cpp 2006-10-10 08:45:25 UTC (rev 671)
+++ dcplusplus/trunk/client/DownloadManager.cpp 2006-10-10 10:16:29 UTC (rev 672)
@@ -67,11 +67,11 @@
AdcCommand Download::getCommand(bool zlib) {
AdcCommand cmd(AdcCommand::CMD_GET);
if(isSet(FLAG_TREE_DOWNLOAD)) {
- cmd.addParam("tthl");
+ cmd.addParam(Transfer::TYPE_TTHL);
} else if(isSet(FLAG_PARTIAL_LIST)) {
- cmd.addParam("list");
+ cmd.addParam(Transfer::TYPE_LIST);
} else {
- cmd.addParam("file");
+ cmd.addParam(Transfer::TYPE_FILE);
}
if(isSet(FLAG_PARTIAL_LIST) || isSet(FLAG_USER_LIST)) {
cmd.addParam(Util::toAdcFile(getSource()));
@@ -436,8 +436,8 @@
const string& type = cmd.getParam(0);
int64_t bytes = Util::toInt64(cmd.getParam(3));
- if(!(type == "file" || (type == "tthl" && aSource->getDownload()->isSet(Download::FLAG_TREE_DOWNLOAD)) ||
- (type == "list" && aSource->getDownload()->isSet(Download::FLAG_PARTIAL_LIST))) )
+ if(!(type == Transfer::TYPE_FILE || (type == Transfer::TYPE_TTHL && aSource->getDownload()->isSet(Download::FLAG_TREE_DOWNLOAD)) ||
+ (type == Transfer::TYPE_LIST && aSource->getDownload()->isSet(Download::FLAG_PARTIAL_LIST))) )
{
// Uhh??? We didn't ask for this?
aSource->disconnect();
Modified: dcplusplus/trunk/client/HashManager.cpp
===================================================================
--- dcplusplus/trunk/client/HashManager.cpp 2006-10-10 08:45:25 UTC (rev 671)
+++ dcplusplus/trunk/client/HashManager.cpp 2006-10-10 10:16:29 UTC (rev 672)
@@ -27,6 +27,10 @@
#include "ZUtils.h"
#include "SFVReader.h"
+#ifndef _WIN32
+#include <sys/mman.h> // mmap, munmap, madvise
+#endif
+
#define HASH_FILE_VERSION_STRING "2"
static const uint32_t HASH_FILE_VERSION=2;
const int64_t HashManager::MIN_BLOCK_SIZE = 64*1024;
@@ -442,8 +446,6 @@
}
}
-#define BUF_SIZE (256*1024)
-
void HashManager::Hasher::hashFile(const string& fileName, int64_t size) {
Lock l(cs);
if(w.insert(make_pair(fileName, size)).second) {
@@ -476,6 +478,8 @@
}
#ifdef _WIN32
+#define BUF_SIZE (256*1024)
+
bool HashManager::Hasher::fastHash(const string& fname, uint8_t* buf, TigerTree& tth, int64_t size, CRC32Filter* xcrc32) {
HANDLE h = INVALID_HANDLE_VALUE;
DWORD x, y;
@@ -580,8 +584,70 @@
::CloseHandle(h);
return ok;
}
-#endif
+#else // !_WIN32
+
+static const int64_t BUF_SIZE = 0x1000000 - (0x1000000 % getpagesize());
+
+bool HashManager::Hasher::fastHash(const string& filename, u_int8_t* , TigerTree& tth, int64_t size, CRC32Filter* xcrc32) {
+ int fd = open(filename.c_str(), O_RDONLY);
+ if(fd == -1)
+ return false;
+
+ int64_t size_left = size;
+ int64_t pos = 0;
+ int64_t size_read = 0;
+ void *buf = 0;
+
+ u_int32_t lastRead = GET_TICK();
+ while(pos <= size) {
+ if(size_left > 0) {
+ size_read = std::min(size_left, BUF_SIZE);
+ buf = mmap(0, size_read, PROT_READ, MAP_SHARED, fd, pos);
+ if(buf == MAP_FAILED) {
+ close(fd);
+ return false;
+ }
+
+ madvise(buf, size_read, MADV_SEQUENTIAL | MADV_WILLNEED);
+
+ if(SETTING(MAX_HASH_SPEED) > 0) {
+ u_int32_t now = GET_TICK();
+ u_int32_t minTime = size_read * 1000LL / (SETTING(MAX_HASH_SPEED) * 1024LL * 1024LL);
+ if(lastRead + minTime > now) {
+ u_int32_t diff = now - lastRead;
+ Thread::sleep(minTime - diff);
+ }
+ lastRead = lastRead + minTime;
+ } else {
+ lastRead = GET_TICK();
+ }
+ } else {
+ size_read = 0;
+ }
+
+ tth.update(buf, size_read);
+ if(xcrc32)
+ (*xcrc32)(buf, size_read);
+ {
+ Lock l(cs);
+ currentSize = max(static_cast<u_int64_t>(currentSize - size_read), static_cast<u_int64_t>(0));
+ }
+
+ if(size_left <= 0) {
+ break;
+ }
+
+ munmap(buf, size_read);
+ pos += size_read;
+ size_left -= size_read;
+ }
+ close(fd);
+ return true;
+}
+
+#endif // !_WIN32
+
int HashManager::Hasher::run() {
setThreadPriority(Thread::IDLE);
@@ -642,13 +708,15 @@
xcrc32 = &crc32;
size_t n = 0;
-#ifdef _WIN32
TigerTree fastTTH(bs);
tth = &fastTTH;
+#ifdef _WIN32
if(!virtualBuf || !BOOLSETTING(FAST_HASH) || !fastHash(fname, buf, fastTTH, size, xcrc32)) {
+#else
+ if(!BOOLSETTING(FAST_HASH) || !fastHash(fname, 0, fastTTH, size, xcrc32)) {
+#endif
tth = &slowTTH;
crc32 = CRC32Filter();
-#endif
uint32_t lastRead = GET_TICK();
do {
@@ -673,11 +741,10 @@
}
sizeLeft -= n;
} while (n > 0 && !stop);
-#ifdef _WIN32
} else {
sizeLeft = 0;
}
-#endif
+
f.close();
tth->finalize();
uint32_t end = GET_TICK();
@@ -706,7 +773,7 @@
VirtualFree(buf, 0, MEM_RELEASE);
#endif
} else {
- delete buf;
+ delete [] buf;
}
buf = NULL;
}
Modified: dcplusplus/trunk/client/HashManager.h
===================================================================
--- dcplusplus/trunk/client/HashManager.h 2006-10-10 08:45:25 UTC (rev 671)
+++ dcplusplus/trunk/client/HashManager.h 2006-10-10 10:16:29 UTC (rev 672)
@@ -113,9 +113,7 @@
void stopHashing(const string& baseDir);
virtual int run();
-#ifdef _WIN32
bool fastHash(const string& fname, uint8_t* buf, TigerTree& tth, int64_t size, CRC32Filter* xcrc32);
-#endif
void getStats(string& curFile, int64_t& bytesLeft, size_t& filesLeft);
void shutdown() { stop = true; s.signal(); }
void scheduleRebuild() { rebuild = true; s.signal(); }
Modified: dcplusplus/trunk/windows/HubFrame.cpp
===================================================================
--- dcplusplus/trunk/windows/HubFrame.cpp 2006-10-10 08:45:25 UTC (rev 671)
+++ dcplusplus/trunk/windows/HubFrame.cpp 2006-10-10 10:16:29 UTC (rev 672)
@@ -481,7 +481,9 @@
TaskQueue::List t;
tasks.get(t);
- ctrlUsers.SetRedraw(FALSE);
+ if(t.size() > 2) {
+ ctrlUsers.SetRedraw(FALSE);
+ }
for(TaskQueue::Iter i = t.begin(); i != t.end(); ++i) {
if(i->first == UPDATE_USER) {
@@ -575,7 +577,9 @@
resort = false;
}
- ctrlUsers.SetRedraw(TRUE);
+ if(t.size() > 2) {
+ ctrlUsers.SetRedraw(TRUE);
+ }
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <arn...@us...> - 2006-10-10 14:44:52
|
Revision: 673
http://svn.sourceforge.net/dcplusplus/?rev=673&view=rev
Author: arnetheduck
Date: 2006-10-10 07:44:41 -0700 (Tue, 10 Oct 2006)
Log Message:
-----------
version update
Modified Paths:
--------------
dcplusplus/trunk/DCPlusPlus.rc
dcplusplus/trunk/Example.xml
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/client/version.h
Modified: dcplusplus/trunk/DCPlusPlus.rc
===================================================================
--- dcplusplus/trunk/DCPlusPlus.rc 2006-10-10 10:16:29 UTC (rev 672)
+++ dcplusplus/trunk/DCPlusPlus.rc 2006-10-10 14:44:41 UTC (rev 673)
@@ -942,8 +942,8 @@
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,6,9,7
- PRODUCTVERSION 0,6,9,7
+ FILEVERSION 0,6,9,8
+ PRODUCTVERSION 0,6,9,8
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -960,12 +960,12 @@
BEGIN
VALUE "Comments", "http://dcplusplus.sourceforge.net"
VALUE "FileDescription", "DC++"
- VALUE "FileVersion", "0, 6, 9, 7"
+ VALUE "FileVersion", "0, 6, 9, 8"
VALUE "InternalName", "DC++"
VALUE "LegalCopyright", "Copyright 2001-2006 Jacek Sieka"
VALUE "OriginalFilename", "DCPlusPlus.exe"
VALUE "ProductName", "DC++"
- VALUE "ProductVersion", "0, 6, 9, 7"
+ VALUE "ProductVersion", "0, 6, 9, 8"
END
END
BLOCK "VarFileInfo"
Modified: dcplusplus/trunk/Example.xml
===================================================================
--- dcplusplus/trunk/Example.xml 2006-10-10 10:16:29 UTC (rev 672)
+++ dcplusplus/trunk/Example.xml 2006-10-10 14:44:41 UTC (rev 673)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<Language Name="Example Language" Native="English" Code="en" Author="arnetheduck" Version="0.697" Revision="1" RightToLeft="0">
+<Language Name="Example Language" Native="English" Code="en" Author="arnetheduck" Version="0.698" 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-10-10 10:16:29 UTC (rev 672)
+++ dcplusplus/trunk/changelog.txt 2006-10-10 14:44:41 UTC (rev 673)
@@ -1,4 +1,4 @@
--- --
+-- 0.698 --
* [bug 1065] Code cleanup (thanks steven sheehy)
* Fixed readme.txt (thanks ullner)
* More code cleanup
Modified: dcplusplus/trunk/client/version.h
===================================================================
--- dcplusplus/trunk/client/version.h 2006-10-10 10:16:29 UTC (rev 672)
+++ dcplusplus/trunk/client/version.h 2006-10-10 14:44:41 UTC (rev 673)
@@ -17,7 +17,7 @@
*/
#define APPNAME "DC++"
-#define VERSIONSTRING "0.697"
-#define VERSIONFLOAT 0.697
+#define VERSIONSTRING "0.698"
+#define VERSIONFLOAT 0.698
/* Update the .rc file as well... */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <arn...@us...> - 2006-10-10 14:45:33
|
Revision: 674
http://svn.sourceforge.net/dcplusplus/?rev=674&view=rev
Author: arnetheduck
Date: 2006-10-10 07:45:20 -0700 (Tue, 10 Oct 2006)
Log Message:
-----------
changlog fix
Modified Paths:
--------------
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/help/changelog.html
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2006-10-10 14:44:41 UTC (rev 673)
+++ dcplusplus/trunk/changelog.txt 2006-10-10 14:45:20 UTC (rev 674)
@@ -1,4 +1,4 @@
--- 0.698 --
+-- 0.698 2006-10-10 --
* [bug 1065] Code cleanup (thanks steven sheehy)
* Fixed readme.txt (thanks ullner)
* More code cleanup
Modified: dcplusplus/trunk/help/changelog.html
===================================================================
--- dcplusplus/trunk/help/changelog.html 2006-10-10 14:44:41 UTC (rev 673)
+++ dcplusplus/trunk/help/changelog.html 2006-10-10 14:45:20 UTC (rev 674)
@@ -13,6 +13,26 @@
<h1>DC++ Changelog</h1>
See the version history of DC++ below.
+<h2>0.698 <span style="color: gray;">(2006-10-10)</span></h2>
+<ul>
+ <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=1065">[bug 1065]</a> Code cleanup (thanks steven sheehy)</li>
+ <li>Fixed readme.txt (thanks ullner)</li>
+ <li>More code cleanup</li>
+ <li>Fixed trusted/untrusted upload view</li>
+ <li>Fixed crash on invalid remote command during upload</li>
+ <li>[ADC] Improved GFI command support</li>
+ <li>Lowest priority downloads are no longer started if there are other downloads running</li>
+ <li>Upgraded to STLport 5.0.2</li>
+ <li>Updated compile instructions</li>
+ <li>Updated unsigned types to C99</li>
+ <li>Removed unmaintained autoconf files</li>
+ <li>Reworked match listing to make it slightly faster</li>
+ <li>Fixed a few random crashes</li>
+ <li>[ADC] Removed obsolete DSC command</li>
+ <li>Fixed user list not being updated in some cases</li>
+ <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=1071">[bug 1071]</a> Added fasthash for unix (thanks steven sheehy)</li>
+</ul>
+
<h2>0.697 <span style="color: gray;">(2006-09-29)</span></h2>
<ul>
<li>[ADC] Fixed a few protocol issues</li>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <arn...@us...> - 2006-10-14 15:52:40
|
Revision: 678
http://svn.sourceforge.net/dcplusplus/?rev=678&view=rev
Author: arnetheduck
Date: 2006-10-14 08:52:30 -0700 (Sat, 14 Oct 2006)
Log Message:
-----------
Network page fix
Modified Paths:
--------------
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/windows/NetworkPage.cpp
dcplusplus/trunk/windows/UploadPage.cpp
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2006-10-14 14:57:33 UTC (rev 677)
+++ dcplusplus/trunk/changelog.txt 2006-10-14 15:52:30 UTC (rev 678)
@@ -4,6 +4,7 @@
* Antifrag is now default
* Confirm hub removal is now default
* SFV checking is now default
+* Fixed TLS port not being greyed out
-- 0.698 2006-10-10 --
* [bug 1065] Code cleanup (thanks steven sheehy)
Modified: dcplusplus/trunk/windows/NetworkPage.cpp
===================================================================
--- dcplusplus/trunk/windows/NetworkPage.cpp 2006-10-14 14:57:33 UTC (rev 677)
+++ dcplusplus/trunk/windows/NetworkPage.cpp 2006-10-14 15:52:30 UTC (rev 678)
@@ -161,6 +161,7 @@
::EnableWindow(GetDlgItem(IDC_PORT_TCP), direct || upnp || nat);
::EnableWindow(GetDlgItem(IDC_PORT_UDP), direct || upnp || nat);
+ ::EnableWindow(GetDlgItem(IDC_PORT_TLS), direct || upnp || nat);
BOOL socks = IsDlgButtonChecked(IDC_SOCKS5);
::EnableWindow(GetDlgItem(IDC_SOCKS_SERVER), socks);
Modified: dcplusplus/trunk/windows/UploadPage.cpp
===================================================================
--- dcplusplus/trunk/windows/UploadPage.cpp 2006-10-14 14:57:33 UTC (rev 677)
+++ dcplusplus/trunk/windows/UploadPage.cpp 2006-10-14 15:52:30 UTC (rev 678)
@@ -206,7 +206,7 @@
LineDlg virt;
virt.title = TSTRING(VIRTUAL_NAME);
virt.description = TSTRING(VIRTUAL_NAME_LONG);
- virt.line = tstring(buf);
+ virt.line = vName;
if(virt.DoModal(m_hWnd) == IDOK) {
if (Util::stricmp(buf, virt.line) != 0) {
ShareManager::getInstance()->renameDirectory(Text::fromT(rPath), Text::fromT(virt.line));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <arn...@us...> - 2006-10-15 19:06:30
|
Revision: 679
http://svn.sourceforge.net/dcplusplus/?rev=679&view=rev
Author: arnetheduck
Date: 2006-10-15 12:06:14 -0700 (Sun, 15 Oct 2006)
Log Message:
-----------
cleanup
Modified Paths:
--------------
dcplusplus/trunk/client/BloomFilter.h
dcplusplus/trunk/client/ShareManager.cpp
dcplusplus/trunk/client/ShareManager.h
Property Changed:
----------------
dcplusplus/trunk/
dcplusplus/trunk/help/
dcplusplus/trunk/yassl/
dcplusplus/trunk/yassl/taocrypt/
Property changes on: dcplusplus/trunk
___________________________________________________________________
Name: svn:ignore
- vc7
ADC*
App*
DCPlusPlus.aps
DCPlusPlus.ncb
DCPlusPlus.suo
+ vc7
ADC*
App*
DCPlusPlus.aps
DCPlusPlus.ncb
DCPlusPlus.suo
.*
*.vcproj.*
Modified: dcplusplus/trunk/client/BloomFilter.h
===================================================================
--- dcplusplus/trunk/client/BloomFilter.h 2006-10-14 15:52:30 UTC (rev 678)
+++ dcplusplus/trunk/client/BloomFilter.h 2006-10-15 19:06:14 UTC (rev 679)
@@ -38,14 +38,14 @@
~BloomFilter() { }
void add(const string& s) { xadd(s, N); }
- bool match(const StringList& s) {
+ bool match(const StringList& s) const {
for(StringList::const_iterator i = s.begin(); i != s.end(); ++i) {
if(!match(*i))
return false;
}
return true;
}
- bool match(const string& s) {
+ bool match(const string& s) const {
if(s.length() >= N) {
string::size_type l = s.length() - N;
for(string::size_type i = 0; i <= l; ++i) {
@@ -82,7 +82,7 @@
}
/* Same functionality, but the old one did not want to compile for some reason. */
- size_t getPos(const string& s, size_t i, size_t l) {
+ size_t getPos(const string& s, size_t i, size_t l) const {
HashFunc hf;
return (hf(&s[i], l) % table.size());
}
Modified: dcplusplus/trunk/client/ShareManager.cpp
===================================================================
--- dcplusplus/trunk/client/ShareManager.cpp 2006-10-14 15:52:30 UTC (rev 678)
+++ dcplusplus/trunk/client/ShareManager.cpp 2006-10-15 19:06:14 UTC (rev 679)
@@ -74,9 +74,58 @@
delete i->second;
}
-string ShareManager::toVirtual(const TTHValue& tth) throw(ShareException) {
+string ShareManager::Directory::getADCPath() const throw() {
+ if(!getParent())
+ return '/' + name + '/';
+ return getParent()->getADCPath() + name + '/';
+}
+
+string ShareManager::Directory::getFullName() const throw() {
+ if(!getParent())
+ return getName() + '\\';
+ return getParent()->getFullName() + getName() + '\\';
+}
+
+void ShareManager::Directory::addType(uint32_t type) throw() {
+ if(!hasType(type)) {
+ fileTypes |= (1 << type);
+ if(getParent())
+ getParent()->addType(type);
+ }
+}
+
+string ShareManager::Directory::getRealPath() const throw() {
+ if(getParent()) {
+ return getParent()->getRealPath() + PATH_SEPARATOR_STR + getName();
+ } else {
+ dcassert(ShareManager::getInstance()->getByVirtual(getName()) != ShareManager::getInstance()->directories.end());
+ return ShareManager::getInstance()->getByVirtual(getName())->first;
+ }
+}
+
+int64_t ShareManager::Directory::getSize() const throw() {
+ int64_t tmp = size;
+ for(Map::const_iterator i = directories.begin(); i != directories.end(); ++i)
+ tmp+=i->second->getSize();
+ return tmp;
+}
+
+size_t ShareManager::Directory::countFiles() const throw() {
+ size_t tmp = files.size();
+ for(Map::const_iterator i = directories.begin(); i != directories.end(); ++i)
+ tmp+=i->second->countFiles();
+ return tmp;
+}
+
+string ShareManager::toVirtual(const TTHValue& tth) const throw(ShareException) {
Lock l(cs);
- HashFileIter i = tthIndex.find(tth);
+ if(tth == bzXmlRoot) {
+ return Transfer::USER_LIST_NAME_BZ;
+ } else if(tth == xmlRoot) {
+ return Transfer::USER_LIST_NAME;
+ }
+
+ HashFileMap::const_iterator i = tthIndex.find(tth);
if(i != tthIndex.end()) {
return i->second->getADCPath();
} else {
@@ -94,24 +143,22 @@
string realFile;
Lock l(cs);
- Directory::File::Iter it;
- if(!checkFile(virtualFile, realFile, it)) {
- throw ShareException(UserConnection::FILE_NOT_AVAILABLE);
- }
- return realFile;
+ return findFile(virtualFile)->getRealPath();
}
}
-TTHValue ShareManager::getTTH(const string& virtualFile) throw(ShareException) {
+TTHValue ShareManager::getTTH(const string& virtualFile) const throw(ShareException) {
Lock l(cs);
- string realFile;
- Directory::File::Iter it;
- if(!checkFile(virtualFile, realFile, it))
- throw ShareException();
- return it->getTTH();
+ if(virtualFile == Transfer::USER_LIST_NAME_BZ) {
+ return bzXmlRoot;
+ } else if(virtualFile == Transfer::USER_LIST_NAME) {
+ return xmlRoot;
+ }
+
+ return findFile(virtualFile)->getTTH();
}
-MemoryInputStream* ShareManager::getTree(const string& virtualFile) {
+MemoryInputStream* ShareManager::getTree(const string& virtualFile) const {
TigerTree tree;
if(virtualFile.compare(0, 4, "TTH/") == 0) {
if(!HashManager::getInstance()->getTree(TTHValue(virtualFile.substr(4)), tree))
@@ -165,52 +212,48 @@
return cmd;
}
-bool ShareManager::checkFile(const string& virtualFile, string& realFile, Directory::File::Iter& it) throw(ShareException) {
- string file;
+ShareManager::Directory::File::Set::const_iterator ShareManager::findFile(const string& virtualFile) const throw(ShareException) {
if(virtualFile.compare(0, 4, "TTH/") == 0) {
- file = toVirtual(TTHValue(virtualFile.substr(4)));
+ HashFileMap::const_iterator i = tthIndex.find(TTHValue(virtualFile.substr(4)));
+ if(i == tthIndex.end()) {
+ throw ShareException(UserConnection::FILE_NOT_AVAILABLE);
+ }
+ return i->second;
} else if(virtualFile.empty() || virtualFile[0] != '/') {
- return false;
- } else {
- file = virtualFile;
+ throw ShareException(UserConnection::FILE_NOT_AVAILABLE);
}
- string::size_type i = file.find('/', 1);
+
+ string::size_type i = virtualFile.find('/', 1);
if(i == string::npos || i == 1) {
return false;
}
- string virtualName = file.substr(1, i-1);
- Directory::MapIter dmi = getByVirtual(virtualName);
+ string virtualName = virtualFile.substr(1, i-1);
+ Directory::Map::const_iterator dmi = getByVirtual(virtualName);
if(dmi == directories.end()) {
- return false;
+ throw ShareException(UserConnection::FILE_NOT_AVAILABLE);
}
Directory* d = dmi->second;
- file = file.substr(i + 1);
+ string file = virtualFile.substr(i + 1);
string::size_type j = 0;
while( (i = file.find('/', j)) != string::npos) {
Directory::MapIter mi = d->directories.find(file.substr(j, i-j));
j = i + 1;
if(mi == d->directories.end())
- return false;
+ throw ShareException(UserConnection::FILE_NOT_AVAILABLE);
d = mi->second;
}
- it = find_if(d->files.begin(), d->files.end(), Directory::File::StringComp(file.substr(j)));
+ Directory::File::Set::const_iterator it = find_if(d->files.begin(), d->files.end(), Directory::File::StringComp(file.substr(j)));
if(it == d->files.end())
- return false;
-
-#ifdef _WIN32
- replace_if(file.begin(), file.end(), bind2nd(equal_to<char>(), '/'), '\\');
-#endif
-
- realFile = dmi->first + file;
- return true;
+ throw ShareException(UserConnection::FILE_NOT_AVAILABLE);
+ return it;
}
-string ShareManager::validateVirtual(const string& aVirt) {
+string ShareManager::validateVirtual(const string& aVirt) const throw() {
string tmp = aVirt;
string::size_type idx = 0;
@@ -220,7 +263,7 @@
return tmp;
}
-bool ShareManager::hasVirtual(const string& virtualName) {
+bool ShareManager::hasVirtual(const string& virtualName) const throw() {
return getByVirtual(virtualName) != directories.end();
}
@@ -247,11 +290,18 @@
}
}
+
+static const string SDIRECTORY = "Directory";
+static const string SFILE = "File";
+static const string SNAME = "Name";
+static const string SSIZE = "Size";
+static const string STTH = "TTH";
+
struct ShareLoader : public SimpleXMLReader::CallBack {
ShareLoader(ShareManager::Directory::Map& aDirs) : dirs(aDirs), cur(0), depth(0) { }
virtual void startTag(const string& name, StringPairList& attribs, bool simple) {
- if(name == "Directory") {
- const string& name = getAttrib(attribs, "Name", 0);
+ if(name == SDIRECTORY) {
+ const string& name = getAttrib(attribs, SNAME, 0);
if(!name.empty()) {
if(depth == 0) {
for(ShareManager::Directory::MapIter i = dirs.begin(); i != dirs.end(); ++i) {
@@ -274,10 +324,10 @@
} else {
depth++;
}
- } else if(cur && name == "File") {
- const string& fname = getAttrib(attribs, "Name", 0);
- const string& size = getAttrib(attribs, "Size", 1);
- const string& root = getAttrib(attribs, "TTH", 2);
+ } else if(cur && name == SFILE) {
+ const string& fname = getAttrib(attribs, SNAME, 0);
+ const string& size = getAttrib(attribs, SSIZE, 1);
+ const string& root = getAttrib(attribs, STTH, 2);
if(fname.empty() || size.empty() || (root.size() != 39)) {
dcdebug("Invalid file found: %s\n", fname.c_str());
return;
@@ -286,7 +336,7 @@
}
}
virtual void endTag(const string& name, const string&) {
- if(name == "Directory") {
+ if(name == SDIRECTORY) {
depth--;
if(cur) {
cur = cur->getParent();
@@ -301,7 +351,7 @@
size_t depth;
};
-bool ShareManager::loadCache() {
+bool ShareManager::loadCache() throw() {
try {
ShareLoader loader(directories);
string txt;
@@ -420,8 +470,8 @@
j->second->setName(vName);
}
-ShareManager::Directory::MapIter ShareManager::getByVirtual(const string& virtualName) {
- for(Directory::MapIter i = directories.begin(); i != directories.end(); ++i) {
+ShareManager::Directory::Map::const_iterator ShareManager::getByVirtual(const string& virtualName) const throw() {
+ for(Directory::Map::const_iterator i = directories.begin(); i != directories.end(); ++i) {
if(Util::stricmp(i->second->getName(), virtualName) == 0) {
return i;
}
@@ -429,10 +479,10 @@
return directories.end();
}
-int64_t ShareManager::getShareSize(const string& aDir) throw() {
+int64_t ShareManager::getShareSize(const string& realPath) const throw() {
Lock l(cs);
- dcassert(aDir.size()>0);
- Directory::MapIter i = directories.find(aDir);
+ dcassert(realPath.size()>0);
+ Directory::Map::const_iterator i = directories.find(realPath);
if(i != directories.end()) {
return i->second->getSize();
@@ -441,44 +491,24 @@
return -1;
}
-int64_t ShareManager::getShareSize() throw() {
+int64_t ShareManager::getShareSize() const throw() {
Lock l(cs);
int64_t tmp = 0;
- for(Directory::MapIter i = directories.begin(); i != directories.end(); ++i) {
+ for(Directory::Map::const_iterator i = directories.begin(); i != directories.end(); ++i) {
tmp += i->second->getSize();
}
return tmp;
}
-size_t ShareManager::getSharedFiles() throw() {
+size_t ShareManager::getSharedFiles() const throw() {
Lock l(cs);
size_t tmp = 0;
- for(Directory::MapIter i = directories.begin(); i != directories.end(); ++i) {
+ for(Directory::Map::const_iterator i = directories.begin(); i != directories.end(); ++i) {
tmp += i->second->countFiles();
}
return tmp;
}
-
-string ShareManager::Directory::getADCPath() const throw() {
- if(parent == NULL)
- return '/' + name + '/';
- return parent->getADCPath() + name + '/';
-}
-string ShareManager::Directory::getFullName() const throw() {
- if(parent == NULL)
- return getName() + '\\';
- return parent->getFullName() + getName() + '\\';
-}
-
-void ShareManager::Directory::addType(uint32_t type) throw() {
- if(!hasType(type)) {
- fileTypes |= (1 << type);
- if(getParent() != NULL)
- getParent()->addType(type);
- }
-}
-
class FileFindIter {
#ifdef _WIN32
public:
@@ -622,7 +652,7 @@
FileFindIter end;
#ifdef _WIN32
- for(FileFindIter i(aName + "*"); i != end; ++i) {
+ for(FileFindIter i(aName + "*"); i != end; ++i) {
#else
//the fileiter just searches directorys for now, not sure if more
//will be needed later
@@ -708,7 +738,7 @@
bloom.add(Text::toLower(f.getName()));
}
-void ShareManager::refresh(bool dirs /* = false */, bool aUpdate /* = true */, bool block /* = false */) throw(ThreadException, ShareException) {
+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));
return;
@@ -734,7 +764,7 @@
}
}
-StringPairList ShareManager::getDirectories() const {
+StringPairList ShareManager::getDirectories() const throw() {
Lock l(cs);
StringPairList ret;
for(Directory::Map::const_iterator i = directories.begin(); i != directories.end(); ++i) {
@@ -837,9 +867,9 @@
}
}
-MemoryInputStream* ShareManager::generatePartialList(const string& dir, bool recurse) {
+MemoryInputStream* ShareManager::generatePartialList(const string& dir, bool recurse) const {
if(dir[0] != '/' || dir[dir.size()-1] != '/')
- return NULL;
+ return 0;
string xml = SimpleXML::utf8Header;
string tmp;
@@ -849,13 +879,13 @@
Lock l(cs);
if(dir == "/") {
- for(ShareManager::Directory::MapIter i = directories.begin(); i != directories.end(); ++i) {
+ for(Directory::Map::const_iterator i = directories.begin(); i != directories.end(); ++i) {
tmp.clear();
i->second->toXml(sos, indent, tmp, recurse);
}
} else {
string::size_type i = 1, j = 1;
- ShareManager::Directory::MapIter it = directories.end();
+ Directory::Map::const_iterator it = directories.end();
bool first = true;
while( (i = dir.find('/', j)) != string::npos) {
if(i == j) {
@@ -870,7 +900,7 @@
if(it == directories.end())
return 0;
} else {
- ShareManager::Directory::MapIter it2 = it->second->directories.find(dir.substr(j, i-j));
+ Directory::Map::const_iterator it2 = it->second->directories.find(dir.substr(j, i-j));
if(it2 == it->second->directories.end()) {
return 0;
}
@@ -878,7 +908,7 @@
}
j = i + 1;
}
- for(ShareManager::Directory::MapIter it2 = it->second->directories.begin(); it2 != it->second->directories.end(); ++it2) {
+ for(Directory::Map::const_iterator it2 = it->second->directories.begin(); it2 != it->second->directories.end(); ++it2) {
it2->second->toXml(sos, indent, tmp, recurse);
}
it->second->filesToXml(sos, indent, tmp);
@@ -888,26 +918,17 @@
return new MemoryInputStream(xml);
}
-static const string& escaper(const string& n, string& tmp) {
- if(SimpleXML::needsEscape(n, true, false)) {
- tmp.clear();
- tmp.append(n);
- return SimpleXML::escape(tmp, true, false);
- }
- return n;
-}
-
#define LITERAL(n) n, sizeof(n)-1
-void ShareManager::Directory::toXml(OutputStream& xmlFile, string& indent, string& tmp2, bool fullList) {
+void ShareManager::Directory::toXml(OutputStream& xmlFile, string& indent, string& tmp2, bool fullList) const {
xmlFile.write(indent);
xmlFile.write(LITERAL("<Directory Name=\""));
- xmlFile.write(escaper(name, tmp2));
+ xmlFile.write(SimpleXML::escape(name, tmp2, true));
if(fullList) {
xmlFile.write(LITERAL("\">\r\n"));
indent += '\t';
- for(MapIter i = directories.begin(); i != directories.end(); ++i) {
+ for(Map::const_iterator i = directories.begin(); i != directories.end(); ++i) {
i->second->toXml(xmlFile, indent, tmp2, fullList);
}
@@ -925,13 +946,13 @@
}
}
-void ShareManager::Directory::filesToXml(OutputStream& xmlFile, string& indent, string& tmp2) {
- for(Directory::File::Iter i = files.begin(); i != files.end(); ++i) {
+void ShareManager::Directory::filesToXml(OutputStream& xmlFile, string& indent, string& tmp2) const {
+ for(Directory::File::Set::const_iterator i = files.begin(); i != files.end(); ++i) {
const Directory::File& f = *i;
xmlFile.write(indent);
xmlFile.write(LITERAL("<File Name=\""));
- xmlFile.write(escaper(f.getName(), tmp2));
+ xmlFile.write(SimpleXML::escape(f.getName(), tmp2, true));
xmlFile.write(LITERAL("\" Size=\""));
xmlFile.write(Util::toString(f.getSize()));
xmlFile.write(LITERAL("\" TTH=\""));
@@ -1030,7 +1051,7 @@
return false;
}
-SearchManager::TypeModes ShareManager::getType(const string& aFileName) {
+SearchManager::TypeModes ShareManager::getType(const string& aFileName) const throw() {
if(aFileName[aFileName.length() - 1] == PATH_SEPARATOR) {
return SearchManager::TYPE_DIRECTORY;
}
@@ -1058,7 +1079,7 @@
* has been matched in the directory name. This new stringlist should also be used in all descendants,
* but not the parents...
*/
-void ShareManager::Directory::search(SearchResult::List& aResults, StringSearch::List& aStrings, int aSearchType, int64_t aSize, int aFileType, Client* aClient, StringList::size_type maxResults) throw() {
+void ShareManager::Directory::search(SearchResult::List& aResults, StringSearch::List& aStrings, int aSearchType, int64_t aSize, int aFileType, Client* aClient, StringList::size_type maxResults) const throw() {
// Skip everything if there's nothing to find here (doh! =)
if(!hasType(aFileType))
return;
@@ -1090,7 +1111,7 @@
}
if(aFileType != SearchManager::TYPE_DIRECTORY) {
- for(File::Iter i = files.begin(); i != files.end(); ++i) {
+ for(File::Set::const_iterator i = files.begin(); i != files.end(); ++i) {
if(aSearchType == SearchManager::SIZE_ATLEAST && aSize > i->getSize()) {
continue;
@@ -1116,17 +1137,17 @@
}
}
- for(Directory::MapIter l = directories.begin(); (l != directories.end()) && (aResults.size() < maxResults); ++l) {
+ for(Directory::Map::const_iterator l = directories.begin(); (l != directories.end()) && (aResults.size() < maxResults); ++l) {
l->second->search(aResults, *cur, aSearchType, aSize, aFileType, aClient, maxResults);
}
}
-void ShareManager::search(SearchResult::List& results, const string& aString, int aSearchType, int64_t aSize, int aFileType, Client* aClient, StringList::size_type maxResults) {
+void ShareManager::search(SearchResult::List& results, const string& aString, int aSearchType, int64_t aSize, int aFileType, Client* aClient, StringList::size_type maxResults) throw() {
Lock l(cs);
if(aFileType == SearchManager::TYPE_TTH) {
if(aString.compare(0, 4, "TTH:") == 0) {
TTHValue tth(aString.substr(4));
- HashFileIter i = tthIndex.find(tth);
+ HashFileMap::const_iterator i = tthIndex.find(tth);
if(i != tthIndex.end()) {
SearchResult* sr = new SearchResult(SearchResult::TYPE_FILE, i->second->getSize(),
i->second->getParent()->getFullName() + i->second->getName(), i->second->getTTH());
@@ -1151,7 +1172,7 @@
if(ssl.empty())
return;
- for(Directory::MapIter j = directories.begin(); (j != directories.end()) && (results.size() < maxResults); ++j) {
+ for(Directory::Map::const_iterator j = directories.begin(); (j != directories.end()) && (results.size() < maxResults); ++j) {
j->second->search(results, ssl, aSearchType, aSize, aFileType, aClient, maxResults);
}
}
@@ -1191,7 +1212,7 @@
}
}
-void ShareManager::Directory::search(SearchResult::List& aResults, AdcSearch& aStrings, StringList::size_type maxResults) throw() {
+void ShareManager::Directory::search(SearchResult::List& aResults, AdcSearch& aStrings, StringList::size_type maxResults) const throw() {
StringSearch::List* cur = aStrings.include;
StringSearch::List* old = aStrings.include;
@@ -1220,7 +1241,7 @@
}
if(!aStrings.isDirectory) {
- for(File::Iter i = files.begin(); i != files.end(); ++i) {
+ for(File::Set::const_iterator i = files.begin(); i != files.end(); ++i) {
if(!(i->getSize() >= aStrings.gt)) {
continue;
@@ -1252,19 +1273,19 @@
}
}
- for(Directory::MapIter l = directories.begin(); (l != directories.end()) && (aResults.size() < maxResults); ++l) {
+ for(Directory::Map::const_iterator l = directories.begin(); (l != directories.end()) && (aResults.size() < maxResults); ++l) {
l->second->search(aResults, aStrings, maxResults);
}
aStrings.include = old;
}
-void ShareManager::search(SearchResult::List& results, const StringList& params, StringList::size_type maxResults) {
+void ShareManager::search(SearchResult::List& results, const StringList& params, StringList::size_type maxResults) throw() {
AdcSearch srch(params);
Lock l(cs);
if(srch.hasRoot) {
- HashFileIter i = tthIndex.find(srch.root);
+ HashFileMap::const_iterator i = tthIndex.find(srch.root);
if(i != tthIndex.end()) {
SearchResult* sr = new SearchResult(SearchResult::TYPE_FILE,
i->second->getSize(), i->second->getParent()->getFullName() + i->second->getName(),
@@ -1280,25 +1301,11 @@
return;
}
- for(Directory::MapIter j = directories.begin(); (j != directories.end()) && (results.size() < maxResults); ++j) {
+ for(Directory::Map::const_iterator j = directories.begin(); (j != directories.end()) && (results.size() < maxResults); ++j) {
j->second->search(results, srch, maxResults);
}
}
-int64_t ShareManager::Directory::getSize() {
- int64_t tmp = size;
- for(MapIter i = directories.begin(); i != directories.end(); ++i)
- tmp+=i->second->getSize();
- return tmp;
-}
-
-size_t ShareManager::Directory::countFiles() {
- size_t tmp = files.size();
- for(MapIter i = directories.begin(); i != directories.end(); ++i)
- tmp+=i->second->countFiles();
- return tmp;
-}
-
ShareManager::Directory* ShareManager::getDirectory(const string& fname) {
for(Directory::MapIter mi = directories.begin(); mi != directories.end(); ++mi) {
if(Util::strnicmp(fname, mi->first, mi->first.length()) == 0) {
@@ -1342,8 +1349,8 @@
void ShareManager::on(HashManagerListener::TTHDone, const string& fname, const TTHValue& root) throw() {
Lock l(cs);
Directory* d = getDirectory(fname);
- if(d != NULL) {
- Directory::File::Iter i = d->findFile(Util::getFileName(fname));
+ if(d) {
+ Directory::File::Set::const_iterator i = d->findFile(Util::getFileName(fname));
if(i != d->files.end()) {
if(root != i->getTTH())
tthIndex.erase(i->getTTH());
@@ -1364,10 +1371,7 @@
void ShareManager::on(TimerManagerListener::Minute, uint32_t tick) throw() {
if(SETTING(AUTO_REFRESH_TIME) > 0) {
if(lastFullUpdate + SETTING(AUTO_REFRESH_TIME) * 60 * 1000 < tick) {
- try {
- refresh(true, true);
- } catch(const ShareException&) {
- }
+ refresh(true, true);
}
}
}
Modified: dcplusplus/trunk/client/ShareManager.h
===================================================================
--- dcplusplus/trunk/client/ShareManager.h 2006-10-14 15:52:30 UTC (rev 678)
+++ dcplusplus/trunk/client/ShareManager.h 2006-10-15 19:06:14 UTC (rev 679)
@@ -58,33 +58,34 @@
void removeDirectory(const string& realPath);
void renameDirectory(const string& realPath, const string& virtualName) throw(ShareException);
- string toVirtual(const TTHValue& tth) throw(ShareException);
+ string toVirtual(const TTHValue& tth) const throw(ShareException);
string toReal(const string& virtualFile) throw(ShareException);
- TTHValue getTTH(const string& virtualFile) throw(ShareException);
- void refresh(bool dirs = false, bool aUpdate = true, bool block = false) throw(ThreadException, ShareException);
+ TTHValue getTTH(const string& virtualFile) const throw(ShareException);
+
+ void refresh(bool dirs = false, bool aUpdate = true, bool block = false) throw();
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);
+ void search(SearchResult::List& l, const string& aString, int aSearchType, int64_t aSize, int aFileType, Client* aClient, StringList::size_type maxResults) throw();
+ void search(SearchResult::List& l, const StringList& params, StringList::size_type maxResults) throw();
- StringPairList getDirectories() const;
+ StringPairList getDirectories() const throw();
- MemoryInputStream* generatePartialList(const string& dir, bool recurse);
- MemoryInputStream* getTree(const string& virtualFile);
+ MemoryInputStream* generatePartialList(const string& dir, bool recurse) const;
+ MemoryInputStream* getTree(const string& virtualFile) const;
AdcCommand getFileInfo(const string& aFile) throw(ShareException);
- int64_t getShareSize() throw();
- int64_t getShareSize(const string& aDir) throw();
+ int64_t getShareSize() const throw();
+ int64_t getShareSize(const string& realPath) const throw();
- size_t getSharedFiles() throw();
+ size_t getSharedFiles() const throw();
- string getShareSizeString() { return Util::toString(getShareSize()); }
- string getShareSizeString(const string& aDir) { return Util::toString(getShareSize(aDir)); }
+ string getShareSizeString() const { return Util::toString(getShareSize()); }
+ string getShareSizeString(const string& aDir) const { return Util::toString(getShareSize(aDir)); }
- SearchManager::TypeModes getType(const string& fileName);
+ SearchManager::TypeModes getType(const string& fileName) const throw();
- string validateVirtual(const string& /*aVirt*/);
+ string validateVirtual(const string& /*aVirt*/) const throw();
void addHits(uint32_t aHits) {
hits += aHits;
@@ -138,7 +139,8 @@
}
string getADCPath() const { return parent->getADCPath() + name; }
- string getFullName() const { return parent->getFullName() + getName(); }
+ string getFullName() const { return parent->getFullName() + name; }
+ string getRealPath() const { return parent->getRealPath() + name; }
GETSET(string, name, Name);
GETSET(TTHValue, tth, TTH);
@@ -167,17 +169,18 @@
string getADCPath() const throw();
string getFullName() const throw();
+ string getRealPath() const throw();
- int64_t getSize();
- size_t countFiles();
+ int64_t getSize() const throw();
+ size_t countFiles() const throw();
- void search(SearchResult::List& aResults, StringSearch::List& aStrings, int aSearchType, int64_t aSize, int aFileType, Client* aClient, StringList::size_type maxResults) throw();
- void search(SearchResult::List& aResults, AdcSearch& aStrings, StringList::size_type maxResults) throw();
+ void search(SearchResult::List& aResults, StringSearch::List& aStrings, int aSearchType, int64_t aSize, int aFileType, Client* aClient, StringList::size_type maxResults) const throw();
+ void search(SearchResult::List& aResults, AdcSearch& aStrings, StringList::size_type maxResults) const throw();
- void toXml(OutputStream& xmlFile, string& indent, string& tmp2, bool fullList);
- void filesToXml(OutputStream& xmlFile, string& indent, string& tmp2);
+ void toXml(OutputStream& xmlFile, string& indent, string& tmp2, bool fullList) const;
+ void filesToXml(OutputStream& xmlFile, string& indent, string& tmp2) const;
- File::Iter findFile(const string& aFile) { return find_if(files.begin(), files.end(), Directory::File::StringComp(aFile)); }
+ File::Set::const_iterator findFile(const string& aFile) const { return find_if(files.begin(), files.end(), Directory::File::StringComp(aFile)); }
GETSET(string, name, Name);
GETSET(Directory*, parent, Parent);
@@ -263,7 +266,7 @@
BloomFilter<5> bloom;
- bool checkFile(const string& virtualFile, string& realFile, Directory::File::Iter& it) throw(ShareException);
+ Directory::File::Set::const_iterator findFile(const string& virtualFile) const throw(ShareException);
Directory* buildTree(const string& aName, Directory* aParent);
@@ -272,9 +275,9 @@
void addTree(Directory& aDirectory);
void addFile(Directory& dir, Directory::File::Iter i);
void generateXmlList();
- bool loadCache();
- bool hasVirtual(const string& name);
- Directory::MapIter getByVirtual(const string& virtualName);
+ bool loadCache() throw();
+ bool hasVirtual(const string& name) const throw();
+ Directory::Map::const_iterator getByVirtual(const string& virtualName) const throw();
Directory* getDirectory(const string& fname);
Property changes on: dcplusplus/trunk/help
___________________________________________________________________
Name: svn:ignore
+ *.vcproj.*
Property changes on: dcplusplus/trunk/yassl
___________________________________________________________________
Name: svn:ignore
- doc
+ doc
*.vcproj.*
Property changes on: dcplusplus/trunk/yassl/taocrypt
___________________________________________________________________
Name: svn:ignore
+ *.vcproj.*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <arn...@us...> - 2006-10-18 19:44:19
|
Revision: 681
http://svn.sourceforge.net/dcplusplus/?rev=681&view=rev
Author: arnetheduck
Date: 2006-10-18 12:43:41 -0700 (Wed, 18 Oct 2006)
Log Message:
-----------
cleanup, patches
Modified Paths:
--------------
dcplusplus/trunk/DCPlusPlus.vcproj
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/client/AdcHub.cpp
dcplusplus/trunk/client/AdcHub.h
dcplusplus/trunk/client/Client.cpp
dcplusplus/trunk/client/Client.h
dcplusplus/trunk/client/DCPlusPlus.h
dcplusplus/trunk/client/NmdcHub.cpp
dcplusplus/trunk/client/NmdcHub.h
dcplusplus/trunk/client/stdinc.h
dcplusplus/trunk/client.vcproj
dcplusplus/trunk/windows/HubFrame.cpp
dcplusplus/trunk/windows/HubFrame.h
Removed Paths:
-------------
dcplusplus/trunk/client/config.h
Modified: dcplusplus/trunk/DCPlusPlus.vcproj
===================================================================
--- dcplusplus/trunk/DCPlusPlus.vcproj 2006-10-18 06:53:29 UTC (rev 680)
+++ dcplusplus/trunk/DCPlusPlus.vcproj 2006-10-18 19:43:41 UTC (rev 681)
@@ -47,7 +47,6 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""$(SolutionDir)stlport";"$(SolutionDir)wtl";"$(SolutionDir)yassl\include""
- PreprocessorDefinitions="HAVE_STLPORT"
StringPooling="true"
MinimalRebuild="true"
ExceptionHandling="1"
@@ -157,7 +156,6 @@
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
AdditionalIncludeDirectories=""$(SolutionDir)stlport";"$(SolutionDir)wtl";"$(SolutionDir)yassl\include""
- PreprocessorDefinitions="HAVE_STLPORT"
StringPooling="true"
MinimalRebuild="true"
ExceptionHandling="1"
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2006-10-18 06:53:29 UTC (rev 680)
+++ dcplusplus/trunk/changelog.txt 2006-10-18 19:43:41 UTC (rev 681)
@@ -5,6 +5,9 @@
* Confirm hub removal is now default
* SFV checking is now default
* Fixed TLS port not being greyed out
+* Automatic hub reconnection is only done if at least one successful connection has been made
+* [bug 1080] Better nick tab completion (thanks cologic)
+* [bug 1081] Added user IP in hub frame (thanks cologic)
-- 0.698 2006-10-10 --
* [bug 1065] Code cleanup (thanks steven sheehy)
Modified: dcplusplus/trunk/client/AdcHub.cpp
===================================================================
--- dcplusplus/trunk/client/AdcHub.cpp 2006-10-18 06:53:29 UTC (rev 680)
+++ dcplusplus/trunk/client/AdcHub.cpp 2006-10-18 19:43:41 UTC (rev 681)
@@ -39,7 +39,7 @@
const string AdcHub::TCP4_FEATURE("TCP4");
const string AdcHub::UDP4_FEATURE("UDP4");
-AdcHub::AdcHub(const string& aHubURL, bool secure) : Client(aHubURL, '\n', secure), state(STATE_PROTOCOL), sid(0), reconnect(true) {
+AdcHub::AdcHub(const string& aHubURL, bool secure) : Client(aHubURL, '\n', secure), sid(0) {
TimerManager::getInstance()->addListener(this);
}
@@ -48,6 +48,7 @@
clearUsers();
}
+
OnlineUser& AdcHub::getUser(const uint32_t aSID, const CID& aCID) {
OnlineUser* ou = findUser(aSID);
if(ou) {
@@ -146,6 +147,7 @@
if(u->getUser() == getMyIdentity().getUser()) {
state = STATE_NORMAL;
+ setAutoReconnect(true);
setMyIdentity(u->getIdentity());
updateCounts(false);
}
@@ -219,7 +221,13 @@
}
void AdcHub::handle(AdcCommand::QUI, AdcCommand& c) throw() {
- putUser(AdcCommand::toSID(c.getParam(0)));
+ uint32_t s = AdcCommand::toSID(c.getParam(0));
+ putUser(s);
+
+ // No use to hammer if we're banned
+ if(s == sid && c.hasFlag("TL", 1)) {
+ setAutoReconnect(false);
+ }
}
void AdcHub::handle(AdcCommand::CTM, AdcCommand& c) throw() {
@@ -574,16 +582,24 @@
return tmp;
}
+void AdcHub::send(const AdcCommand& cmd) {
+ if(cmd.getType() == AdcCommand::TYPE_UDP)
+ sendUDP(cmd);
+ send(cmd.toString(sid));
+}
+
void AdcHub::on(Connected) throw() {
- dcassert(state == STATE_PROTOCOL);
+ Client::on(Connected());
+
lastInfoMap.clear();
- reconnect = true;
+ sid = 0;
+
send(AdcCommand(AdcCommand::CMD_SUP, AdcCommand::TYPE_HUB).addParam("ADBAS0"));
-
- fire(ClientListener::Connected(), this);
}
void AdcHub::on(Line, const string& aLine) throw() {
+ Client::on(Line(), aLine);
+
if(BOOLSETTING(ADC_DEBUG)) {
fire(ClientListener::StatusMessage(), this, "<ADC>" + aLine + "</ADC>");
}
@@ -592,23 +608,12 @@
void AdcHub::on(Failed, const string& aLine) throw() {
clearUsers();
- socket->removeListener(this);
- state = STATE_PROTOCOL;
- fire(ClientListener::Failed(), this, aLine);
+ Client::on(Failed(), aLine);
}
-void AdcHub::send(const AdcCommand& cmd) {
- dcassert(socket);
- if(!socket)
- return;
- if(cmd.getType() == AdcCommand::TYPE_UDP)
- sendUDP(cmd);
- send(cmd.toString(sid));
-}
-
void AdcHub::on(Second, uint32_t aTick) throw() {
- if(getAutoReconnect() && state == STATE_PROTOCOL && (getReconnecting() || ((getLastActivity() + getReconnDelay() * 1000) < aTick)) ) {
- // Try to reconnect...
- connect();
+ Client::on(Second(), aTick);
+ if(state == STATE_NORMAL && (aTick > (getLastActivity() + 120*1000)) ) {
+ send("\n", 1);
}
}
Modified: dcplusplus/trunk/client/AdcHub.h
===================================================================
--- dcplusplus/trunk/client/AdcHub.h 2006-10-18 06:53:29 UTC (rev 680)
+++ dcplusplus/trunk/client/AdcHub.h 2006-10-18 19:43:41 UTC (rev 681)
@@ -56,13 +56,6 @@
friend class ClientManager;
friend class CommandHandler<AdcHub>;
- enum States {
- STATE_PROTOCOL,
- STATE_IDENTIFY,
- STATE_VERIFY,
- STATE_NORMAL
- } state;
-
AdcHub(const string& aHubURL, bool secure);
AdcHub(const AdcHub&);
@@ -79,9 +72,7 @@
mutable CriticalSection cs;
string salt;
-
uint32_t sid;
- bool reconnect;
static const string CLIENT_PROTOCOL;
static const string SECURE_CLIENT_PROTOCOL;
@@ -110,9 +101,7 @@
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);
- }
+ template<typename T> void handle(T, AdcCommand&) { }
void sendUDP(const AdcCommand& cmd) throw();
@@ -122,6 +111,7 @@
virtual void on(Failed, const string& aLine) throw();
virtual void on(Second, uint32_t aTick) throw();
+
};
#endif // !defined(ADC_HUB_H)
Modified: dcplusplus/trunk/client/Client.cpp
===================================================================
--- dcplusplus/trunk/client/Client.cpp 2006-10-18 06:53:29 UTC (rev 680)
+++ dcplusplus/trunk/client/Client.cpp 2006-10-18 19:43:41 UTC (rev 681)
@@ -31,7 +31,7 @@
Client::Client(const string& hubURL, char separator_, bool secure_) :
myIdentity(ClientManager::getInstance()->getMe(), 0),
- reconnDelay(120), lastActivity(GET_TICK()), registered(false), autoReconnect(true), reconnecting(false), socket(0),
+ reconnDelay(120), lastActivity(GET_TICK()), registered(false), autoReconnect(false), state(STATE_DISCONNECTED), socket(0),
hubUrl(hubURL), port(0), separator(separator_),
secure(secure_), countType(COUNT_UNCOUNTED)
{
@@ -50,7 +50,7 @@
void Client::reconnect() {
disconnect(true);
setAutoReconnect(true);
- setReconnecting(true);
+ setReconnDelay(0);
}
void Client::shutdown() {
@@ -88,7 +88,6 @@
BufferedSocket::putSocket(socket);
setAutoReconnect(true);
- setReconnecting(false);
setReconnDelay(120 + Util::rand(0, 60));
reloadSettings(true);
setRegistered(false);
@@ -107,18 +106,25 @@
fire(ClientListener::Failed(), this, e.getError());
}
updateActivity();
+ state = STATE_CONNECTING;
}
void Client::on(Connected) throw() {
updateActivity();
ip = socket->getIp();
fire(ClientListener::Connected(), this);
+ state = STATE_PROTOCOL;
}
+void Client::on(Failed, const string& aLine) throw() {
+ state = STATE_DISCONNECTED;
+ socket->removeListener(this);
+ fire(ClientListener::Failed(), this, aLine);
+}
+
void Client::disconnect(bool graceLess) {
- if(!socket)
- return;
- socket->disconnect(graceLess);
+ if(socket)
+ socket->disconnect(graceLess);
}
void Client::updateCounts(bool aRemove) {
@@ -166,5 +172,13 @@
return lip;
}
-void Client::on(Second, uint32_t) throw() {
+void Client::on(Line, const string& /*aLine*/) throw() {
+ updateActivity();
}
+
+void Client::on(Second, uint32_t aTick) throw() {
+ if(state == STATE_DISCONNECTED && getAutoReconnect() && (aTick > (getLastActivity() + getReconnDelay() * 1000)) ) {
+ // Try to reconnect...
+ connect();
+ }
+}
Modified: dcplusplus/trunk/client/Client.h
===================================================================
--- dcplusplus/trunk/client/Client.h 2006-10-18 06:53:29 UTC (rev 680)
+++ dcplusplus/trunk/client/Client.h 2006-10-18 19:43:41 UTC (rev 681)
@@ -153,7 +153,6 @@
GETSET(uint32_t, lastActivity, LastActivity);
GETSET(bool, registered, Registered);
GETSET(bool, autoReconnect, AutoReconnect);
- GETSET(bool, reconnecting, Reconnecting);
GETSET(string, currentNick, CurrentNick);
GETSET(string, currentDescription, CurrentDescription);
@@ -169,6 +168,15 @@
bool operator !=(const Counts& rhs) { return normal != rhs.normal || registered != rhs.registered || op != rhs.op; }
};
+ enum States {
+ STATE_CONNECTING, ///< Waiting for socket to connect
+ STATE_PROTOCOL, ///< Protocol setup
+ STATE_IDENTIFY, ///< Nick setup
+ STATE_VERIFY, ///< Checking password
+ STATE_NORMAL, ///< Running
+ STATE_DISCONNECTED, ///< Nothing in particular
+ } state;
+
BufferedSocket* socket;
static Counts counts;
@@ -184,6 +192,11 @@
// TimerManagerListener
virtual void on(Second, uint32_t aTick) throw();
+ // BufferedSocketListener
+ virtual void on(Connecting) throw() { fire(ClientListener::Connecting(), this); }
+ virtual void on(Connected) throw();
+ virtual void on(Line, const string& aLine) throw();
+ virtual void on(Failed, const string&) throw();
private:
@@ -204,12 +217,6 @@
char separator;
bool secure;
CountType countType;
-
- // BufferedSocketListener
- virtual void on(Connecting) throw() { fire(ClientListener::Connecting(), this); }
- virtual void on(Connected) throw();
-
-
};
#endif // !defined(CLIENT_H)
Modified: dcplusplus/trunk/client/DCPlusPlus.h
===================================================================
--- dcplusplus/trunk/client/DCPlusPlus.h 2006-10-18 06:53:29 UTC (rev 680)
+++ dcplusplus/trunk/client/DCPlusPlus.h 2006-10-18 19:43:41 UTC (rev 681)
@@ -100,6 +100,37 @@
typedef vector<WStringPair> WStringPairList;
typedef WStringPairList::iterator WStringPairIter;
+#if defined(_MSC_VER)
+#define _LL(x) x##ll
+#define _ULL(x) x##ull
+#define I64_FMT "%I64d"
+#define U64_FMT "%I64d"
+
+#elif defined(SIZEOF_LONG) && SIZEOF_LONG == 8
+#define _LL(x) x##l
+#define _ULL(x) x##ul
+#define I64_FMT "%ld"
+#define U64_FMT "%ld"
+#else
+#define _LL(x) x##ll
+#define _ULL(x) x##ull
+#define I64_FMT "%lld"
+#define U64_FMT "%lld"
+#endif
+
+#ifdef _WIN32
+
+# define PATH_SEPARATOR '\\'
+# define PATH_SEPARATOR_STR "\\"
+
+#else
+
+# define PATH_SEPARATOR '/'
+# define PATH_SEPARATOR_STR "/"
+
+#endif
+
+
typedef HASH_MAP<wstring, wstring> WStringMap;
typedef WStringMap::iterator WStringMapIter;
Modified: dcplusplus/trunk/client/NmdcHub.cpp
===================================================================
--- dcplusplus/trunk/client/NmdcHub.cpp 2006-10-18 06:53:29 UTC (rev 680)
+++ dcplusplus/trunk/client/NmdcHub.cpp 2006-10-18 19:43:41 UTC (rev 681)
@@ -32,7 +32,7 @@
#include "UserCommand.h"
#include "StringTokenizer.h"
-NmdcHub::NmdcHub(const string& aHubURL) : Client(aHubURL, '|', false), supportFlags(0), state(STATE_CONNECT),
+NmdcHub::NmdcHub(const string& aHubURL) : Client(aHubURL, '|', false), supportFlags(0),
lastUpdate(0)
{
}
@@ -41,19 +41,9 @@
clearUsers();
}
-void NmdcHub::connect() {
- supportFlags = 0;
- lastMyInfoA.clear();
- lastMyInfoB.clear();
- lastUpdate = 0;
- state = STATE_LOCK;
+#define checkstate() if(state != STATE_NORMAL) return
- Client::connect();
-}
-
-#define checkstate() if(state != STATE_CONNECTED) return
-
void NmdcHub::connect(const OnlineUser& aUser) {
checkstate();
dcdebug("NmdcHub::connect %s\n", aUser.getIdentity().getNick().c_str());
@@ -178,14 +168,12 @@
}
void NmdcHub::onLine(const string& aLine) throw() {
- updateActivity();
-
if(aLine.length() == 0)
return;
if(aLine[0] != '$') {
// Check if we're being banned...
- if(state != STATE_CONNECTED) {
+ if(state != STATE_NORMAL) {
if(Util::findSubString(aLine, "banned") != string::npos) {
setAutoReconnect(false);
}
@@ -236,7 +224,7 @@
}
if(cmd == "$Search") {
- if(state != STATE_CONNECTED) {
+ if(state != STATE_NORMAL) {
return;
}
string::size_type i = 0;
@@ -411,7 +399,7 @@
putUser(nick);
}
} else if(cmd == "$ConnectToMe") {
- if(state != STATE_CONNECTED) {
+ if(state != STATE_NORMAL) {
return;
}
string::size_type i = param.find(' ');
@@ -431,7 +419,7 @@
string port = param.substr(j+1);
ConnectionManager::getInstance()->nmdcConnect(server, (unsigned short)Util::toInt(port), getMyNick(), getHubUrl());
} else if(cmd == "$RevConnectToMe") {
- if(state != STATE_CONNECTED) {
+ if(state != STATE_NORMAL) {
return;
}
@@ -515,10 +503,10 @@
fire(ClientListener::UserCommand(), this, type, ctx, name, command);
}
} else if(cmd == "$Lock") {
- if(state != STATE_LOCK) {
+ if(state != STATE_PROTOCOL) {
return;
}
- state = STATE_HELLO;
+ state = STATE_IDENTIFY;
// Param must not be fromAcp'd...
param = aLine.substr(6);
@@ -568,8 +556,8 @@
u.getUser()->setFlag(User::PASSIVE);
}
- if(state == STATE_HELLO && u.getUser() == getMyIdentity().getUser()) {
- state = STATE_CONNECTED;
+ if(state == STATE_IDENTIFY && u.getUser() == getMyIdentity().getUser()) {
+ state = STATE_NORMAL;
updateCounts(false);
version();
@@ -626,7 +614,7 @@
v.push_back(&getUser(*it));
}
- if(!(getSupportFlags() & SUPPORTS_NOGETINFO)) {
+ if(!(supportFlags & SUPPORTS_NOGETINFO)) {
string tmp;
// Let's assume 10 characters per nick...
tmp.reserve(v.size() * (11 + 10 + getMyNick().length()));
@@ -901,24 +889,29 @@
}
}
-// TimerManagerListener
-void NmdcHub::on(Second, uint32_t aTick) throw() {
- 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 && (getReconnecting() || ((getLastActivity() + getReconnDelay() * 1000) < aTick))) {
- // Try to reconnect...
- connect();
- }
+void NmdcHub::on(Connected) throw() {
+ Client::on(Connected());
- Client::on(Second(), aTick);
+ supportFlags = 0;
+ lastMyInfoA.clear();
+ lastMyInfoB.clear();
+ lastUpdate = 0;
}
-// BufferedSocketListener
-void NmdcHub::on(BufferedSocketListener::Failed, const string& aLine) throw() {
+void NmdcHub::on(Line, const string& aLine) throw() {
+ Client::on(Line(), aLine);
+ onLine(aLine);
+}
+
+void NmdcHub::on(Failed, const string& aLine) throw() {
clearUsers();
- socket->removeListener(this);
- state = STATE_CONNECT;
- fire(ClientListener::Failed(), this, aLine);
+ Client::on(Failed(), aLine);
}
+
+void NmdcHub::on(Second, uint32_t aTick) throw() {
+ Client::on(Second(), aTick);
+
+ if(state == STATE_NORMAL && (aTick > (getLastActivity() + 120*1000)) ) {
+ send("|", 1);
+ }
+}
Modified: dcplusplus/trunk/client/NmdcHub.h
===================================================================
--- dcplusplus/trunk/client/NmdcHub.h 2006-10-18 06:53:29 UTC (rev 680)
+++ dcplusplus/trunk/client/NmdcHub.h 2006-10-18 19:43:41 UTC (rev 681)
@@ -37,8 +37,8 @@
{
public:
using Client::send;
+ using Client::connect;
- virtual void connect();
virtual void connect(const OnlineUser& aUser);
virtual void hubMessage(const string& aMessage);
@@ -57,8 +57,6 @@
virtual void send(const AdcCommand&) { dcassert(0); }
static string validateMessage(string tmp, bool reverse);
-
- GETSET(int, supportFlags, SupportFlags);
private:
friend class ClientManager;
enum SupportFlags {
@@ -67,13 +65,6 @@
SUPPORTS_USERIP2 = 0x04
};
- enum States {
- STATE_CONNECT,
- STATE_LOCK,
- STATE_HELLO,
- STATE_CONNECTED
- } state;
-
mutable CriticalSection cs;
typedef HASH_MAP_X(string, OnlineUser*, noCaseStringHash, noCaseStringEq, noCaseStringLess) NickMap;
@@ -81,6 +72,7 @@
NickMap users;
+ int supportFlags;
uint32_t lastUpdate;
string lastMyInfoA, lastMyInfoB;
@@ -123,7 +115,8 @@
// TimerManagerListener
virtual void on(Second, uint32_t aTick) throw();
- virtual void on(Line, const string& l) throw() { onLine(l); }
+ virtual void on(Connected) throw();
+ virtual void on(Line, const string& l) throw();
virtual void on(Failed, const string&) throw();
};
Deleted: dcplusplus/trunk/client/config.h
===================================================================
--- dcplusplus/trunk/client/config.h 2006-10-18 06:53:29 UTC (rev 680)
+++ dcplusplus/trunk/client/config.h 2006-10-18 19:43:41 UTC (rev 681)
@@ -1,130 +0,0 @@
-/*
- * Copyright (C) 2001-2006 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.
- */
-
-#if !defined(CONFIG_H)
-#define CONFIG_H
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#ifdef HAVE_CONFIG_H
-#include "autoconf.h"
-#endif
-
-// Remove this line if hashes are not available in your stl
-#define HAVE_HASH 1
-
-// This enables stlport's debug mode (and slows it down to a crawl...)
-//#define _STLP_DEBUG 1
-//#define _STLP_USE_NEWALLOC 1
-
-// --- Shouldn't have to change anything under here...
-
-#ifndef _REENTRANT
-# define _REENTRANT 1
-#endif
-
-#ifdef HAVE_STLPORT
-# define _STLP_DONT_USE_SHORT_STRING_OPTIM 1 // Lots of memory issues with this undefined...wonder what's up with that..
-# define _STLP_USE_PTR_SPECIALIZATIONS 1
-# define _STLP_NO_ANACHRONISMS 1
-# define _STLP_NO_CUSTOM_IO 1
-# define _STLP_NO_IOSTREAMS 1
-# ifndef _DEBUG
-# define _STLP_DONT_USE_EXCEPTIONS 1
-# endif
-#endif
-
-#ifdef _MSC_VER
-# pragma warning(disable: 4711) // function 'xxx' selected for automatic inline expansion
-# pragma warning(disable: 4786) // identifier was truncated to '255' characters in the debug information
-# pragma warning(disable: 4290) // C++ Exception Specification ignored
-# pragma warning(disable: 4127) // constant expression
-# pragma warning(disable: 4710) // function not inlined
-# pragma warning(disable: 4503) // decorated name length exceeded, name was truncated
-# pragma warning(disable: 4428) // universal-character-name encountered in source
-
-# if _MSC_VER == 1200 || _MSC_VER == 1300 || _MSC_VER == 1310 || _MSC_VER == 1400
-
-typedef signed __int8 int8_t;
-typedef signed __int16 int16_t;
-typedef signed __int32 int32_t;
-typedef signed __int64 int64_t;
-
-typedef unsigned __int8 uint8_t;
-typedef unsigned __int16 uint16_t;
-typedef unsigned __int32 uint32_t;
-typedef unsigned __int64 uint64_t;
-
-# endif
-
-#endif
-
-#if defined(_MSC_VER)
-#define _LL(x) x##ll
-#define _ULL(x) x##ull
-#define I64_FMT "%I64d"
-#define U64_FMT "%I64d"
-
-#elif defined(SIZEOF_LONG) && SIZEOF_LONG == 8
-#define _LL(x) x##l
-#define _ULL(x) x##ul
-#define I64_FMT "%ld"
-#define U64_FMT "%ld"
-#else
-#define _LL(x) x##ll
-#define _ULL(x) x##ull
-#define I64_FMT "%lld"
-#define U64_FMT "%lld"
-#endif
-
-#ifdef _WIN32
-
-# define PATH_SEPARATOR '\\'
-# define PATH_SEPARATOR_STR "\\"
-
-#else
-
-# define PATH_SEPARATOR '/'
-# define PATH_SEPARATOR_STR "/"
-
-#endif
-
-#ifdef _MSC_VER
-
-# ifndef CDECL
-# define CDECL _cdecl
-# endif
-
-#else // _MSC_VER
-
-# ifndef CDECL
-# define CDECL
-# endif
-
-#endif // _MSC_VER
-
-#define BZ_NO_STDIO
-
-#ifdef _WIN32
-# define _WIN32_WINNT 0x0501
-# define _WIN32_IE 0x0500
-#endif
-
-#endif // !defined(CONFIG_H)
Modified: dcplusplus/trunk/client/stdinc.h
===================================================================
--- dcplusplus/trunk/client/stdinc.h 2006-10-18 06:53:29 UTC (rev 680)
+++ dcplusplus/trunk/client/stdinc.h 2006-10-18 19:43:41 UTC (rev 681)
@@ -19,9 +19,71 @@
#if !defined(STDINC_H)
#define STDINC_H
-#include "config.h"
+// This enables stlport's debug mode (and slows it down to a crawl...)
+//#define _STLP_DEBUG 1
+//#define _STLP_USE_NEWALLOC 1
+// --- Shouldn't have to change anything under here...
+
+#ifndef _REENTRANT
+# define _REENTRANT 1
+#endif
+
+#ifndef BZ_NO_STDIO
+#define BZ_NO_STDIO 1
+#endif
+
+#ifdef HAVE_STLPORT
+# define _STLP_DONT_USE_SHORT_STRING_OPTIM 1 // Lots of memory issues with this undefined...wonder what's up with that..
+# define _STLP_USE_PTR_SPECIALIZATIONS 1
+# define _STLP_NO_ANACHRONISMS 1
+# define _STLP_NO_CUSTOM_IO 1
+# define _STLP_NO_IOSTREAMS 1
+# ifndef _DEBUG
+# define _STLP_DONT_USE_EXCEPTIONS 1
+# endif
+#endif
+
+#ifdef _MSC_VER
+
+//disable the deprecated warnings for the CRT functions.
+#define _CRT_SECURE_NO_DEPRECATE 1
+#define _ATL_SECURE_NO_DEPRECATE 1
+#define _CRT_NON_CONFORMING_SWPRINTFS 1
+
+# pragma warning(disable: 4711) // function 'xxx' selected for automatic inline expansion
+# pragma warning(disable: 4786) // identifier was truncated to '255' characters in the debug information
+# pragma warning(disable: 4290) // C++ Exception Specification ignored
+# pragma warning(disable: 4127) // constant expression
+# pragma warning(disable: 4710) // function not inlined
+# pragma warning(disable: 4503) // decorated name length exceeded, name was truncated
+# pragma warning(disable: 4428) // universal-character-name encountered in source
+
+typedef signed __int8 int8_t;
+typedef signed __int16 int16_t;
+typedef signed __int32 int32_t;
+typedef signed __int64 int64_t;
+
+typedef unsigned __int8 uint8_t;
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int64 uint64_t;
+
+# ifndef CDECL
+# define CDECL _cdecl
+# endif
+
+#else // _MSC_VER
+
+# ifndef CDECL
+# define CDECL
+# endif
+
+#endif // _MSC_VER
+
#ifdef _WIN32
+# define _WIN32_WINNT 0x0501
+# define _WIN32_IE 0x0500
#define STRICT
#define WIN32_LEAN_AND_MEAN
@@ -32,13 +94,6 @@
#define _ATL_NO_HOSTING
#define _ATL_NO_OLD_NAMES
-#if _MSC_VER == 1400
-//disable the deperecated warnings for the crt functions.
-#define _CRT_SECURE_NO_DEPRECATE 1
-#define _ATL_SECURE_NO_DEPRECATE 1
-#define _CRT_NON_CONFORMING_SWPRINTFS 1
-#endif
-
#include <Winsock2.h>
#include <windows.h>
@@ -68,45 +123,27 @@
#include <functional>
// Use maps if hash_maps aren't available
-#ifdef HAVE_HASH
-# ifdef _STLPORT_VERSION
-# define HASH_SET_X(key, hfunc, eq, order) hash_set<key, hfunc, eq >
-# define HASH_MAP_X(key, type, hfunc, eq, order) hash_map<key, type, hfunc, eq >
-// STLPort 5.0.2 hash_multimap buggy
-# define HASH_MULTIMAP_X(key, type, hfunc, eq, order) multimap<key, type, order >
-# elif defined(__GLIBCPP__) || defined(__GLIBCXX__) // Using GNU C++ library?
-# define HASH_SET_X(key, hfunc, eq, order) hash_set<key, hfunc, eq >
-# define HASH_MAP_X(key, type, hfunc, eq, order) hash_map<key, type, hfunc, eq >
-# define HASH_MULTIMAP_X(key, type, hfunc, eq, order) hash_multimap<key, type, hfunc, eq >
-# elif defined(_MSC_VER) // Assume the msvc 7.x stl
-# define HASH_SET_X(key, hfunc, eq, order) hash_set<key, hfunc >
-# define HASH_MAP_X(key, type, hfunc, eq, order) hash_map<key, type, hfunc >
-# define HASH_MULTIMAP_X(key, type, hfunc, eq, order) hash_multimap<key, type, hfunc >
-# else
-# error Unknown STL, hashes need to be configured
-# endif
-
+#ifdef _STLPORT_VERSION
# define HASH_SET hash_set
# define HASH_MAP hash_map
+// STLPort 5.0.2 hash_multimap buggy
# define HASH_MULTIMAP multimap
+# define HASH_SET_X(key, hfunc, eq, order) hash_set<key, hfunc, eq >
+# define HASH_MAP_X(key, type, hfunc, eq, order) hash_map<key, type, hfunc, eq >
+# define HASH_MULTIMAP_X(key, type, hfunc, eq, order) multimap<key, type, order >
-#else // HAVE_HASH
-
-# define HASH_SET_X(key, hfunc, eq, order)
-# define HASH_SET set
-# define HASH_MAP map
-# define HASH_MAP_X(key, type, hfunc, eq, order) map<key, type, order >
-# define HASH_MULTIMAP multimap
-# define HASH_MULTIMAP_X(key, type, hfunc, eq, order) multimap<key, type, order >
-
-#endif // HAVE_HASH
-
-#ifdef _STLPORT_VERSION
-using namespace std;
#include <hash_map>
#include <hash_set>
+using namespace std;
#elif defined(__GLIBCPP__) || defined(__GLIBCXX__) // Using GNU C++ library?
+# define HASH_SET hash_set
+# define HASH_MAP hash_map
+# define HASH_MULTIMAP hash_multimap
+# define HASH_SET_X(key, hfunc, eq, order) hash_set<key, hfunc, eq >
+# define HASH_MAP_X(key, type, hfunc, eq, order) hash_map<key, type, hfunc, eq >
+# define HASH_MULTIMAP_X(key, type, hfunc, eq, order) hash_multimap<key, type, hfunc, eq >
+
#include <ext/hash_map>
#include <ext/hash_set>
#include <ext/functional>
@@ -117,20 +154,33 @@
namespace __gnu_cxx {
template<> struct hash<std::string> {
size_t operator()(const std::string& x) const
- { return hash<const char*>()(x.c_str()); }
+ { return hash<const char*>()(x.c_str()); }
};
template<> struct hash<long long int> {
size_t operator()(long long int x) const { return x; }
};
}
-#else // __GLIBCPP__
+#elif defined(_MSC_VER) // Assume the msvc stl
+# define HASH_SET hash_set
+# define HASH_MAP hash_map
+# define HASH_MULTIMAP hash_multimap
+# define HASH_SET_X(key, hfunc, eq, order) hash_set<key, hfunc >
+# define HASH_MAP_X(key, type, hfunc, eq, order) hash_map<key, type, hfunc >
+# define HASH_MULTIMAP_X(key, type, hfunc, eq, order) hash_multimap<key, type, hfunc >
+
#include <hash_map>
#include <hash_set>
-
using namespace std;
using namespace stdext;
-#endif // __GLIBCPP__
+#else
+# define HASH_SET set
+# define HASH_MAP map
+# define HASH_SET_X(key, hfunc, eq, order)
+# define HASH_MAP_X(key, type, hfunc, eq, order) map<key, type, order >
+# define HASH_MULTIMAP multimap
+# define HASH_MULTIMAP_X(key, type, hfunc, eq, order) multimap<key, type, order >
+#endif
#endif // !defined(STDINC_H)
Modified: dcplusplus/trunk/client.vcproj
===================================================================
--- dcplusplus/trunk/client.vcproj 2006-10-18 06:53:29 UTC (rev 680)
+++ dcplusplus/trunk/client.vcproj 2006-10-18 19:43:41 UTC (rev 681)
@@ -43,7 +43,6 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""$(SolutionDir)stlport";"$(SolutionDir)wtl";"$(SolutionDir)yassl\include""
- PreprocessorDefinitions="HAVE_STLPORT"
StringPooling="true"
MinimalRebuild="true"
ExceptionHandling="1"
@@ -130,7 +129,6 @@
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
AdditionalIncludeDirectories=""$(SolutionDir)stlport";"$(SolutionDir)wtl";"$(SolutionDir)yassl\include""
- PreprocessorDefinitions="HAVE_STLPORT"
StringPooling="true"
MinimalRebuild="true"
ExceptionHandling="1"
Modified: dcplusplus/trunk/windows/HubFrame.cpp
===================================================================
--- dcplusplus/trunk/windows/HubFrame.cpp 2006-10-18 06:53:29 UTC (rev 680)
+++ dcplusplus/trunk/windows/HubFrame.cpp 2006-10-18 19:43:41 UTC (rev 681)
@@ -37,10 +37,10 @@
HubFrame::FrameMap HubFrame::frames;
-int HubFrame::columnSizes[] = { 100, 75, 75, 100, 75, 100, 125 };
-int HubFrame::columnIndexes[] = { COLUMN_NICK, COLUMN_SHARED, COLUMN_DESCRIPTION, COLUMN_TAG, COLUMN_CONNECTION, COLUMN_EMAIL, COLUMN_CID };
+int HubFrame::columnSizes[] = { 100, 75, 75, 100, 75, 100, 100, 125 };
+int HubFrame::columnIndexes[] = { COLUMN_NICK, COLUMN_SHARED, COLUMN_DESCRIPTION, COLUMN_TAG, COLUMN_CONNECTION, COLUMN_IP, COLUMN_EMAIL, COLUMN_CID };
static ResourceManager::Strings columnNames[] = { ResourceManager::NICK, ResourceManager::SHARED,
-ResourceManager::DESCRIPTION, ResourceManager::TAG, ResourceManager::CONNECTION, ResourceManager::EMAIL, ResourceManager::CID };
+ResourceManager::DESCRIPTION, ResourceManager::TAG, ResourceManager::CONNECTION, ResourceManager::IP_BARE, ResourceManager::EMAIL, ResourceManager::CID };
LRESULT HubFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
@@ -463,6 +463,11 @@
columns[COLUMN_DESCRIPTION] = Text::toT(identity.getDescription());
columns[COLUMN_TAG] = Text::toT(identity.getTag());
columns[COLUMN_CONNECTION] = Text::toT(identity.getConnection());
+ string ip = identity.getIp();
+ string country = ip.empty()?Util::emptyString:Util::getIpCountry(ip);
+ if (!country.empty())
+ ip = country + " (" + ip + ")";
+ columns[COLUMN_IP] = Text::toT(ip);
columns[COLUMN_EMAIL] = Text::toT(identity.getEmail());
columns[COLUMN_CID] = Text::toT(identity.getUser()->getCID().toBase32());
@@ -899,6 +904,45 @@
}
}
+string HubFrame::stripNick(const string& nick) const {
+ if (nick.substr(0, 1) != "[") return nick;
+ string::size_type x = nick.find(']');
+ string ret;
+ // Avoid full deleting of [IMCOOL][CUSIHAVENOTHINGELSETHANBRACKETS]-type nicks
+ if ((x != string::npos) && (nick.substr(x+1).length() > 0)) {
+ ret = nick.substr(x+1);
+ } else {
+ ret = nick;
+ }
+ return ret;
+}
+
+//Has fun side-effects. Otherwise needs reference arguments or multiple-return-values.
+tstring HubFrame::scanNickPrefix(const tstring& prefixT) {
+ string prefix = Text::fromT(prefixT), maxPrefix;
+ tabCompleteNicks.clear();
+ for (UserMap::const_iterator i = userMap.begin(); i != userMap.end(); ++i) {
+ string pre...
[truncated message content] |
|
From: <arn...@us...> - 2006-10-18 21:36:20
|
Revision: 682
http://svn.sourceforge.net/dcplusplus/?rev=682&view=rev
Author: arnetheduck
Date: 2006-10-18 14:36:08 -0700 (Wed, 18 Oct 2006)
Log Message:
-----------
stlport removal
Modified Paths:
--------------
dcplusplus/trunk/DCPlusPlus.vcproj
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/client.vcproj
Removed Paths:
-------------
dcplusplus/trunk/bootstrap
dcplusplus/trunk/stlport/
Modified: dcplusplus/trunk/DCPlusPlus.vcproj
===================================================================
--- dcplusplus/trunk/DCPlusPlus.vcproj 2006-10-18 19:43:41 UTC (rev 681)
+++ dcplusplus/trunk/DCPlusPlus.vcproj 2006-10-18 21:36:08 UTC (rev 682)
@@ -46,7 +46,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories=""$(SolutionDir)stlport";"$(SolutionDir)wtl";"$(SolutionDir)yassl\include""
+ AdditionalIncludeDirectories=""$(SolutionDir)wtl";"$(SolutionDir)yassl\include""
StringPooling="true"
MinimalRebuild="true"
ExceptionHandling="1"
@@ -155,7 +155,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
- AdditionalIncludeDirectories=""$(SolutionDir)stlport";"$(SolutionDir)wtl";"$(SolutionDir)yassl\include""
+ AdditionalIncludeDirectories=""$(SolutionDir)wtl";"$(SolutionDir)yassl\include""
StringPooling="true"
MinimalRebuild="true"
ExceptionHandling="1"
Deleted: dcplusplus/trunk/bootstrap
===================================================================
--- dcplusplus/trunk/bootstrap 2006-10-18 19:43:41 UTC (rev 681)
+++ dcplusplus/trunk/bootstrap 2006-10-18 21:36:08 UTC (rev 682)
@@ -1,9 +0,0 @@
-#!/bin/sh
-echo "bootstrapping (this may take a while)"
-rm -rf build
-mkdir build
-aclocal &&
-libtoolize &&
-autoconf &&
-autoheader &&
-automake --add-missing --force-missing || exit
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2006-10-18 19:43:41 UTC (rev 681)
+++ dcplusplus/trunk/changelog.txt 2006-10-18 21:36:08 UTC (rev 682)
@@ -8,6 +8,7 @@
* Automatic hub reconnection is only done if at least one successful connection has been made
* [bug 1080] Better nick tab completion (thanks cologic)
* [bug 1081] Added user IP in hub frame (thanks cologic)
+* No more STLport for the time being
-- 0.698 2006-10-10 --
* [bug 1065] Code cleanup (thanks steven sheehy)
Modified: dcplusplus/trunk/client.vcproj
===================================================================
--- dcplusplus/trunk/client.vcproj 2006-10-18 19:43:41 UTC (rev 681)
+++ dcplusplus/trunk/client.vcproj 2006-10-18 21:36:08 UTC (rev 682)
@@ -42,7 +42,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories=""$(SolutionDir)stlport";"$(SolutionDir)wtl";"$(SolutionDir)yassl\include""
+ AdditionalIncludeDirectories=""$(SolutionDir)wtl";"$(SolutionDir)yassl\include""
StringPooling="true"
MinimalRebuild="true"
ExceptionHandling="1"
@@ -128,7 +128,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
- AdditionalIncludeDirectories=""$(SolutionDir)stlport";"$(SolutionDir)wtl";"$(SolutionDir)yassl\include""
+ AdditionalIncludeDirectories=""$(SolutionDir)wtl";"$(SolutionDir)yassl\include""
StringPooling="true"
MinimalRebuild="true"
ExceptionHandling="1"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <arn...@us...> - 2006-10-20 12:35:41
|
Revision: 683
http://svn.sourceforge.net/dcplusplus/?rev=683&view=rev
Author: arnetheduck
Date: 2006-10-20 05:35:20 -0700 (Fri, 20 Oct 2006)
Log Message:
-----------
dupe cid detection
Modified Paths:
--------------
dcplusplus/trunk/client/AdcHub.cpp
dcplusplus/trunk/client/AdcHub.h
dcplusplus/trunk/client/ShareManager.cpp
dcplusplus/trunk/release.cmd
Modified: dcplusplus/trunk/client/AdcHub.cpp
===================================================================
--- dcplusplus/trunk/client/AdcHub.cpp 2006-10-18 21:36:08 UTC (rev 682)
+++ dcplusplus/trunk/client/AdcHub.cpp 2006-10-20 12:35:20 UTC (rev 683)
@@ -73,6 +73,16 @@
return i == users.end() ? NULL : i->second;
}
+OnlineUser* AdcHub::findUser(const CID& aCID) const {
+ Lock l(cs);
+ for(SIDMap::const_iterator i = users.begin(); i != users.end(); ++i) {
+ if(i->second->getUser()->getCID() == aCID) {
+ return i->second;
+ }
+ }
+ return 0;
+}
+
void AdcHub::putUser(const uint32_t aSID) {
OnlineUser* ou = 0;
{
@@ -112,12 +122,27 @@
string cid;
OnlineUser* u = 0;
- if(c.getParam("ID", 0, cid))
- u = &getUser(c.getFrom(), CID(cid));
- else if(c.getFrom() == AdcCommand::HUB_SID)
+ if(c.getParam("ID", 0, cid)) {
+ u = findUser(CID(cid));
+ if(u) {
+ if(u->getIdentity().getSID() != c.getFrom()) {
+ // Same CID but different SID not allowed - buggy hub?
+ string nick;
+ if(!c.getParam("NI", 0, nick)) {
+ nick = "[nick unknown]";
+ }
+ fire(ClientListener::StatusMessage(), this, u->getIdentity().getNick() + " (" + u->getIdentity().getSIDString() +
+ ") has same CID {" + cid + "} as " + nick + " (" + AdcCommand::fromSID(c.getFrom()) + "), ignoring.");
+ return;
+ }
+ } else {
+ u = &getUser(c.getFrom(), CID(cid));
+ }
+ } else if(c.getFrom() == AdcCommand::HUB_SID) {
u = &getUser(c.getFrom(), CID());
- else
+ } else {
u = findUser(c.getFrom());
+ }
if(!u) {
dcdebug("AdcHub::INF Unknown user / no ID\n");
Modified: dcplusplus/trunk/client/AdcHub.h
===================================================================
--- dcplusplus/trunk/client/AdcHub.h 2006-10-18 21:36:08 UTC (rev 682)
+++ dcplusplus/trunk/client/AdcHub.h 2006-10-20 12:35:20 UTC (rev 683)
@@ -84,6 +84,7 @@
OnlineUser& getUser(const uint32_t aSID, const CID& aCID);
OnlineUser* findUser(const uint32_t sid) const;
+ OnlineUser* findUser(const CID& cid) const;
void putUser(const uint32_t sid);
void clearUsers();
Modified: dcplusplus/trunk/client/ShareManager.cpp
===================================================================
--- dcplusplus/trunk/client/ShareManager.cpp 2006-10-18 21:36:08 UTC (rev 682)
+++ dcplusplus/trunk/client/ShareManager.cpp 2006-10-20 12:35:20 UTC (rev 683)
@@ -223,10 +223,9 @@
throw ShareException(UserConnection::FILE_NOT_AVAILABLE);
}
-
string::size_type i = virtualFile.find('/', 1);
if(i == string::npos || i == 1) {
- return false;
+ throw ShareException(UserConnection::FILE_NOT_AVAILABLE);
}
string virtualName = virtualFile.substr(1, i-1);
Modified: dcplusplus/trunk/release.cmd
===================================================================
--- dcplusplus/trunk/release.cmd 2006-10-18 21:36:08 UTC (rev 682)
+++ dcplusplus/trunk/release.cmd 2006-10-20 12:35:20 UTC (rev 683)
@@ -2,7 +2,7 @@
copy /b app\dcplusplus.chm .
copy /b app\dcplusplus.pdb .
"c:\program files\WinRAR\WinRAR" a -ep -m5 DCPlusPlus-%1.zip dcppboot.xml unicows.dll unicows.pdb dcplusplus.chm dcplusplus.exe dcplusplus.pdb dbghelp.dll changelog.txt Example.xml License.txt GeoIPCountryWhois.csv
-"c:\program files\WinRAR\WinRAR" a -m5 DCPlusPlus-%1-src.zip dcppboot.xml bootstrap makedefs.py Makefile.am configure.ac libunicows.lib unicows.dll unicows.pdb yassl\* yassl\certs\* yassl\include\openssl\* yassl\mySTL\* yassl\src\* yassl\include\* yassl\taocrypt\* yassl\taocrypt\src\* yassl\taocrypt\include\* stlport\.keep wtl\.keep help\* zlib\* bzip2\* client\* MakeDefs\* res\* windows\* changelog.txt Example.xml License.txt compile.txt GeoIPCountryWhois.csv *.dsp *.vcproj *.dsw *.sln *.rc extensions.txt doxyfile dcplusplus.nsi
+"c:\program files\WinRAR\WinRAR" a -m5 DCPlusPlus-%1-src.zip dcppboot.xml makedefs.py libunicows.lib unicows.dll unicows.pdb yassl\* yassl\certs\* yassl\include\openssl\* yassl\mySTL\* yassl\src\* yassl\include\* yassl\taocrypt\* yassl\taocrypt\src\* yassl\taocrypt\include\* stlport\.keep wtl\.keep help\* zlib\* bzip2\* client\* res\* windows\* changelog.txt Example.xml License.txt compile.txt GeoIPCountryWhois.csv *.vcproj *.sln *.rc extensions.txt doxyfile dcplusplus.nsi
del dcplusplus.exe
del dcplusplus.pdb
del dcplusplus.chm
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <arn...@us...> - 2006-11-02 21:44:56
|
Revision: 684
http://svn.sourceforge.net/dcplusplus/?rev=684&view=rev
Author: arnetheduck
Date: 2006-11-02 13:44:12 -0800 (Thu, 02 Nov 2006)
Log Message:
-----------
Patches & fixes
Modified Paths:
--------------
dcplusplus/trunk/Compile.txt
dcplusplus/trunk/DCPlusPlus.rc
dcplusplus/trunk/DCPlusPlus.vcproj
dcplusplus/trunk/Example.xml
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/client/File.cpp
dcplusplus/trunk/client/SettingsManager.cpp
dcplusplus/trunk/client/SettingsManager.h
dcplusplus/trunk/client/StringDefs.cpp
dcplusplus/trunk/client/StringDefs.h
dcplusplus/trunk/client/stdinc.h
dcplusplus/trunk/help/DCPlusPlus.hhp
dcplusplus/trunk/help/faq_secret.html
dcplusplus/trunk/help/help.vcproj
dcplusplus/trunk/help/index.html
dcplusplus/trunk/help/settings_advanced.html
dcplusplus/trunk/help/settings_appearance.html
dcplusplus/trunk/help/settings_certs.html
dcplusplus/trunk/help/settings_colors_and_sounds.html
dcplusplus/trunk/help/settings_expert.html
dcplusplus/trunk/help/settings_queue.html
dcplusplus/trunk/help/settings_windows.html
dcplusplus/trunk/help/toc.hhc
dcplusplus/trunk/windows/Appearance2Page.cpp
dcplusplus/trunk/windows/Appearance2Page.h
dcplusplus/trunk/windows/HubFrame.cpp
dcplusplus/trunk/windows/PrivateFrame.cpp
dcplusplus/trunk/windows/PropertiesDlg.cpp
dcplusplus/trunk/windows/PropertiesDlg.h
dcplusplus/trunk/windows/resource.h
Modified: dcplusplus/trunk/Compile.txt
===================================================================
--- dcplusplus/trunk/Compile.txt 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/Compile.txt 2006-11-02 21:44:12 UTC (rev 684)
@@ -3,9 +3,6 @@
How to compile in 3 easy steps:
1) Download the source DC++ download site. Unpack the DC++ source.
- Download STLPort 5.0.2 from http://sf.net/stlport and unpack it to a temporary folder. Inside you'll
- find a folder named stlport which contains files such as "algorithm". Copy the contents of this folder
- to the stlport folder where you unpacked DC++.
Download WTL from http://sf.net/projects/wtl. Unpack it to the wtl folder.
2) You most probably have to update your Platform SDK, http://msdn.microsoft.com will tell you how.
@@ -13,10 +10,9 @@
one file, you can ask someone at the dev hub to supply it for you (or look for it in the DC++
bugzilla, it's attached to one of the bugs).
-3) Open the solution in vc7.1 (2004) and press your build button. If you find your executable unreasonably large,
+3) Open the solution in vc8.0 (2005) and press your build button. If you find your executable unreasonably large,
you probably compiled in debug mode - switch to release once you're done testing the code.
-
Note; You'll need DBGHELP.dll from the binary distribution unless you're using WinXP, otherwise
you'll get errors saying symbols are missing when running your compiled executable. My copy
says version 5.1.2600.1106 right now.
@@ -61,4 +57,3 @@
to make it easier for us to defend the gpl against violators. If you don't like this policy, start your own
distribution, if you're lucky it might become more popular than the original =). Please
state explicitly in the bugzilla that you give me copyright over the code if the submission is larger than trivial.
-
Modified: dcplusplus/trunk/DCPlusPlus.rc
===================================================================
--- dcplusplus/trunk/DCPlusPlus.rc 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/DCPlusPlus.rc 2006-11-02 21:44:12 UTC (rev 684)
@@ -7,7 +7,7 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
-#include "wtl\\atlres.h"
+#include "atlres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -234,9 +234,10 @@
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,74,246,10
CONTROL "Make an annoying sound when a private message window is opened",IDC_PRIVATE_MESSAGE_BEEP_OPEN,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,87,246,10
- GROUPBOX "Bold options",IDC_SETTINGS_BOLD_CONTENTS,5,106,263,98
- CONTROL "",IDC_BOLD_BOOLEANS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,10,117,254,81
LTEXT "Note; most of these options require that you restart DC++",IDC_SETTINGS_REQUIRES_RESTART,7,209,253,8
+ LTEXT "Notification sound",IDC_BEEP_NOTIFICATION,10,110,53,8
+ EDITTEXT IDC_BEEPFILE,71,108,133,12,ES_AUTOHSCROLL
+ PUSHBUTTON "&Browse...",IDC_BROWSE,210,109,50,12
END
IDD_LOGPAGE DIALOGEX 0, 0, 275, 225
@@ -440,8 +441,6 @@
RTEXT "File write buffer",IDC_SETTINGS_WRITE_BUFFER,139,10,65,8
EDITTEXT IDC_BUFFERSIZE,208,7,41,14,ES_AUTOHSCROLL
LTEXT "KiB",IDC_SETTINGS_KB,252,10,10,8
- RTEXT "Max tab rows",IDC_SETTINGS_MAX_TAB_ROWS,139,27,65,8
- EDITTEXT IDC_MAX_TAB_ROWS,208,24,41,14,ES_AUTOHSCROLL
RTEXT "Search history",IDC_SETTINGS_SEARCH_HISTORY,139,44,65,8
EDITTEXT IDC_SEARCH_HISTORY,208,41,41,14,ES_AUTOHSCROLL
CONTROL "",IDC_SEARCH_HISTORY_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,246,41,11,14
@@ -453,8 +452,8 @@
RTEXT "Socket write buffer",IDC_SETTINGS_SOCKET_OUT_BUFFER,128,96,76,8
EDITTEXT IDC_SOCKET_OUT_BUFFER,208,93,41,14,ES_AUTOHSCROLL
LTEXT "B",IDC_STATIC,252,96,8,8
- EDITTEXT IDC_AUTO_SEARCH_LIMIT,208,111,41,14,ES_AUTOHSCROLL
- LTEXT "Auto-search limit",IDC_SETTINGS_AUTO_SEARCH_LIMIT,148,113,56,13
+ EDITTEXT IDC_AUTO_SEARCH_LIMIT,208,24,41,14,ES_AUTOHSCROLL
+ LTEXT "Auto-search limit",IDC_SETTINGS_AUTO_SEARCH_LIMIT,148,26,56,13
END
IDD_NETWORKPAGE DIALOGEX 0, 0, 275, 225
@@ -571,7 +570,19 @@
PUSHBUTTON "...",IDC_BROWSE_TRUSTED_PATH,248,42,20,14
END
+IDD_TABSPAGE DIALOGEX 0, 0, 275, 225
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
+EXSTYLE WS_EX_STATICEDGE
+CAPTION "Tabs"
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+BEGIN
+ RTEXT "Max tab rows",IDC_SETTINGS_MAX_TAB_ROWS,8,117,44,8
+ EDITTEXT IDC_MAX_TAB_ROWS,56,115,41,14,ES_AUTOHSCROLL
+ GROUPBOX "Bold options",IDC_SETTINGS_BOLD_CONTENTS,5,8,263,98
+ CONTROL "",IDC_BOLD_BOOLEANS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,10,19,254,81
+END
+
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
@@ -800,6 +811,16 @@
TOPMARGIN, 7
BOTTOMMARGIN, 218
END
+
+ IDD_TABSPAGE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 268
+ VERTGUIDE, 13
+ VERTGUIDE, 261
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 218
+ END
END
#endif // APSTUDIO_INVOKED
Modified: dcplusplus/trunk/DCPlusPlus.vcproj
===================================================================
--- dcplusplus/trunk/DCPlusPlus.vcproj 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/DCPlusPlus.vcproj 2006-11-02 21:44:12 UTC (rev 684)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="8,00"
+ Version="8.00"
Name="DCPlusPlus"
ProjectGUID="{E82610AA-B6FD-4813-B5B9-E717CBD0F23B}"
RootNamespace="DCPlusPlus"
@@ -80,7 +80,7 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/FIXED:NO /SAFESEH:NO"
- AdditionalDependencies="libunicows.lib SHFolder.lib kernel32.lib advapi32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib version.lib mpr.lib rasapi32.lib winmm.lib winspool.lib vfw32.lib secur32.lib oleacc.lib oledlg.lib sensapi.lib htmlhelp.lib ws2_32.lib"
+ AdditionalDependencies="libunicows.lib SHFolder.lib kernel32.lib advapi32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib version.lib mpr.lib rasapi32.lib winmm.lib winspool.lib vfw32.lib secur32.lib oleacc.lib oledlg.lib sensapi.lib htmlhelp.lib ws2_32.lib winmm.lib"
OutputFile="$(SolutionDir)App/$(ProjectName).exe"
LinkIncremental="2"
SuppressStartupBanner="true"
@@ -187,7 +187,7 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/FIXED:NO /SAFESEH:NO"
- AdditionalDependencies="libunicows.lib SHFolder.lib kernel32.lib advapi32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib version.lib mpr.lib rasapi32.lib winmm.lib winspool.lib vfw32.lib secur32.lib oleacc.lib oledlg.lib sensapi.lib htmlhelp.lib ws2_32.lib"
+ AdditionalDependencies="libunicows.lib SHFolder.lib kernel32.lib advapi32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib version.lib mpr.lib rasapi32.lib winmm.lib winspool.lib vfw32.lib secur32.lib oleacc.lib oledlg.lib sensapi.lib htmlhelp.lib ws2_32.lib winmm.lib"
OutputFile="$(SolutionDir)App/$(ProjectName).exe"
Version=""
LinkIncremental="1"
@@ -509,6 +509,10 @@
>
</File>
<File
+ RelativePath=".\windows\TabsPage.cpp"
+ >
+ </File>
+ <File
RelativePath="windows\TextFrame.cpp"
>
</File>
@@ -734,6 +738,10 @@
>
</File>
<File
+ RelativePath=".\windows\TabsPage.h"
+ >
+ </File>
+ <File
RelativePath="windows\TextFrame.h"
>
</File>
Modified: dcplusplus/trunk/Example.xml
===================================================================
--- dcplusplus/trunk/Example.xml 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/Example.xml 2006-11-02 21:44:12 UTC (rev 684)
@@ -463,6 +463,7 @@
<String Name="SettingsMinimizeTray">Minimize to tray</String>
<String Name="SettingsName">Name</String>
<String Name="SettingsNetwork">Connection settings</String>
+ <String Name="SettingsNotificationSound">Notification sound</String>
<String Name="SettingsNoAwaymsgToBots">Don't send the away message to bots</String>
<String Name="SettingsOnlyHashed">Note; Files appear in the share only after they've been hashed!</String>
<String Name="SettingsOnlyTth">Search for files with TTH root only as standard</String>
@@ -519,6 +520,7 @@
<String Name="SettingsPrioNormal">Normal prio max size</String>
<String Name="SettingsPrioLow">Low prio max size</String>
<String Name="SettingsPrioLowest">Set lowest prio for newly added files larger than Low prio size</String>
+ <String Name="SettingsTabs">Appearance\Tabs</String>
<String Name="SettingsTimeStamps">Show timestamps in chat by default</String>
<String Name="SettingsTimeStampsFormat">Set timestamps</String>
<String Name="SettingsToggleActiveWindow">Toggle window when selecting an active tab</String>
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/changelog.txt 2006-11-02 21:44:12 UTC (rev 684)
@@ -9,6 +9,9 @@
* [bug 1080] Better nick tab completion (thanks cologic)
* [bug 1081] Added user IP in hub frame (thanks cologic)
* No more STLport for the time being
+* Linux checks for invalid file types (thanks steven sheehy)
+* Fixed potential crash when search began with space
+* [bug 1085] Better sound playing settings (thanks cologic / ullner)
-- 0.698 2006-10-10 --
* [bug 1065] Code cleanup (thanks steven sheehy)
Modified: dcplusplus/trunk/client/File.cpp
===================================================================
--- dcplusplus/trunk/client/File.cpp 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/client/File.cpp 2006-11-02 21:44:12 UTC (rev 684)
@@ -214,6 +214,12 @@
m |= O_TRUNC;
}
+ struct stat s;
+ if(lstat(aFileName.c_str(), &s) != -1) {
+ if(!S_ISREG(s.st_mode) && !S_ISLNK(s.st_mode))
+ throw FileException("Invalid file type");
+ }
+
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");
@@ -417,7 +423,7 @@
DIR* dir = opendir(Util::getConfigPath().c_str());
if (dir) {
while (struct dirent* ent = readdir(dir)) {
- if (fnmatch("files?*.xml.bz2", ent->d_name, 0) == 0) {
+ if (fnmatch(pattern.c_str(), ent->d_name, 0) == 0) {
ret.push_back(path + ent->d_name);
}
}
Modified: dcplusplus/trunk/client/SettingsManager.cpp
===================================================================
--- dcplusplus/trunk/client/SettingsManager.cpp 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/client/SettingsManager.cpp 2006-11-02 21:44:12 UTC (rev 684)
@@ -44,7 +44,7 @@
"FinishedULWidths", "FinishedULOrder", "CID", "SpyFrameWidths", "SpyFrameOrder", "LogFileMainChat",
"LogFilePrivateChat", "LogFileStatus", "LogFileUpload", "LogFileDownload", "LogFileSystem",
"LogFormatSystem", "LogFormatStatus", "DirectoryListingFrameOrder", "DirectoryListingFrameWidths",
- "TLSPrivateKeyFile", "TLSCertificateFile", "TLSTrustedCertificatesPath",
+ "TLSPrivateKeyFile", "TLSCertificateFile", "TLSTrustedCertificatesPath", "BeepFile",
"SENTRY",
// Ints
"IncomingConnections", "InPort", "Slots", "Rollback", "AutoFollow", "ClearSearch",
Modified: dcplusplus/trunk/client/SettingsManager.h
===================================================================
--- dcplusplus/trunk/client/SettingsManager.h 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/client/SettingsManager.h 2006-11-02 21:44:12 UTC (rev 684)
@@ -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,
- TLS_PRIVATE_KEY_FILE, TLS_CERTIFICATE_FILE, TLS_TRUSTED_CERTIFICATES_PATH,
+ TLS_PRIVATE_KEY_FILE, TLS_CERTIFICATE_FILE, TLS_TRUSTED_CERTIFICATES_PATH, BEEPFILE,
STR_LAST };
enum IntSetting { INT_FIRST = STR_LAST + 1,
Modified: dcplusplus/trunk/client/StringDefs.cpp
===================================================================
--- dcplusplus/trunk/client/StringDefs.cpp 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/client/StringDefs.cpp 2006-11-02 21:44:12 UTC (rev 684)
@@ -464,6 +464,7 @@
"Minimize to tray",
"Name",
"Connection settings",
+"Notification sound",
"Don't send the away message to bots",
"Note; Files appear in the share only after they've been hashed!",
"Search for files with TTH root only as standard",
@@ -520,6 +521,7 @@
"Normal prio max size",
"Low prio max size",
"Set lowest prio for newly added files larger than Low prio size",
+"Appearance\\Tabs",
"Show timestamps in chat by default",
"Set timestamps",
"Toggle window when selecting an active tab",
@@ -1092,6 +1094,7 @@
"SettingsMinimizeTray",
"SettingsName",
"SettingsNetwork",
+"SettingsNotificationSound",
"SettingsNoAwaymsgToBots",
"SettingsOnlyHashed",
"SettingsOnlyTth",
@@ -1148,6 +1151,7 @@
"SettingsPrioNormal",
"SettingsPrioLow",
"SettingsPrioLowest",
+"SettingsTabs",
"SettingsTimeStamps",
"SettingsTimeStampsFormat",
"SettingsToggleActiveWindow",
Modified: dcplusplus/trunk/client/StringDefs.h
===================================================================
--- dcplusplus/trunk/client/StringDefs.h 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/client/StringDefs.h 2006-11-02 21:44:12 UTC (rev 684)
@@ -467,6 +467,7 @@
SETTINGS_MINIMIZE_TRAY, // "Minimize to tray"
SETTINGS_NAME, // "Name"
SETTINGS_NETWORK, // "Connection settings"
+ SETTINGS_NOTIFICATION_SOUND, // "Notification sound"
SETTINGS_NO_AWAYMSG_TO_BOTS, // "Don't send the away message to bots"
SETTINGS_ONLY_HASHED, // "Note; Files appear in the share only after they've been hashed!"
SETTINGS_ONLY_TTH, // "Search for files with TTH root only as standard"
@@ -523,6 +524,7 @@
SETTINGS_PRIO_NORMAL, // "Normal prio max size"
SETTINGS_PRIO_LOW, // "Low prio max size"
SETTINGS_PRIO_LOWEST, // "Set lowest prio for newly added files larger than Low prio size"
+ SETTINGS_TABS, // "Appearance\\Tabs"
SETTINGS_TIME_STAMPS, // "Show timestamps in chat by default"
SETTINGS_TIME_STAMPS_FORMAT, // "Set timestamps"
SETTINGS_TOGGLE_ACTIVE_WINDOW, // "Toggle window when selecting an active tab"
Modified: dcplusplus/trunk/client/stdinc.h
===================================================================
--- dcplusplus/trunk/client/stdinc.h 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/client/stdinc.h 2006-11-02 21:44:12 UTC (rev 684)
@@ -122,7 +122,6 @@
#include <utility>
#include <functional>
-// Use maps if hash_maps aren't available
#ifdef _STLPORT_VERSION
# define HASH_SET hash_set
# define HASH_MAP hash_map
Modified: dcplusplus/trunk/help/DCPlusPlus.hhp
===================================================================
--- dcplusplus/trunk/help/DCPlusPlus.hhp 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/help/DCPlusPlus.hhp 2006-11-02 21:44:12 UTC (rev 684)
@@ -29,12 +29,14 @@
settings_windows.html
settings_queue.html
settings_certs.html
+settings_tabs.html
chat_commands.html
non-routable.html
plusplus_tag.html
netiquette.html
credits.html
adlsearch.html
+public_hubs.html
favorite_hubs.html
favorite_users.html
fdl.html
@@ -73,6 +75,7 @@
IDD_WINDOWSPAGE=settings_windows.html
IDR_ADLSEARCH=adlsearch.html
IDD_CERTSPAGE=settings_certs.html
+IDD_TABSPAGE=settings_tabs.html
[MAP]
#include ..\windows\resource.h
Modified: dcplusplus/trunk/help/faq_secret.html
===================================================================
--- dcplusplus/trunk/help/faq_secret.html 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/help/faq_secret.html 2006-11-02 21:44:12 UTC (rev 684)
@@ -15,7 +15,7 @@
<li>If DC++ receives "banned" during the login phase, it'll stop automatically reconnecting</li>
<li>Your file list will be created on disk the first time someone requests it</li>
<li>Pressing shift on startup will prevent DC++ from autoconnecting to favorite hubs.</li>
- <li>You can tab complete nicks in mainchat (if the option is on), including ignoring prefixes.</li>
+ <li>You can tab complete nicks in mainchat, including ignoring prefixes.</li>
<li>You can drag and drop all tabs to the position of your choice.</li>
<li>You can see who wants to download from you and what they want to download by opening the <a href="waiting_users.html">Waiting users frame</a>.</li>
<li>You can drag folders from Windows Explorer and drop them in the <a href="settings_sharing.html">Sharing </a>page in Settings.</li>
Modified: dcplusplus/trunk/help/help.vcproj
===================================================================
--- dcplusplus/trunk/help/help.vcproj 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/help/help.vcproj 2006-11-02 21:44:12 UTC (rev 684)
@@ -153,6 +153,10 @@
>
</File>
<File
+ RelativePath=".\public_hubs.html"
+ >
+ </File>
+ <File
RelativePath=".\favorite_hubs.html"
>
</File>
@@ -247,6 +251,9 @@
<File
RelativePath=".\settings_windows.html"
>
+ <File
+ RelativePath=".\settings_tabs.html"
+ >
</File>
<File
RelativePath=".\template.html"
Modified: dcplusplus/trunk/help/index.html
===================================================================
--- dcplusplus/trunk/help/index.html 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/help/index.html 2006-11-02 21:44:12 UTC (rev 684)
@@ -35,6 +35,7 @@
<br>
<h2>Windows</h2>
<div style="margin-left: 40px;"><a href="adlsearch.html">ADLSearch</a><br>
+<a href="public_hubs.html">Public hubs</a><br>
<a href="favorite_hubs.html">Favorite Hubs</a><br>
<a href="favorite_users.html">Favorite Users</a></div>
<h2>Frequently Asked Questions</h2>
@@ -61,6 +62,7 @@
<a href="settings_sharing.html">Sharing</a><br>
<a href="settings_appearance.html">Appearance</a><br>
<div style="margin-left: 40px;"><a href="settings_colors_and_sounds.html">Colors and sounds</a><br>
+<a href="settings_tabs.html">Tabs</a><br>
<a href="settings_windows.html">Windows</a><br>
</div>
<a href="settings_advanced.html">Advanced</a>
Modified: dcplusplus/trunk/help/settings_advanced.html
===================================================================
--- dcplusplus/trunk/help/settings_advanced.html 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/help/settings_advanced.html 2006-11-02 21:44:12 UTC (rev 684)
@@ -90,12 +90,6 @@
the first search it matches. If disabled, it may appear multiple times,
if it matches more than one search. <span style="font-style: italic;">Disable
if unsure.</span></dd>
- <dt><a name="tab_completion"></a>Tab Completion of Nicks in Chat</dt>
- <dd>You can use the tab key to complete partial (beginnings) of
-nicknames from the main chat text input field (press tab multiple times
-to switch between multiple nicks). A partial nick will also match if
-comes after something between brackets (e.g. "arne<tab>" would
-match "[BBB]arnetheduck").</dd>
<dt>Enable Safe and Compressed Transfers</dt>
<dd>When transfering data with a compatible client, DC++ will try to
use ZLIB compression with integrity checks. This uses some CPU cycles,
@@ -119,12 +113,8 @@
<dt>Use CTRL for line history</dt>
<dd>Press up arrow while holding down CTRL to scroll through line
history. If not enabled, up arrow will be enough.</dd>
- <dt>Use SSL when remote client supports it</dt>
- <dd>When this option is enabled, DC++ will connect to remote
-clients on an ADC hub that support SSL using SSL. This option is
-an experimental one, and shouldn't imply that DC++ is secure in any way.</dd>
- <span style="font-weight: bold;">Use SSL when remote client supports it<br>
- </span>
+ <dt>Don't automatically disconnect favorite users who leave the hub</dt>
+ <dd>With this option enabled, and <a href="settings_advanced.html#disconnect">Automatically disconnect users who leave the hub</a>, users who are in your <a href="favorite_users.html">Favorite users</a> page are not disconnected.</dd>
</dl>
</body>
</html>
Modified: dcplusplus/trunk/help/settings_appearance.html
===================================================================
--- dcplusplus/trunk/help/settings_appearance.html 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/help/settings_appearance.html 2006-11-02 21:44:12 UTC (rev 684)
@@ -9,6 +9,8 @@
<h1>Appearance</h1>
<h2>Options</h2>
<dl style="margin-left: 40px;">
+ <dt>Sort all downloads first</a>
+ <dd>With this option enabled, DC++ will sort the downloads and uploads; Current download(s), waiting download(s), current upload(s) and waiting upload(s). <br>With this option disabled, DC++ will sort downloads and uploads; Current download(s), current uploads(s), waiting download(s) and waiting upload(s)</dd>
<dt>Filter kick and NMDC Debug Messages</dt>
<dd>When enabled, kick and debug chat messages (sent by other
clients) are hidden from main chat. These messages are generally not
Modified: dcplusplus/trunk/help/settings_certs.html
===================================================================
--- dcplusplus/trunk/help/settings_certs.html 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/help/settings_certs.html 2006-11-02 21:44:12 UTC (rev 684)
@@ -10,13 +10,23 @@
<dl style="margin-left: 40px;">
<dt>Private key file</dt>
- <dd></dd>
+ <dd>This file is your personal and private certificate file. <span style="font-weight: bold;">Do not share this with other users or hubs.</span> If you do, you risk allowing others to use your certificate and in essence pose as you.</dd>
<dt>Own certificate file</dt>
- <dd></dd>
+ <dd>This file is the certificate file you should give to other users and hubs that you want to consider "trusted". </dd>
<dt>Trusted certificates path</dt>
- <dd>Where trusted certificates will be stored. (default: the Certs\ subdirectory of where you've installed the application.) </dd>
+ <dd>Where trusted certificates from users or hubs will be stored. (default: the Certs\ subdirectory of where you've installed the application.) </dd>
</dl>
-
+<h2>Options</h2>
+<dl style="margin-left: 40px;">
+ <dt>Use SSL when remote client supports it</dt>
+ <dd>When this option is enabled, DC++ will connect to remote
+clients on an ADC hub that support SSL using SSL. This option is
+an experimental one, and shouldn't imply that DC++ is secure in any way.</dd>
+ <dt>Allow TLS connections to hubs without trusted certificate</dt>
+ <dd>With this option disabled, all hubs you connect to must have a certificate in your Trusted certificate folder.</dd>
+ <dt>Allow TLS connections to clients without trusted certificate</dt>
+ <dd>With this option disabled, all client you connect to must have a certificate in your Trusted certificate folder.</dd>
+</dl>
To see effects, please restart DC++.<br>
<br>
SSL support is an experimental feature and doesn't imply that DC++ is secure in any way.
Modified: dcplusplus/trunk/help/settings_colors_and_sounds.html
===================================================================
--- dcplusplus/trunk/help/settings_colors_and_sounds.html 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/help/settings_colors_and_sounds.html 2006-11-02 21:44:12 UTC (rev 684)
@@ -35,32 +35,8 @@
<dt>Make an annoying sound when a private message window is opened</dt>
<dd>When set, the system's "Default Beep" sound will play when a
private message window is opened. </dd>
+ <dt>Notification sound</dt>
+ <dd>Instead of the system's computer beep, you can select a different beep or tune for above options.</a>
</dl>
-<h2>Tab bolding on contents change</h2>
-<dl style="margin-left: 40px;">
- <dt>Finished Downloads</dt>
- <dd>When a download completes, the Finished
-Downloads tab will turn bold if this option is selected.</dd>
- <dt>Finished Uploads</dt>
- <dd>When a upload completes, the Finished
-Uploads tab will turn bold if this option is selected.</dd>
- <dt>Download Queue</dt>
- <dd>This option controls whether or not the Download Queue's tab will
-highlight itself when a queue item changes state or finishes.</dd>
- <dt>Hub</dt>
- <dd>When a chat message appears in a hub that's
-not focused the tab will become bold if you have this option selected.</dd>
-<dt>Private message</dt>
- <dd>When a private message appears that's
-not focused the tab will become bold if you have this option selected.</dd>
-<dt>Search</dt>
- <dd>If more search result appear in an open search window that's
-not focused the tab will become bold if you have this option selected.</dd>
-<dt>Waiting users</dt>
- <dd>If a user or an item is added or removed while the tab is not
-focused, the tab will become bold if you have this option selected.</dd>
-<dt>System log</dt>
- <dd>If an system log entry is added while the tab is not focused, the tab will become bold if you have this option selected.</dd>
-</dl>
</body>
</html>
\ No newline at end of file
Modified: dcplusplus/trunk/help/settings_expert.html
===================================================================
--- dcplusplus/trunk/help/settings_expert.html 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/help/settings_expert.html 2006-11-02 21:44:12 UTC (rev 684)
@@ -39,21 +39,15 @@
malformed file lists that require large amounts of memory to decode.
You may need to reduce or increase the value of this setting
based on personal experience. (default: 512 MiB)</dd>
- <dt>CID</dt>
- <dd>This is your unique client ID (CID) used to identify you on
-ADC hubs.</dd>
+ <dt>PID</dt>
+ <dd>This is your unique private ID (PID). This will later with an algorithm be used to identify you on ADC hubs. <span style="font-weight: bold;">Do not share this with other users.</span></dd>
<dt>Auto refresh time</dt>
<dd>This controls the interval at which your shared directories
are rescanned for new and changed content. This is measured
in minutes (default: 60 minutes)</dd>
-
<dt>Write Buffer Size</dt>
<dd>This controls the size of the chunks that DC++ writes to
disk for downloads. Measured in kibibytes. (default: 16 KiB)</dd>
- <dt>Max Tab Rows</dt>
- <dd>The maximum number of rows of tabs that DC++ will make. Any
-tabs that do not fit will be accessible through the chevron at the
-right of the tab control. (default: 2)</dd>
<dt><a name="searchhistory"></a>Search
history</dt>
<dd>Number of old search lines that will be shown in the Search
@@ -76,6 +70,8 @@
<dt>Socket write buffer</dt>
<dd>The size of the buffer DC++ use to write to sockets.
Measured in bytes. (default: 8192 bytes)</dd>
+ <dt>Auto-search limit</dt>
+ <dd>This will limit the amount of sources a file can have before it will no longer be auto searched for. For example, if this option is set to 2, if a file has more than or exactly 2 sources, the file will be excluded from the auto-search list.</dd>
</dl>
</body>
</html>
Modified: dcplusplus/trunk/help/settings_queue.html
===================================================================
--- dcplusplus/trunk/help/settings_queue.html 2006-10-20 12:35:20 UTC (rev 683)
+++ dcplusplus/trunk/help/settings_queue.html 2006-11-02 21:44:12 UTC (rev 684)
@@ -103,8 +103,10 @@
one, will consume some drive space.</dd>
<dt>Don't download files already in share</dt>
<dd>This option will stop you from downloading files which already
-exist in one of your shared directories. Note that this only works with
-those files which have a TTH.</dd>
+exist in one of your shared directories.</dd>
+ <dt>Don't download files already in queue</dt>
+ <dd>This option will stop you from downloading files which already
+exist in your queue.</dd>
<dt><a name="antifrag"></a>Use AntiFragmentation Method for
Downloads</dt>
<dd>This option will try to reserve the full space needed for a file
@@ -124,8 +126,6 @@
block fails verification, the previous block in the file will be tried,
and so on, until a good block is found, or there is no more data in the
file.</dd>
- <dt>Only download files that have a TTH</dt>
- <dd>With this option enabled, DC++ will <span s...
[truncated message content] |
|
From: <arn...@us...> - 2006-12-07 22:43:19
|
Revision: 685
http://svn.sourceforge.net/dcplusplus/?rev=685&view=rev
Author: arnetheduck
Date: 2006-12-07 14:43:16 -0800 (Thu, 07 Dec 2006)
Log Message:
-----------
Cleanup and patches
Modified Paths:
--------------
dcplusplus/trunk/DCPlusPlus.vcproj
dcplusplus/trunk/Example.xml
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/client/ClientManager.h
dcplusplus/trunk/client/CryptoManager.cpp
dcplusplus/trunk/client/DirectoryListing.h
dcplusplus/trunk/client/File.cpp
dcplusplus/trunk/client/File.h
dcplusplus/trunk/client/QueueManager.cpp
dcplusplus/trunk/client/SSLSocket.cpp
dcplusplus/trunk/client/SSLSocket.h
dcplusplus/trunk/client/SettingsManager.cpp
dcplusplus/trunk/client/SettingsManager.h
dcplusplus/trunk/client/Socket.cpp
dcplusplus/trunk/client/StringDefs.cpp
dcplusplus/trunk/client/StringDefs.h
dcplusplus/trunk/client/Thread.h
dcplusplus/trunk/client/UploadManager.cpp
dcplusplus/trunk/client/Util.cpp
dcplusplus/trunk/help/help.vcproj
dcplusplus/trunk/windows/AboutDlg.h
dcplusplus/trunk/windows/AdvancedPage.cpp
dcplusplus/trunk/windows/AppearancePage.cpp
dcplusplus/trunk/windows/FinishedFrameBase.h
dcplusplus/trunk/windows/HubFrame.cpp
dcplusplus/trunk/windows/HubFrame.h
dcplusplus/trunk/windows/MainFrm.cpp
dcplusplus/trunk/windows/SearchFrm.cpp
dcplusplus/trunk/windows/resource.h
Added Paths:
-----------
dcplusplus/trunk/help/public_hubs.html
Modified: dcplusplus/trunk/DCPlusPlus.vcproj
===================================================================
--- dcplusplus/trunk/DCPlusPlus.vcproj 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/DCPlusPlus.vcproj 2006-12-07 22:43:16 UTC (rev 685)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="8.00"
+ Version="8,00"
Name="DCPlusPlus"
ProjectGUID="{E82610AA-B6FD-4813-B5B9-E717CBD0F23B}"
RootNamespace="DCPlusPlus"
@@ -477,6 +477,10 @@
>
</File>
<File
+ RelativePath=".\windows\ShellContextMenu.cpp"
+ >
+ </File>
+ <File
RelativePath=".\windows\SpyFrame.cpp"
>
</File>
@@ -718,6 +722,10 @@
>
</File>
<File
+ RelativePath=".\windows\ShellContextMenu.h"
+ >
+ </File>
+ <File
RelativePath="windows\SingleInstance.h"
>
</File>
Modified: dcplusplus/trunk/Example.xml
===================================================================
--- dcplusplus/trunk/Example.xml 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/Example.xml 2006-12-07 22:43:16 UTC (rev 685)
@@ -501,6 +501,7 @@
<String Name="SettingsSharedDirectories">Shared directories</String>
<String Name="SettingsShowJoins">Show joins / parts in chat by default</String>
<String Name="SettingsShowProgressBars">Show progress bars for transfers</String>
+ <String Name="SettingsShowShellMenu">Show shell menu in finished transfers</String>
<String Name="SettingsSkipZeroByte">Skip zero-byte files</String>
<String Name="SettingsSmallSendBuffer">Use small send buffer (enable if uploads slow downloads a lot)</String>
<String Name="SettingsSocks5">SOCKS5</String>
@@ -508,6 +509,7 @@
<String Name="SettingsSocks5Port">Port</String>
<String Name="SettingsSocks5Resolve">Use SOCKS5 server to resolve host names</String>
<String Name="SettingsSocks5Username">Login</String>
+ <String Name="SettingsSortFavusersFirst">Sort favorite users first</String>
<String Name="SettingsSounds">Sounds</String>
<String Name="SettingsSpeedsNotAccurate">Note; because of changing download speeds, this is not 100% accurate...</String>
<String Name="SettingsStatusInChat">View status messages in main chat</String>
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/changelog.txt 2006-12-07 22:43:16 UTC (rev 685)
@@ -12,6 +12,13 @@
* Linux checks for invalid file types (thanks steven sheehy)
* Fixed potential crash when search began with space
* [bug 1085] Better sound playing settings (thanks cologic / ullner)
+* [bug 1111] OpenSSL compatibility and some unix fixes (thanks steven sheehy)
+* [bug 1056] Added option to sort fav users above other users in hub frame (thanks poy)
+* [bug 1063] Added option to show shell context menu in finished frame (thanks poy)
+* [bug 1092] Fixed TTH tree being redownloaded (thanks stephan hohe)
+* [bug 1097] Fixed waiting users being removed (thanks stephan hohe)
+* [bug 1110] Added new adc hub list (thanks mafa_45)
+* [bug 1091] Added new nmdc hub lists (thanks poy)
-- 0.698 2006-10-10 --
* [bug 1065] Code cleanup (thanks steven sheehy)
Modified: dcplusplus/trunk/client/ClientManager.h
===================================================================
--- dcplusplus/trunk/client/ClientManager.h 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/client/ClientManager.h 2006-12-07 22:43:16 UTC (rev 685)
@@ -137,7 +137,7 @@
void updateCachedIp();
// SettingsManagerListener
- virtual void on(Load, SimpleXML&);
+ virtual void on(Load, SimpleXML&) throw();
// ClientListener
virtual void on(Connected, Client* c) throw() { fire(ClientManagerListener::ClientConnected(), c); }
Modified: dcplusplus/trunk/client/CryptoManager.cpp
===================================================================
--- dcplusplus/trunk/client/CryptoManager.cpp 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/client/CryptoManager.cpp 2006-12-07 22:43:16 UTC (rev 685)
@@ -27,8 +27,6 @@
#include "LogManager.h"
#include "ClientManager.h"
-#include <openssl/ssl.h>
-
#ifdef _WIN32
#include "../bzip2/bzlib.h"
#else
@@ -37,15 +35,19 @@
CryptoManager::CryptoManager()
:
- clientContext(SSL_CTX_new(TLSv1_client_method())),
- serverContext(SSL_CTX_new(TLSv1_server_method())),
- clientVerContext(SSL_CTX_new(TLSv1_client_method())),
- serverVerContext(SSL_CTX_new(TLSv1_server_method())),
dh(DH_new()),
certsLoaded(false),
lock("EXTENDEDPROTOCOLABCABCABCABCABCABC"),
pk("DCPLUSPLUS" VERSIONSTRING "ABCABC")
{
+ SSL_library_init();
+
+ // Probably should check the return value of these.
+ clientContext = SSL_CTX_new(TLSv1_client_method());
+ clientVerContext = SSL_CTX_new(TLSv1_client_method());
+ serverContext = SSL_CTX_new(TLSv1_server_method());
+ serverVerContext = SSL_CTX_new(TLSv1_server_method());
+
static unsigned char dh512_p[] =
{
0xDA,0x58,0x3C,0x16,0xD9,0x85,0x22,0x89,0xD0,0xE4,0xAF,0x75,
@@ -93,7 +95,6 @@
}
void CryptoManager::generateCertificate() throw(CryptoException) {
-#ifdef _WIN32
// Generate certificate using OpenSSL
if(SETTING(TLS_PRIVATE_KEY_FILE).empty()) {
throw CryptoException("No private key file chosen");
@@ -101,6 +102,8 @@
if(SETTING(TLS_CERTIFICATE_FILE).empty()) {
throw CryptoException("No certificate file chosen");
}
+
+#ifdef _WIN32
wstring cmd = L"openssl.exe genrsa -out \"" + Text::utf8ToWide(SETTING(TLS_PRIVATE_KEY_FILE)) + L"\" 2048";
PROCESS_INFORMATION pi = { 0 };
STARTUPINFO si = { 0 };
@@ -124,6 +127,18 @@
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
+#else
+ string cmd = "openssl genrsa -out \"" + Text::utf8ToAcp(SETTING(TLS_PRIVATE_KEY_FILE)) + "\" 2048";
+ if (system(cmd.c_str()) == -1) {
+ throw CryptoException("Failed to spawn process: openssl");
+ }
+
+ cmd = "openssl req -x509 -new -batch -days 3650 -key \"" + Text::utf8ToAcp(SETTING(TLS_PRIVATE_KEY_FILE)) +
+ "\" -out \"" + Text::utf8ToAcp(SETTING(TLS_CERTIFICATE_FILE)) + "\" -subj \"/CN=" +
+ Text::utf8ToAcp(ClientManager::getInstance()->getMyCID().toBase32()) + "\"";
+ if (system(cmd.c_str()) == -1) {
+ throw CryptoException("Failed to spawn process: openssl");
+ }
#endif
}
Modified: dcplusplus/trunk/client/DirectoryListing.h
===================================================================
--- dcplusplus/trunk/client/DirectoryListing.h 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/client/DirectoryListing.h 2006-12-07 22:43:16 UTC (rev 685)
@@ -27,11 +27,10 @@
#include "FastAlloc.h"
#include "MerkleTree.h"
+#include "SimpleXML.h"
+#include "Streams.h"
class ListLoader;
-class SimpleXML;
-class SimpleXMLException;
-class FileException;
class DirectoryListing
{
Modified: dcplusplus/trunk/client/File.cpp
===================================================================
--- dcplusplus/trunk/client/File.cpp 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/client/File.cpp 2006-12-07 22:43:16 UTC (rev 685)
@@ -383,7 +383,7 @@
}
bool File::isAbsolute(const string& path) throw() {
- return path.size() > 1 && path[0] = '/';
+ return path.size() > 1 && path[0] == '/';
}
#endif // !_WIN32
Modified: dcplusplus/trunk/client/File.h
===================================================================
--- dcplusplus/trunk/client/File.h 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/client/File.h 2006-12-07 22:43:16 UTC (rev 685)
@@ -33,6 +33,8 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
+#include <dirent.h>
+#include <fnmatch.h>
#endif
#ifdef _WIN32
Modified: dcplusplus/trunk/client/QueueManager.cpp
===================================================================
--- dcplusplus/trunk/client/QueueManager.cpp 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/client/QueueManager.cpp 2006-12-07 22:43:16 UTC (rev 685)
@@ -729,7 +729,7 @@
if(d->getSize() != -1) {
if(HashManager::getInstance()->getTree(d->getTTH(), d->getTigerTree())) {
d->setTreeValid(true);
- } else if(supportsTrees && !q->getCurrent()->isSet(QueueItem::Source::FLAG_NO_TREE) && d->getSize() > HashManager::MIN_BLOCK_SIZE) {
+ } else if(supportsTrees && !q->getSource(aUser)->isSet(QueueItem::Source::FLAG_NO_TREE) && d->getSize() > HashManager::MIN_BLOCK_SIZE) {
// Get the tree unless the file is small (for small files, we'd probably only get the root anyway)
d->setFlag(Download::FLAG_TREE_DOWNLOAD);
d->getTigerTree().setFileSize(d->getSize());
Modified: dcplusplus/trunk/client/SSLSocket.cpp
===================================================================
--- dcplusplus/trunk/client/SSLSocket.cpp 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/client/SSLSocket.cpp 2006-12-07 22:43:16 UTC (rev 685)
@@ -23,7 +23,7 @@
#include "LogManager.h"
#include "SettingsManager.h"
-#include <openssl/ssl.h>
+#include <openssl/err.h>
SSLSocket::SSLSocket(SSL_CTX* context) throw(SocketException) : ctx(context), ssl(0) {
Modified: dcplusplus/trunk/client/SSLSocket.h
===================================================================
--- dcplusplus/trunk/client/SSLSocket.h 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/client/SSLSocket.h 2006-12-07 22:43:16 UTC (rev 685)
@@ -22,15 +22,15 @@
#include "Socket.h"
#include "Singleton.h"
-class SSLSocket;
+#include <openssl/ssl.h>
-namespace yaSSL {
- class SSL;
- class SSL_CTX;
- struct DH;
-}
+#ifndef SSL_SUCCESS
+#define SSL_SUCCESS 1
+#endif
+#ifdef YASSL_VERSION
using namespace yaSSL;
+#endif
class CryptoManager;
Modified: dcplusplus/trunk/client/SettingsManager.cpp
===================================================================
--- dcplusplus/trunk/client/SettingsManager.cpp 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/client/SettingsManager.cpp 2006-12-07 22:43:16 UTC (rev 685)
@@ -75,7 +75,7 @@
"OpenWaitingUsers", "BoldWaitingUsers", "OpenSystemLog", "BoldSystemLog", "AutoRefreshTime",
"UseTLS", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", "PromptPassword", "SpyFrameIgnoreTthSearches",
"DontDlAlreadyQueued", "MaxCommandLength", "AllowUntrustedHubs", "AllowUntrustedClients",
- "TLSPort", "FastHash",
+ "TLSPort", "FastHash", "SortFavUsersFirst", "ShowShellMenu",
"SENTRY",
// Int64
"TotalUpload", "TotalDownload",
@@ -135,7 +135,7 @@
setDefault(IGNORE_BOT_PMS, false);
setDefault(LIST_DUPES, true);
setDefault(BUFFER_SIZE, 64);
- setDefault(HUBLIST_SERVERS, "http://home.bandicoot.nl/adchublist.xml.bz2;http://www.hublist.org/PublicHubList.xml.bz2");
+ setDefault(HUBLIST_SERVERS, "http://home.bandicoot.nl/adchublist.xml.bz2;http://adchublist.com/hublist.xml.bz2;http://www.hublist.org/PublicHubList.xml.bz2;http://dchublist.com/hublist.xml.bz2");
setDefault(DOWNLOAD_SLOTS, 3);
setDefault(MAX_DOWNLOAD_SPEED, 0);
setDefault(LOG_DIRECTORY, Util::getConfigPath() + "Logs" PATH_SEPARATOR_STR);
@@ -269,6 +269,8 @@
setDefault(ALLOW_UNTRUSTED_HUBS, true);
setDefault(ALLOW_UNTRUSTED_CLIENTS, true);
setDefault(FAST_HASH, true);
+ setDefault(SORT_FAVUSERS_FIRST, false);
+ setDefault(SHOW_SHELL_MENU, false);
#ifdef _WIN32
setDefault(MAIN_WINDOW_STATE, SW_SHOWNORMAL);
Modified: dcplusplus/trunk/client/SettingsManager.h
===================================================================
--- dcplusplus/trunk/client/SettingsManager.h 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/client/SettingsManager.h 2006-12-07 22:43:16 UTC (rev 685)
@@ -91,7 +91,7 @@
OPEN_WAITING_USERS, BOLD_WAITING_USERS, OPEN_SYSTEM_LOG, BOLD_SYSTEM_LOG, AUTO_REFRESH_TIME,
USE_TLS, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, PROMPT_PASSWORD, SPY_FRAME_IGNORE_TTH_SEARCHES,
DONT_DL_ALREADY_QUEUED, MAX_COMMAND_LENGTH, ALLOW_UNTRUSTED_HUBS, ALLOW_UNTRUSTED_CLIENTS,
- TLS_PORT, FAST_HASH,
+ TLS_PORT, FAST_HASH, SORT_FAVUSERS_FIRST, SHOW_SHELL_MENU,
INT_LAST };
enum Int64Setting { INT64_FIRST = INT_LAST + 1,
Modified: dcplusplus/trunk/client/Socket.cpp
===================================================================
--- dcplusplus/trunk/client/Socket.cpp 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/client/Socket.cpp 2006-12-07 22:43:16 UTC (rev 685)
@@ -109,7 +109,7 @@
check(::bind(sock, (sockaddr *)&sock_addr, sizeof(sock_addr)));
}
int size = sizeof(sock_addr);
- getsockname(sock, (sockaddr*)&sock_addr, &size);
+ getsockname(sock, (sockaddr*)&sock_addr, (socklen_t*)&size);
return ntohs(sock_addr.sin_port);
}
Modified: dcplusplus/trunk/client/StringDefs.cpp
===================================================================
--- dcplusplus/trunk/client/StringDefs.cpp 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/client/StringDefs.cpp 2006-12-07 22:43:16 UTC (rev 685)
@@ -502,6 +502,7 @@
"Shared directories",
"Show joins / parts in chat by default",
"Show progress bars for transfers",
+"Show shell menu in finished transfers",
"Skip zero-byte files",
"Use small send buffer (enable if uploads slow downloads a lot)",
"SOCKS5",
@@ -509,6 +510,7 @@
"Port",
"Use SOCKS5 server to resolve host names",
"Login",
+"Sort favorite users first",
"Sounds",
"Note; because of changing download speeds, this is not 100% accurate...",
"View status messages in main chat",
@@ -1132,6 +1134,7 @@
"SettingsSharedDirectories",
"SettingsShowJoins",
"SettingsShowProgressBars",
+"SettingsShowShellMenu",
"SettingsSkipZeroByte",
"SettingsSmallSendBuffer",
"SettingsSocks5",
@@ -1139,6 +1142,7 @@
"SettingsSocks5Port",
"SettingsSocks5Resolve",
"SettingsSocks5Username",
+"SettingsSortFavusersFirst",
"SettingsSounds",
"SettingsSpeedsNotAccurate",
"SettingsStatusInChat",
Modified: dcplusplus/trunk/client/StringDefs.h
===================================================================
--- dcplusplus/trunk/client/StringDefs.h 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/client/StringDefs.h 2006-12-07 22:43:16 UTC (rev 685)
@@ -505,6 +505,7 @@
SETTINGS_SHARED_DIRECTORIES, // "Shared directories"
SETTINGS_SHOW_JOINS, // "Show joins / parts in chat by default"
SETTINGS_SHOW_PROGRESS_BARS, // "Show progress bars for transfers"
+ SETTINGS_SHOW_SHELL_MENU, // "Show shell menu in finished transfers"
SETTINGS_SKIP_ZERO_BYTE, // "Skip zero-byte files"
SETTINGS_SMALL_SEND_BUFFER, // "Use small send buffer (enable if uploads slow downloads a lot)"
SETTINGS_SOCKS5, // "SOCKS5"
@@ -512,6 +513,7 @@
SETTINGS_SOCKS5_PORT, // "Port"
SETTINGS_SOCKS5_RESOLVE, // "Use SOCKS5 server to resolve host names"
SETTINGS_SOCKS5_USERNAME, // "Login"
+ SETTINGS_SORT_FAVUSERS_FIRST, // "Sort favorite users first"
SETTINGS_SOUNDS, // "Sounds"
SETTINGS_SPEEDS_NOT_ACCURATE, // "Note; because of changing download speeds, this is not 100% accurate..."
SETTINGS_STATUS_IN_CHAT, // "View status messages in main chat"
Modified: dcplusplus/trunk/client/Thread.h
===================================================================
--- dcplusplus/trunk/client/Thread.h 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/client/Thread.h 2006-12-07 22:43:16 UTC (rev 685)
@@ -105,6 +105,13 @@
pthread_mutex_unlock(&mtx);
return ret;
}
+ static long safeExchange(volatile long& target, long value) {
+ pthread_mutex_lock(&mtx);
+ long ret = target;
+ target = value;
+ pthread_mutex_unlock(&mtx);
+ return ret;
+ }
#endif
protected:
Modified: dcplusplus/trunk/client/UploadManager.cpp
===================================================================
--- dcplusplus/trunk/client/UploadManager.cpp 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/client/UploadManager.cpp 2006-12-07 22:43:16 UTC (rev 685)
@@ -371,8 +371,12 @@
void UploadManager::addFailedUpload(const UserConnection& source, string filename) {
{
Lock l(cs);
- if (!count_if(waitingUsers.begin(), waitingUsers.end(), CompareFirst<User::Ptr, uint32_t>(source.getUser())))
+ UserList::iterator it = find_if(waitingUsers.begin(), waitingUsers.end(), CompareFirst<User::Ptr, uint32_t>(source.getUser()));
+ if (it==waitingUsers.end()) {
waitingUsers.push_back(WaitingUser(source.getUser(), GET_TICK()));
+ } else {
+ it->second = GET_TICK();
+ }
waitingFiles[source.getUser()].insert(filename); //files for which user's asked
}
Modified: dcplusplus/trunk/client/Util.cpp
===================================================================
--- dcplusplus/trunk/client/Util.cpp 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/client/Util.cpp 2006-12-07 22:43:16 UTC (rev 685)
@@ -95,7 +95,7 @@
systemPath = "/etc/";
char* home = getenv("HOME");
configPath = home ? home + string("/.dc++/") : "/tmp/";
-#error dataPath = wherever linux should fetch data
+ dataPath = configPath; // dataPath in linux is usually prefix + /share/app_name, so we can't represent it here
#endif
// Load boot settings
@@ -112,8 +112,6 @@
params["APPDATA"] = Text::fromT((::SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, path), path));
params["PERSONAL"] = Text::fromT((::SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, path), path));
configPath = Util::formatParams(boot.getChildData(), params, false);
-#else
-#error TODO - make env vars available perhaps?
#endif
}
} catch(const Exception& ) {
@@ -378,7 +376,7 @@
return Text::fromT(buf);
#else
char buf[64];
- snprintf(buf, sizeof(buf), "%'lld", aBytes);
+ snprintf(buf, sizeof(buf), "%'lld", (long long int)aBytes);
return string(buf) + STRING(B);
#endif
}
Modified: dcplusplus/trunk/help/help.vcproj
===================================================================
--- dcplusplus/trunk/help/help.vcproj 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/help/help.vcproj 2006-12-07 22:43:16 UTC (rev 685)
@@ -153,10 +153,6 @@
>
</File>
<File
- RelativePath=".\public_hubs.html"
- >
- </File>
- <File
RelativePath=".\favorite_hubs.html"
>
</File>
@@ -197,6 +193,10 @@
>
</File>
<File
+ RelativePath=".\public_hubs.html"
+ >
+ </File>
+ <File
RelativePath=".\settings_advanced.html"
>
</File>
@@ -251,9 +251,6 @@
<File
RelativePath=".\settings_windows.html"
>
- <File
- RelativePath=".\settings_tabs.html"
- >
</File>
<File
RelativePath=".\template.html"
Added: dcplusplus/trunk/help/public_hubs.html
===================================================================
--- dcplusplus/trunk/help/public_hubs.html (rev 0)
+++ dcplusplus/trunk/help/public_hubs.html 2006-12-07 22:43:16 UTC (rev 685)
@@ -0,0 +1,46 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <title>Public hubs</title>
+ <meta content="text/html; charset=us-ascii" http-equiv="content-type">
+ <link type="text/css" rel="stylesheet" href="office11.css">
+</head>
+<body>
+<h1>Public hubs</h1>
+<h2>Columns</h2>
+<dl style="margin-left: 40px;">
+ <dt>Name</dt>
+ <dd>The name of the hub</dd>
+ <dt>Description</dt>
+ <dd>The hub's description</dd>
+ <dt>Users</dt>
+ <dd>Amount of users in the hub when the hub was checked by a hublist bot</dd>
+ <dt>Address</dt>
+ <dd>The hub's address</dd>
+ <dt>Country</dt>
+ <dd>Which country the hub resides in</dd>
+ <dt>Shared</dt>
+ <dd>Amount of bytes shared in the hub when the hub was checked by a hublist bot</dd>
+ <dt>Min share</dt>
+ <dd>A restriction in the hub, where Min Share in the minimum amount of bytes you have to share to be let in</dd>
+ <dt>Min Slots</dt>
+ <dd>A restriction in the hub, where Min Slots in the minimum amount of slots you have to have open to be let in</dd>
+ <dt>Max hubs</dt>
+ <dd>A restriction in the hub, where Max Hubs in the maximum amount of hubs you are allowed to be in to be let in</dd>
+ <dt>Max Users</dt>
+ <dd>A restriction in the hub, where Max Users in the maximum amount of users the hub will let in</dd>
+ <dt>Reliability</dt>
+ <dd>How often the hub has been online, in per centage</dd>
+ <dt>Rating</dt>
+ <dd>If the hublist allowed users to vote on a hub, this will appear as the hub's rating. The more stars, the better.</dd>
+</dl>
+<h2>Filter</h2>
+Here, you can filter the hublist so you will only see specific hubs in the hublist. Eg, selecting 'address' in the drop down, and writing "foo" in the filter, will only display hubs that have "foo" in their address.
+<h2>Configured Public Hub lists</h2>
+In the dropdown, you may select different hublists you want to see. Press the 'Refresh' button to download a fresh version of the hublist.
+<br>
+If you click on 'Configure', you will be able to change, add and remove hublists. The order in 'Configured Public Hub lists' determine the order hublists are displayed in the dropdown mentioned above.
+<a href="http://dcpp.net/hublist" target="_blank" class="external">List of alternative hublists.</a>
+<img title="External Link" src="external.png" border="0" height="10" width="10" alt="External Link">
+</body>
+</html>
Modified: dcplusplus/trunk/windows/AboutDlg.h
===================================================================
--- dcplusplus/trunk/windows/AboutDlg.h 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/windows/AboutDlg.h 2006-12-07 22:43:16 UTC (rev 685)
@@ -42,7 +42,7 @@
_T("defr, ullner, fleetcommand, liny, xan, olle svensson, mark gillespie, jeremy huddleston, ")
_T("bsod, sulan, jonathan stone, tim burton, izzzo, guitarm, paka, nils maier, jens oknelid, yoji, ")
_T("krzysztof tyszecki, poison, pothead, pur, bigmuscle, martin, jove, bart vullings, ")
-_T("steven sheehy, tobias nygren, poy, dorian. ")
+_T("steven sheehy, tobias nygren, poy, dorian, stephan hohe, mafa_45. ")
_T("Keep it coming!");
class AboutDlg : public CDialogImpl<AboutDlg>, private HttpConnectionListener
Modified: dcplusplus/trunk/windows/AdvancedPage.cpp
===================================================================
--- dcplusplus/trunk/windows/AdvancedPage.cpp 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/windows/AdvancedPage.cpp 2006-12-07 22:43:16 UTC (rev 685)
@@ -48,6 +48,7 @@
{ SettingsManager::ADD_FINISHED_INSTANTLY, ResourceManager::SETTINGS_ADD_FINISHED_INSTANTLY },
{ SettingsManager::USE_CTRL_FOR_LINE_HISTORY, ResourceManager::SETTINGS_USE_CTRL_FOR_LINE_HISTORY },
{ SettingsManager::AUTO_KICK_NO_FAVS, ResourceManager::SETTINGS_AUTO_KICK_NO_FAVS },
+ { SettingsManager::SHOW_SHELL_MENU, ResourceManager::SETTINGS_SHOW_SHELL_MENU },
{ 0, ResourceManager::SETTINGS_AUTO_AWAY }
};
Modified: dcplusplus/trunk/windows/AppearancePage.cpp
===================================================================
--- dcplusplus/trunk/windows/AppearancePage.cpp 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/windows/AppearancePage.cpp 2006-12-07 22:43:16 UTC (rev 685)
@@ -52,6 +52,7 @@
{ SettingsManager::STATUS_IN_CHAT, ResourceManager::SETTINGS_STATUS_IN_CHAT },
{ SettingsManager::SHOW_JOINS, ResourceManager::SETTINGS_SHOW_JOINS },
{ SettingsManager::FAV_SHOW_JOINS, ResourceManager::SETTINGS_FAV_SHOW_JOINS },
+ { SettingsManager::SORT_FAVUSERS_FIRST, ResourceManager::SETTINGS_SORT_FAVUSERS_FIRST },
{ SettingsManager::USE_SYSTEM_ICONS, ResourceManager::SETTINGS_USE_SYSTEM_ICONS },
{ SettingsManager::USE_OEM_MONOFONT, ResourceManager::SETTINGS_USE_OEM_MONOFONT },
{ SettingsManager::GET_USER_COUNTRY, ResourceManager::SETTINGS_GET_USER_COUNTRY },
Modified: dcplusplus/trunk/windows/FinishedFrameBase.h
===================================================================
--- dcplusplus/trunk/windows/FinishedFrameBase.h 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/windows/FinishedFrameBase.h 2006-12-07 22:43:16 UTC (rev 685)
@@ -28,6 +28,7 @@
#include "FlatTabCtrl.h"
#include "ExListViewCtrl.h"
+#include "ShellContextMenu.h"
#include "WinUtil.h"
#include "TextFrame.h"
@@ -200,7 +201,32 @@
WinUtil::getContextMenuPos(ctrlList, pt);
}
- ctxMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, m_hWnd);
+ bool bShellMenuShown = false;
+ if(BOOLSETTING(SHOW_SHELL_MENU) && (ctrlList.GetSelectedCount() == 1)) {
+ tstring path = Text::toT(((FinishedItem*)ctrlList.GetItemData(ctrlList.GetSelectedIndex()))->getTarget());
+ if(GetFileAttributes(path.c_str()) != 0xFFFFFFFF) { // Check that the file still exists
+ CShellContextMenu shellMenu;
+ shellMenu.SetPath(path);
+
+ CMenu* pShellMenu = shellMenu.GetMenu();
+ pShellMenu->AppendMenu(MF_STRING, IDC_VIEW_AS_TEXT, CTSTRING(VIEW_AS_TEXT));
+ pShellMenu->AppendMenu(MF_STRING, IDC_OPEN_FOLDER, CTSTRING(OPEN_FOLDER));
+ pShellMenu->AppendMenu(MF_SEPARATOR);
+ pShellMenu->AppendMenu(MF_STRING, IDC_REMOVE, CTSTRING(REMOVE));
+ pShellMenu->AppendMenu(MF_STRING, IDC_TOTAL, CTSTRING(REMOVE_ALL));
+ pShellMenu->AppendMenu(MF_SEPARATOR);
+
+ UINT idCommand = shellMenu.ShowContextMenu(m_hWnd, pt);
+ if(idCommand != 0)
+ PostMessage(WM_COMMAND, idCommand);
+
+ bShellMenuShown = true;
+ }
+ }
+
+ if(!bShellMenuShown)
+ ctxMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, m_hWnd);
+
return TRUE;
}
bHandled = FALSE;
Modified: dcplusplus/trunk/windows/HubFrame.cpp
===================================================================
--- dcplusplus/trunk/windows/HubFrame.cpp 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/windows/HubFrame.cpp 2006-12-07 22:43:16 UTC (rev 685)
@@ -143,6 +143,7 @@
MoveWindow(rc, TRUE);
}
+ FavoriteManager::getInstance()->addListener(this);
TimerManager::getInstance()->addListener(this);
return 1;
@@ -653,6 +654,7 @@
LRESULT HubFrame::onClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) {
if(!closed) {
TimerManager::getInstance()->removeListener(this);
+ FavoriteManager::getInstance()->removeListener(this);
client->removeListener(this);
client->disconnect(true);
@@ -1232,6 +1234,11 @@
}
}
+void HubFrame::resortUsers() {
+ for(FrameIter i = frames.begin(); i != frames.end(); ++i)
+ i->second->resortForFavsFirst(true);
+}
+
void HubFrame::closeDisconnected() {
for(FrameIter i=frames.begin(); i!= frames.end(); ++i) {
if (!(i->second->client->isConnected())) {
@@ -1240,6 +1247,20 @@
}
}
+void HubFrame::on(FavoriteManagerListener::UserAdded, const FavoriteUser& /*aUser*/) throw() {
+ resortForFavsFirst();
+}
+void HubFrame::on(FavoriteManagerListener::UserRemoved, const FavoriteUser& /*aUser*/) throw() {
+ resortForFavsFirst();
+}
+
+void HubFrame::resortForFavsFirst(bool justDoIt /* = false */) {
+ if(justDoIt || BOOLSETTING(SORT_FAVUSERS_FIRST)) {
+ resort = true;
+ PostMessage(WM_SPEAKER);
+ }
+}
+
void HubFrame::on(Second, uint32_t /*aTick*/) throw() {
updateStatusBar();
if(updateUsers) {
@@ -1265,7 +1286,7 @@
updateUsers = true;
}
-void HubFrame::on(UserRemoved, Client*, const OnlineUser& user) throw() {
+void HubFrame::on(ClientListener::UserRemoved, Client*, const OnlineUser& user) throw() {
speak(REMOVE_USER, user);
}
Modified: dcplusplus/trunk/windows/HubFrame.h
===================================================================
--- dcplusplus/trunk/windows/HubFrame.h 2006-11-02 21:44:12 UTC (rev 684)
+++ dcplusplus/trunk/windows/HubFrame.h 2006-12-07 22:43:16 UTC (rev 685)
@@ -41,8 +41,8 @@
struct CompareItems;
class HubFrame : public MDITabChildWindowImpl<HubFrame>, private ClientListener,
- public CSplitterImpl<HubFrame>, private TimerManagerListener, public UCHandler<HubFrame>,
- public UserInfoBaseHandler<HubFrame>
+ public CSplitterImpl<HubFrame>, private FavoriteManagerListener, private TimerManagerListener,
+ public UCHandler<HubFrame>, public UserInfoBaseHandler<HubFrame>
{
public:
DECLARE_FRAME_WND_CLASS_EX(_T("HubFrame"), IDR_HUB, 0, COLOR_3DFACE);
@@ -122,6 +122,7 @@
void runUserCommand(::UserCommand& uc);
static void openWindow(const tstring& server);
+ static void resortUsers();
static void closeDisconnected();
LRESULT onSetFocus(UINT /* uMsg */, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
@@ -226,10 +227,19 @@
static int compareItems(const UserInfo* a, const UserInfo* b, int col) {
if(col == COLUMN_NICK) {
- if(a->getIdentity().isOp() && !b->getIdentity().isOp()) {
+ bool a_isOp = a->getIdentity().isOp(),
+ b_isOp = b->getIdentity().isOp();
+ if(a_isOp && !b_isOp)
return -1;
- } else if(!a->getIdentity().isOp() && b->getIdentity().isOp()) {
+ if(!a_isOp && b_isOp)
return 1;
+ if(BOOLSETTING(SORT_FAVUSERS_FIRST)) {
+ bool a_isFav = FavoriteManager::getInstance()->isFavoriteUser(a->getIdentity().getUser()),
+ b_isFav = FavoriteManager::getInstance()->is...
[truncated message content] |
|
From: <arn...@us...> - 2006-12-13 17:10:10
|
Revision: 687
http://svn.sourceforge.net/dcplusplus/?rev=687&view=rev
Author: arnetheduck
Date: 2006-12-13 09:10:06 -0800 (Wed, 13 Dec 2006)
Log Message:
-----------
Patches & ADC connect fix
Modified Paths:
--------------
dcplusplus/trunk/DCPlusPlus.rc
dcplusplus/trunk/DCPlusPlus.vcproj
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.h
dcplusplus/trunk/client/ClientManager.cpp
dcplusplus/trunk/client/ClientManager.h
dcplusplus/trunk/client/ConnectionManager.cpp
dcplusplus/trunk/client/ConnectionManager.h
dcplusplus/trunk/client/NmdcHub.cpp
dcplusplus/trunk/client/NmdcHub.h
dcplusplus/trunk/client/SSLSocket.cpp
dcplusplus/trunk/client/SSLSocket.h
dcplusplus/trunk/client/SearchManager.cpp
dcplusplus/trunk/client/SearchManager.h
dcplusplus/trunk/client/ServerSocket.cpp
dcplusplus/trunk/client/ServerSocket.h
dcplusplus/trunk/client/Socket.cpp
dcplusplus/trunk/client/Socket.h
dcplusplus/trunk/client/UploadManager.cpp
dcplusplus/trunk/client/UserConnection.cpp
dcplusplus/trunk/client/UserConnection.h
dcplusplus/trunk/client/Util.cpp
dcplusplus/trunk/client.vcproj
dcplusplus/trunk/help/help.vcproj
dcplusplus/trunk/windows/SearchFrm.cpp
dcplusplus/trunk/windows/TransferView.cpp
Modified: dcplusplus/trunk/DCPlusPlus.rc
===================================================================
--- dcplusplus/trunk/DCPlusPlus.rc 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/DCPlusPlus.rc 2006-12-13 17:10:06 UTC (rev 687)
@@ -235,8 +235,8 @@
CONTROL "Make an annoying sound when a private message window is opened",IDC_PRIVATE_MESSAGE_BEEP_OPEN,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,87,246,10
LTEXT "Note; most of these options require that you restart DC++",IDC_SETTINGS_REQUIRES_RESTART,7,209,253,8
- LTEXT "Notification sound",IDC_BEEP_NOTIFICATION,10,110,53,8
- EDITTEXT IDC_BEEPFILE,71,108,133,12,ES_AUTOHSCROLL
+ LTEXT "Notification sound",IDC_BEEP_NOTIFICATION,10,110,66,8
+ EDITTEXT IDC_BEEPFILE,85,108,119,12,ES_AUTOHSCROLL
PUSHBUTTON "&Browse...",IDC_BROWSE,210,109,50,12
END
Modified: dcplusplus/trunk/DCPlusPlus.vcproj
===================================================================
--- dcplusplus/trunk/DCPlusPlus.vcproj 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/DCPlusPlus.vcproj 2006-12-13 17:10:06 UTC (rev 687)
@@ -168,6 +168,7 @@
PrecompiledHeaderThrough="stdafx.h"
AssemblerOutput="4"
WarningLevel="4"
+ Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
CallingConvention="1"
CompileAs="0"
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/changelog.txt 2006-12-13 17:10:06 UTC (rev 687)
@@ -19,6 +19,8 @@
* [bug 1097] Fixed waiting users being removed (thanks stephan hohe)
* [bug 1110] Added new adc hub list (thanks mafa_45)
* [bug 1091] Added new nmdc hub lists (thanks poy)
+* [bug 1112] Port sign cleanup (thanks steven sheehy)
+* Fixed ADC client-to-client connection sequence
-- 0.698 2006-10-10 --
* [bug 1065] Code cleanup (thanks steven sheehy)
Modified: dcplusplus/trunk/client/AdcHub.cpp
===================================================================
--- dcplusplus/trunk/client/AdcHub.cpp 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/AdcHub.cpp 2006-12-13 17:10:06 UTC (rev 687)
@@ -268,6 +268,11 @@
string token;
bool hasToken = c.getParam("TO", 2, token);
+ if(!hasToken) {
+ // @todo remove this bugfix for <=0.698 some time
+ token = c.getParam(2);
+ }
+
bool secure;
if(protocol == CLIENT_PROTOCOL) {
secure = false;
@@ -290,7 +295,7 @@
return;
}
- ConnectionManager::getInstance()->adcConnect(*u, (short)Util::toInt(port), token, secure);
+ ConnectionManager::getInstance()->adcConnect(*u, static_cast<uint16_t>(Util::toInt(port)), token, secure);
}
void AdcHub::handle(AdcCommand::RCM, AdcCommand& c) throw() {
@@ -357,7 +362,7 @@
void AdcHub::sendUDP(const AdcCommand& cmd) throw() {
string command;
string ip;
- short port;
+ uint16_t port;
{
Lock l(cs);
SIDMap::const_iterator i = users.find(cmd.getTo());
@@ -370,7 +375,7 @@
return;
}
ip = ou.getIdentity().getIp();
- port = static_cast<short>(Util::toInt(ou.getIdentity().getUdpPort()));
+ port = static_cast<uint16_t>(Util::toInt(ou.getIdentity().getUdpPort()));
command = cmd.toString(ou.getUser()->getCID());
}
try {
@@ -417,9 +422,8 @@
SearchManager::getInstance()->onRES(c, ou->getUser());
}
-void AdcHub::connect(const OnlineUser& user) {
- uint32_t r = Util::rand();
- connect(user, Util::toString(r), CryptoManager::getInstance()->TLSOk() && user.getUser()->isSet(User::TLS));
+void AdcHub::connect(const OnlineUser& user, const string& token) {
+ connect(user, token, CryptoManager::getInstance()->TLSOk() && user.getUser()->isSet(User::TLS));
}
void AdcHub::connect(const OnlineUser& user, string const& token, bool secure) {
@@ -428,15 +432,15 @@
const string& proto = secure ? SECURE_CLIENT_PROTOCOL : CLIENT_PROTOCOL;
if(ClientManager::getInstance()->isActive()) {
- short port = secure ? ConnectionManager::getInstance()->getSecurePort() : ConnectionManager::getInstance()->getPort();
+ uint16_t port = secure ? ConnectionManager::getInstance()->getSecurePort() : ConnectionManager::getInstance()->getPort();
if(port == 0) {
// Oops?
LogManager::getInstance()->message(STRING(NOT_LISTENING));
return;
}
- send(AdcCommand(AdcCommand::CMD_CTM, user.getIdentity().getSID(), AdcCommand::TYPE_DIRECT).addParam(proto).addParam(Util::toString(port)).addParam(token));
+ send(AdcCommand(AdcCommand::CMD_CTM, user.getIdentity().getSID(), AdcCommand::TYPE_DIRECT).addParam(proto).addParam(Util::toString(port)).addParam("TO", token));
} else {
- send(AdcCommand(AdcCommand::CMD_RCM, user.getIdentity().getSID(), AdcCommand::TYPE_DIRECT).addParam(proto));
+ send(AdcCommand(AdcCommand::CMD_RCM, user.getIdentity().getSID(), AdcCommand::TYPE_DIRECT).addParam(proto).addParam("TO", token));
}
}
Modified: dcplusplus/trunk/client/AdcHub.h
===================================================================
--- dcplusplus/trunk/client/AdcHub.h 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/AdcHub.h 2006-12-13 17:10:06 UTC (rev 687)
@@ -35,7 +35,7 @@
using Client::send;
using Client::connect;
- virtual void connect(const OnlineUser& user);
+ virtual void connect(const OnlineUser& user, const string& token);
void connect(const OnlineUser& user, string const& token, bool secure);
virtual void hubMessage(const string& aMessage);
Modified: dcplusplus/trunk/client/BufferedSocket.cpp
===================================================================
--- dcplusplus/trunk/client/BufferedSocket.cpp 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/BufferedSocket.cpp 2006-12-13 17:10:06 UTC (rev 687)
@@ -101,7 +101,7 @@
}
-void BufferedSocket::connect(const string& aAddress, short aPort, bool secure, bool allowUntrusted, bool proxy) throw(SocketException, ThreadException) {
+void BufferedSocket::connect(const string& aAddress, uint16_t aPort, bool secure, bool allowUntrusted, bool proxy) throw(SocketException, ThreadException) {
dcassert(!sock);
try {
@@ -129,7 +129,7 @@
}
#define CONNECT_TIMEOUT 30000
-void BufferedSocket::threadConnect(const string& aAddr, short aPort, bool proxy) throw(SocketException) {
+void BufferedSocket::threadConnect(const string& aAddr, uint16_t aPort, bool proxy) throw(SocketException) {
dcdebug("threadConnect %s:%d\n", aAddr.c_str(), (int)aPort);
dcassert(sock);
if(!sock)
Modified: dcplusplus/trunk/client/BufferedSocket.h
===================================================================
--- dcplusplus/trunk/client/BufferedSocket.h 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/BufferedSocket.h 2006-12-13 17:10:06 UTC (rev 687)
@@ -87,7 +87,7 @@
}
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);
+ void connect(const string& aAddress, uint16_t 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; }
@@ -129,9 +129,9 @@
virtual ~TaskData() { }
};
struct ConnectInfo : public TaskData {
- ConnectInfo(string addr_, short port_, bool proxy_) : addr(addr_), port(port_), proxy(proxy_) { }
+ ConnectInfo(string addr_, uint16_t port_, bool proxy_) : addr(addr_), port(port_), proxy(proxy_) { }
string addr;
- short port;
+ uint16_t port;
bool proxy;
};
struct SendFileInfo : public TaskData {
@@ -167,7 +167,7 @@
virtual int run();
- void threadConnect(const string& aAddr, short aPort, bool proxy) throw(SocketException);
+ void threadConnect(const string& aAddr, uint16_t aPort, bool proxy) throw(SocketException);
void threadRead() throw(SocketException);
void threadSendFile(InputStream* is) throw(Exception);
void threadSendData();
Modified: dcplusplus/trunk/client/Client.h
===================================================================
--- dcplusplus/trunk/client/Client.h 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/Client.h 2006-12-13 17:10:06 UTC (rev 687)
@@ -86,7 +86,7 @@
virtual void connect();
virtual void disconnect(bool graceless);
- virtual void connect(const OnlineUser& user) = 0;
+ virtual void connect(const OnlineUser& user, const string& token) = 0;
virtual void hubMessage(const string& aMessage) = 0;
virtual void privateMessage(const OnlineUser& user, const string& aMessage) = 0;
virtual void sendUserCmd(const string& aUserCmd) = 0;
@@ -104,7 +104,7 @@
bool isConnected() const { return socket && socket->isConnected(); }
bool isOp() const { return getMyIdentity().isOp(); }
- short getPort() const { return port; }
+ uint16_t getPort() const { return port; }
const string& getAddress() const { return address; }
const string& getIp() const { return ip; }
Modified: dcplusplus/trunk/client/ClientManager.cpp
===================================================================
--- dcplusplus/trunk/client/ClientManager.cpp 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/ClientManager.cpp 2006-12-13 17:10:06 UTC (rev 687)
@@ -144,13 +144,13 @@
Lock l(cs);
string ip;
- short port = 411;
+ uint16_t port = 411;
string::size_type i = ipPort.find(':');
if(i == string::npos) {
ip = ipPort;
} else {
ip = ipPort.substr(0, i);
- port = (short)Util::toInt(ipPort.substr(i+1));
+ port = static_cast<uint16_t>(Util::toInt(ipPort.substr(i+1)));
}
string url;
@@ -277,12 +277,12 @@
}
}
-void ClientManager::connect(const User::Ptr& p) {
+void ClientManager::connect(const User::Ptr& p, const string& token) {
Lock l(cs);
OnlineIter i = onlineUsers.find(p->getCID());
if(i != onlineUsers.end()) {
OnlineUser* u = i->second;
- u->getClient().connect(*u);
+ u->getClient().connect(*u, token);
}
}
@@ -306,7 +306,7 @@
u.getClient().send(cmd);
} else {
try {
- udp.writeTo(u.getIdentity().getIp(), static_cast<short>(Util::toInt(u.getIdentity().getUdpPort())), cmd.toString(getMe()->getCID()));
+ udp.writeTo(u.getIdentity().getIp(), static_cast<uint16_t>(Util::toInt(u.getIdentity().getUdpPort())), cmd.toString(getMe()->getCID()));
} catch(const SocketException&) {
dcdebug("Socket exception sending ADC UDP command\n");
}
Modified: dcplusplus/trunk/client/ClientManager.h
===================================================================
--- dcplusplus/trunk/client/ClientManager.h 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/ClientManager.h 2006-12-13 17:10:06 UTC (rev 687)
@@ -78,7 +78,7 @@
User::Ptr& getMe();
- void connect(const User::Ptr& p);
+ void connect(const User::Ptr& p, const string& token);
void send(AdcCommand& c, const CID& to);
void privateMessage(const User::Ptr& p, const string& msg);
Modified: dcplusplus/trunk/client/ConnectionManager.cpp
===================================================================
--- dcplusplus/trunk/client/ConnectionManager.cpp 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/ConnectionManager.cpp 2006-12-13 17:10:06 UTC (rev 687)
@@ -46,7 +46,7 @@
void ConnectionManager::listen() throw(SocketException){
disconnect();
- unsigned short port = static_cast<unsigned short>(SETTING(TCP_PORT));
+ uint16_t port = static_cast<uint16_t>(SETTING(TCP_PORT));
server = new Server(false, port, SETTING(BIND_ADDRESS));
@@ -55,7 +55,7 @@
return;
}
- port = static_cast<unsigned short>(SETTING(TLS_PORT));
+ port = static_cast<uint16_t>(SETTING(TLS_PORT));
secureServer = new Server(true, port, SETTING(BIND_ADDRESS));
}
@@ -170,7 +170,7 @@
if(cqi->getState() == ConnectionQueueItem::WAITING) {
if(startDown) {
cqi->setState(ConnectionQueueItem::CONNECTING);
- ClientManager::getInstance()->connect(cqi->getUser());
+ ClientManager::getInstance()->connect(cqi->getUser(), cqi->getToken());
fire(ConnectionManagerListener::StatusChanged(), cqi);
attemptDone = true;
} else {
@@ -215,7 +215,7 @@
static const uint32_t FLOOD_TRIGGER = 20000;
static const uint32_t FLOOD_ADD = 2000;
-ConnectionManager::Server::Server(bool secure_, short aPort, const string& ip /* = "0.0.0.0" */) : port(0), secure(secure_), die(false) {
+ConnectionManager::Server::Server(bool secure_, uint16_t aPort, const string& ip /* = "0.0.0.0" */) : port(0), secure(secure_), die(false) {
sock.create();
port = sock.bind(aPort, ip);
sock.listen();
@@ -273,7 +273,7 @@
}
}
-void ConnectionManager::nmdcConnect(const string& aServer, short aPort, const string& aNick, const string& hubUrl) {
+void ConnectionManager::nmdcConnect(const string& aServer, uint16_t aPort, const string& aNick, const string& hubUrl) {
if(shuttingDown)
return;
@@ -290,7 +290,7 @@
}
}
-void ConnectionManager::adcConnect(const OnlineUser& aUser, short aPort, const string& aToken, bool secure) {
+void ConnectionManager::adcConnect(const OnlineUser& aUser, uint16_t aPort, const string& aToken, bool secure) {
if(shuttingDown)
return;
@@ -315,7 +315,6 @@
server = secureServer = 0;
}
-
void ConnectionManager::on(AdcCommand::SUP, UserConnection* aSource, const AdcCommand& cmd) throw() {
if(aSource->getState() != UserConnection::STATE_SUPNICK) {
// Already got this once, ignore...@todo fix support updates
@@ -608,7 +607,28 @@
return;
}
+ string token;
if(aSource->isSet(UserConnection::FLAG_INCOMING)) {
+ if(!cmd.getParam("TO", 0, token)) {
+ aSource->send(AdcCommand(AdcCommand::SEV_FATAL, AdcCommand::ERROR_GENERIC, "TO missing"));
+ putConnection(aSource);
+ return;
+ }
+ } else {
+ token = aSource->getToken();
+ }
+
+ bool down = true;
+ {
+ Lock l(cs);
+ ConnectionQueueItem::Iter i = find(downloads.begin(), downloads.end(), aSource->getUser());
+ if(i == downloads.end() || (*i)->getToken() != token) {
+ down = false;
+ }
+ /** @todo check tokens for upload connections */
+ }
+
+ if(down) {
aSource->setFlag(UserConnection::FLAG_DOWNLOAD);
addDownloadConnection(aSource);
} else {
@@ -617,6 +637,17 @@
}
}
+void ConnectionManager::force(const User::Ptr& aUser) {
+ Lock l(cs);
+
+ ConnectionQueueItem::Iter i = find(downloads.begin(), downloads.end(), aUser);
+ if(i == downloads.end()) {
+ return;
+ }
+
+ (*i)->setLastAttempt(0);
+}
+
void ConnectionManager::on(UserConnectionListener::Failed, UserConnection* aSource, const string& aError) throw() {
Lock l(cs);
Modified: dcplusplus/trunk/client/ConnectionManager.h
===================================================================
--- dcplusplus/trunk/client/ConnectionManager.h 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/ConnectionManager.h 2006-12-13 17:10:06 UTC (rev 687)
@@ -48,7 +48,7 @@
ACTIVE // In one up/downmanager
};
- ConnectionQueueItem(const User::Ptr& aUser, bool aDownload) : state(WAITING), lastAttempt(0), download(aDownload), user(aUser) { }
+ ConnectionQueueItem(const User::Ptr& aUser, bool aDownload) : state(WAITING), lastAttempt(0), download(aDownload), token(Util::toString(Util::rand())), user(aUser) { }
User::Ptr& getUser() { return user; }
const User::Ptr& getUser() const { return user; }
@@ -56,6 +56,7 @@
GETSET(State, state, State);
GETSET(uint32_t, lastAttempt, LastAttempt);
GETSET(bool, download, Download);
+ GETSET(string, token, Token);
private:
ConnectionQueueItem(const ConnectionQueueItem&);
ConnectionQueueItem& operator=(const ConnectionQueueItem&);
@@ -103,10 +104,11 @@
expectedConnections.add(aNick, aMyNick, aHubUrl);
}
- void nmdcConnect(const string& aServer, short aPort, const string& aMyNick, const string& hubUrl);
- void adcConnect(const OnlineUser& aUser, short aPort, const string& aToken, bool secure);
+ void nmdcConnect(const string& aServer, uint16_t aPort, const string& aMyNick, const string& hubUrl);
+ void adcConnect(const OnlineUser& aUser, uint16_t aPort, const string& aToken, bool secure);
void getDownloadConnection(const User::Ptr& aUser);
+ void force(const User::Ptr& aUser);
void disconnect(const User::Ptr& aUser, int isDownload);
@@ -116,20 +118,20 @@
void listen() throw(SocketException);
void disconnect() throw();
- unsigned short getPort() { return server ? static_cast<unsigned short>(server->getPort()) : 0; }
- unsigned short getSecurePort() { return secureServer ? static_cast<unsigned short>(secureServer->getPort()) : 0; }
+ uint16_t getPort() { return server ? static_cast<uint16_t>(server->getPort()) : 0; }
+ uint16_t getSecurePort() { return secureServer ? static_cast<uint16_t>(secureServer->getPort()) : 0; }
private:
class Server : public Thread {
public:
- Server(bool secure_, short port, const string& ip = "0.0.0.0");
- short getPort() { return port; }
+ Server(bool secure_, uint16_t port, const string& ip = "0.0.0.0");
+ uint16_t getPort() { return port; }
virtual ~Server() { die = true; join(); }
private:
virtual int run() throw();
Socket sock;
- short port;
+ uint16_t port;
bool secure;
bool die;
};
Modified: dcplusplus/trunk/client/NmdcHub.cpp
===================================================================
--- dcplusplus/trunk/client/NmdcHub.cpp 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/NmdcHub.cpp 2006-12-13 17:10:06 UTC (rev 687)
@@ -44,7 +44,7 @@
#define checkstate() if(state != STATE_NORMAL) return
-void NmdcHub::connect(const OnlineUser& aUser) {
+void NmdcHub::connect(const OnlineUser& aUser, const string&) {
checkstate();
dcdebug("NmdcHub::connect %s\n", aUser.getIdentity().getNick().c_str());
if(ClientManager::getInstance()->isActive()) {
@@ -417,7 +417,7 @@
return;
}
string port = param.substr(j+1);
- ConnectionManager::getInstance()->nmdcConnect(server, (unsigned short)Util::toInt(port), getMyNick(), getHubUrl());
+ ConnectionManager::getInstance()->nmdcConnect(server, static_cast<uint16_t>(Util::toInt(port)), getMyNick(), getHubUrl());
} else if(cmd == "$RevConnectToMe") {
if(state != STATE_NORMAL) {
return;
Modified: dcplusplus/trunk/client/NmdcHub.h
===================================================================
--- dcplusplus/trunk/client/NmdcHub.h 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/NmdcHub.h 2006-12-13 17:10:06 UTC (rev 687)
@@ -39,7 +39,7 @@
using Client::send;
using Client::connect;
- virtual void connect(const OnlineUser& aUser);
+ virtual void connect(const OnlineUser& aUser, const string&);
virtual void hubMessage(const string& aMessage);
virtual void privateMessage(const OnlineUser& aUser, const string& aMessage);
Modified: dcplusplus/trunk/client/SSLSocket.cpp
===================================================================
--- dcplusplus/trunk/client/SSLSocket.cpp 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/SSLSocket.cpp 2006-12-13 17:10:06 UTC (rev 687)
@@ -29,7 +29,7 @@
}
-void SSLSocket::connect(const string& aIp, short aPort) throw(SocketException) {
+void SSLSocket::connect(const string& aIp, uint16_t aPort) throw(SocketException) {
Socket::setBlocking(true);
Socket::connect(aIp, aPort);
Modified: dcplusplus/trunk/client/SSLSocket.h
===================================================================
--- dcplusplus/trunk/client/SSLSocket.h 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/SSLSocket.h 2006-12-13 17:10:06 UTC (rev 687)
@@ -39,7 +39,7 @@
virtual ~SSLSocket() throw() {}
virtual void accept(const Socket& listeningSocket) throw(SocketException);
- virtual void connect(const string& aIp, short aPort) throw(SocketException);
+ virtual void connect(const string& aIp, uint16_t aPort) throw(SocketException);
virtual int read(void* aBuffer, int aBufLen) throw(SocketException);
virtual int write(const void* aBuffer, int aLen) throw(SocketException);
virtual int wait(uint32_t millis, int waitFor) throw(SocketException);
Modified: dcplusplus/trunk/client/SearchManager.cpp
===================================================================
--- dcplusplus/trunk/client/SearchManager.cpp 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/SearchManager.cpp 2006-12-13 17:10:06 UTC (rev 687)
@@ -102,7 +102,7 @@
socket = new Socket();
socket->create(Socket::TYPE_UDP);
- port = socket->bind(static_cast<short>(SETTING(UDP_PORT)));
+ port = socket->bind(static_cast<uint16_t>(SETTING(UDP_PORT)));
start();
}
Modified: dcplusplus/trunk/client/SearchManager.h
===================================================================
--- dcplusplus/trunk/client/SearchManager.h 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/SearchManager.h 2006-12-13 17:10:06 UTC (rev 687)
@@ -142,7 +142,7 @@
void respond(const AdcCommand& cmd, const CID& cid);
- unsigned short getPort()
+ uint16_t getPort()
{
return port;
}
@@ -166,7 +166,7 @@
private:
Socket* socket;
- unsigned short port;
+ uint16_t port;
bool stop;
uint32_t lastSearch;
friend class Singleton<SearchManager>;
Modified: dcplusplus/trunk/client/ServerSocket.cpp
===================================================================
--- dcplusplus/trunk/client/ServerSocket.cpp 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/ServerSocket.cpp 2006-12-13 17:10:06 UTC (rev 687)
@@ -22,7 +22,7 @@
#include "ServerSocket.h"
#include "SettingsManager.h"
-void ServerSocket::listen(short aPort) throw(SocketException) {
+void ServerSocket::listen(uint16_t aPort) throw(SocketException) {
socket.disconnect();
socket.create(Socket::TYPE_TCP);
// Set reuse address option...
Modified: dcplusplus/trunk/client/ServerSocket.h
===================================================================
--- dcplusplus/trunk/client/ServerSocket.h 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/ServerSocket.h 2006-12-13 17:10:06 UTC (rev 687)
@@ -39,7 +39,7 @@
public:
ServerSocket() throw() { }
- void listen(short port) throw(SocketException);
+ void listen(uint16_t port) throw(SocketException);
void disconnect() throw() { socket.disconnect(); }
/** This is called by windows whenever an "FD_ACCEPT" is sent...doesn't work with unix... */
Modified: dcplusplus/trunk/client/Socket.cpp
===================================================================
--- dcplusplus/trunk/client/Socket.cpp 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/Socket.cpp 2006-12-13 17:10:06 UTC (rev 687)
@@ -26,7 +26,7 @@
#include "TimerManager.h"
string Socket::udpServer;
-short Socket::udpPort;
+uint16_t Socket::udpPort;
#define checkconnected() if(!isConnected()) throw SocketException(ENOTCONN))
@@ -97,7 +97,7 @@
}
-short Socket::bind(short aPort, const string& aIp /* = 0.0.0.0 */) throw (SocketException){
+uint16_t Socket::bind(uint16_t aPort, const string& aIp /* = 0.0.0.0 */) throw (SocketException){
sockaddr_in sock_addr;
sock_addr.sin_family = AF_INET;
@@ -118,7 +118,7 @@
connected = true;
}
-void Socket::connect(const string& aAddr, short aPort) throw(SocketException) {
+void Socket::connect(const string& aAddr, uint16_t aPort) throw(SocketException) {
sockaddr_in serv_addr;
if(sock == INVALID_SOCKET) {
@@ -149,7 +149,7 @@
}
}
-void Socket::socksConnect(const string& aAddr, short aPort, uint32_t timeout) throw(SocketException) {
+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));
@@ -160,7 +160,7 @@
uint32_t start = GET_TICK();
- connect(SETTING(SOCKS_SERVER), (short)SETTING(SOCKS_PORT));
+ 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));
@@ -363,7 +363,7 @@
* @param aLen Data length
* @throw SocketExcpetion Send failed.
*/
-void Socket::writeTo(const string& aAddr, short aPort, const void* aBuffer, int aLen, bool proxy) throw(SocketException) {
+void Socket::writeTo(const string& aAddr, uint16_t aPort, const void* aBuffer, int aLen, bool proxy) throw(SocketException) {
if(aLen <= 0)
return;
@@ -530,7 +530,7 @@
try {
Socket s;
s.setBlocking(false);
- s.connect(SETTING(SOCKS_SERVER), (short)SETTING(SOCKS_PORT));
+ s.connect(SETTING(SOCKS_SERVER), static_cast<uint16_t>(SETTING(SOCKS_PORT)));
s.socksAuth(SOCKS_TIMEOUT);
char connStr[10];
@@ -553,7 +553,7 @@
return;
}
- udpPort = (short)ntohs(*((uint16_t*)(&connStr[8])));
+ udpPort = static_cast<uint16_t>(ntohs(*((uint16_t*)(&connStr[8]))));
in_addr serv_addr;
Modified: dcplusplus/trunk/client/Socket.h
===================================================================
--- dcplusplus/trunk/client/Socket.h 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/Socket.h 2006-12-13 17:10:06 UTC (rev 687)
@@ -80,7 +80,7 @@
};
Socket() throw(SocketException) : sock(INVALID_SOCKET), connected(false), blocking(true) { }
- Socket(const string& aIp, short aPort) throw(SocketException) : sock(INVALID_SOCKET), connected(false), blocking(true) { connect(aIp, aPort); }
+ Socket(const string& aIp, uint16_t aPort) throw(SocketException) : sock(INVALID_SOCKET), connected(false), blocking(true) { connect(aIp, aPort); }
virtual ~Socket() throw() { Socket::disconnect(); }
/**
@@ -90,12 +90,12 @@
* @param aPort Server port.
* @throw SocketException If any connection error occurs.
*/
- virtual void connect(const string& aIp, short aPort) throw(SocketException);
- void connect(const string& aIp, const string& aPort) throw(SocketException) { connect(aIp, (short)Util::toInt(aPort)); }
+ virtual void connect(const string& aIp, uint16_t aPort) throw(SocketException);
+ void connect(const string& aIp, const string& aPort) throw(SocketException) { connect(aIp, static_cast<uint16_t>(Util::toInt(aPort))); }
/**
* Same as connect(), but through the SOCKS5 server
*/
- void socksConnect(const string& aIp, short aPort, uint32_t timeout = 0) throw(SocketException);
+ void socksConnect(const string& aIp, uint16_t aPort, uint32_t timeout = 0) throw(SocketException);
/**
* Sends data, will block until all data has been sent or an exception occurs
@@ -106,8 +106,8 @@
void writeAll(const void* aBuffer, int aLen, uint32_t timeout = 0) throw(SocketException);
virtual int write(const void* aBuffer, int aLen) throw(SocketException);
int write(const string& aData) throw(SocketException) { return write(aData.data(), (int)aData.length()); }
- virtual void writeTo(const string& aIp, short aPort, const void* aBuffer, int aLen, bool proxy = true) throw(SocketException);
- void writeTo(const string& aIp, short aPort, const string& aData) throw(SocketException) { writeTo(aIp, aPort, aData.data(), (int)aData.length()); }
+ virtual void writeTo(const string& aIp, uint16_t aPort, const void* aBuffer, int aLen, bool proxy = true) throw(SocketException);
+ void writeTo(const string& aIp, uint16_t aPort, const string& aData) throw(SocketException) { writeTo(aIp, aPort, aData.data(), (int)aData.length()); }
virtual void shutdown() throw();
virtual void close() throw();
void disconnect() throw();
@@ -169,7 +169,7 @@
virtual void create(int aType = TYPE_TCP) throw(SocketException);
/** Binds a socket to a certain local port and possibly IP. */
- virtual short bind(short aPort = 0, const string& aIp = "0.0.0.0") throw(SocketException);
+ virtual uint16_t bind(uint16_t aPort = 0, const string& aIp = "0.0.0.0") throw(SocketException);
virtual void listen() throw(SocketException);
virtual void accept(const Socket& listeningSocket) throw(SocketException);
@@ -197,7 +197,7 @@
static Stats stats;
static string udpServer;
- static short udpPort;
+ static uint16_t udpPort;
private:
Socket(const Socket&);
@@ -208,8 +208,8 @@
#ifdef _WIN32
static int getLastError() { return ::WSAGetLastError(); }
- static int checksocket(socket_t ret) {
- if(ret == (socket_t) SOCKET_ERROR) {
+ static int checksocket(int ret) {
+ if(ret == SOCKET_ERROR) {
throw SocketException(getLastError());
}
return ret;
Modified: dcplusplus/trunk/client/UploadManager.cpp
===================================================================
--- dcplusplus/trunk/client/UploadManager.cpp 2006-12-07 22:44:50 UTC (rev 686)
+++ dcplusplus/trunk/client/UploadManager.cpp 2006-12-13 17:10:06 UTC (rev 687)
@@ -271,7 +271,7 @@
reserv...
[truncated message content] |
|
From: <arn...@us...> - 2006-12-13 20:39:46
|
Revision: 688
http://svn.sourceforge.net/dcplusplus/?rev=688&view=rev
Author: arnetheduck
Date: 2006-12-13 12:39:44 -0800 (Wed, 13 Dec 2006)
Log Message:
-----------
yassl update
Modified Paths:
--------------
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/client/stdinc.h
dcplusplus/trunk/yassl/README
dcplusplus/trunk/yassl/certs/taoCert.txt
dcplusplus/trunk/yassl/include/buffer.hpp
dcplusplus/trunk/yassl/include/cert_wrapper.hpp
dcplusplus/trunk/yassl/include/crypto_wrapper.hpp
dcplusplus/trunk/yassl/include/factory.hpp
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_imp.hpp
dcplusplus/trunk/yassl/include/yassl_int.hpp
dcplusplus/trunk/yassl/include/yassl_types.hpp
dcplusplus/trunk/yassl/src/cert_wrapper.cpp
dcplusplus/trunk/yassl/src/crypto_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/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/aes.hpp
dcplusplus/trunk/yassl/taocrypt/include/arc4.hpp
dcplusplus/trunk/yassl/taocrypt/include/asn.hpp
dcplusplus/trunk/yassl/taocrypt/include/block.hpp
dcplusplus/trunk/yassl/taocrypt/include/blowfish.hpp
dcplusplus/trunk/yassl/taocrypt/include/config.h.in
dcplusplus/trunk/yassl/taocrypt/include/des.hpp
dcplusplus/trunk/yassl/taocrypt/include/error.hpp
dcplusplus/trunk/yassl/taocrypt/include/file.hpp
dcplusplus/trunk/yassl/taocrypt/include/hmac.hpp
dcplusplus/trunk/yassl/taocrypt/include/integer.hpp
dcplusplus/trunk/yassl/taocrypt/include/md5.hpp
dcplusplus/trunk/yassl/taocrypt/include/misc.hpp
dcplusplus/trunk/yassl/taocrypt/include/modes.hpp
dcplusplus/trunk/yassl/taocrypt/include/pwdbased.hpp
dcplusplus/trunk/yassl/taocrypt/include/ripemd.hpp
dcplusplus/trunk/yassl/taocrypt/include/rsa.hpp
dcplusplus/trunk/yassl/taocrypt/include/sha.hpp
dcplusplus/trunk/yassl/taocrypt/include/twofish.hpp
dcplusplus/trunk/yassl/taocrypt/src/aes.cpp
dcplusplus/trunk/yassl/taocrypt/src/algebra.cpp
dcplusplus/trunk/yassl/taocrypt/src/arc4.cpp
dcplusplus/trunk/yassl/taocrypt/src/asn.cpp
dcplusplus/trunk/yassl/taocrypt/src/blowfish.cpp
dcplusplus/trunk/yassl/taocrypt/src/des.cpp
dcplusplus/trunk/yassl/taocrypt/src/dh.cpp
dcplusplus/trunk/yassl/taocrypt/src/integer.cpp
dcplusplus/trunk/yassl/taocrypt/src/md4.cpp
dcplusplus/trunk/yassl/taocrypt/src/md5.cpp
dcplusplus/trunk/yassl/taocrypt/src/misc.cpp
dcplusplus/trunk/yassl/taocrypt/src/random.cpp
dcplusplus/trunk/yassl/taocrypt/src/ripemd.cpp
dcplusplus/trunk/yassl/taocrypt/src/sha.cpp
dcplusplus/trunk/yassl/taocrypt/src/template_instnt.cpp
dcplusplus/trunk/yassl/taocrypt/src/twofish.cpp
dcplusplus/trunk/yassl/taocrypt/taocrypt.vcproj
dcplusplus/trunk/yassl/yassl.vcproj
Added Paths:
-----------
dcplusplus/trunk/help/settings_tabs.html
dcplusplus/trunk/yassl/mySTL/memory_array.hpp
dcplusplus/trunk/yassl/taocrypt/mySTL/
dcplusplus/trunk/yassl/taocrypt/mySTL/algorithm.hpp
dcplusplus/trunk/yassl/taocrypt/mySTL/helpers.hpp
dcplusplus/trunk/yassl/taocrypt/mySTL/list.hpp
dcplusplus/trunk/yassl/taocrypt/mySTL/memory.hpp
dcplusplus/trunk/yassl/taocrypt/mySTL/memory_array.hpp
dcplusplus/trunk/yassl/taocrypt/mySTL/pair.hpp
dcplusplus/trunk/yassl/taocrypt/mySTL/stdexcept.hpp
dcplusplus/trunk/yassl/taocrypt/mySTL/vector.hpp
dcplusplus/trunk/yassl/taocrypt/src/crypto.cpp
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2006-12-13 17:10:06 UTC (rev 687)
+++ dcplusplus/trunk/changelog.txt 2006-12-13 20:39:44 UTC (rev 688)
@@ -20,7 +20,8 @@
* [bug 1110] Added new adc hub list (thanks mafa_45)
* [bug 1091] Added new nmdc hub lists (thanks poy)
* [bug 1112] Port sign cleanup (thanks steven sheehy)
-* Fixed ADC client-to-client connection sequence
+* [ADC] Fixed client-to-client connection sequence
+* [bug 1064] Updated to YaSSL 1.5.0, should fix crash
-- 0.698 2006-10-10 --
* [bug 1065] Code cleanup (thanks steven sheehy)
Modified: dcplusplus/trunk/client/stdinc.h
===================================================================
--- dcplusplus/trunk/client/stdinc.h 2006-12-13 17:10:06 UTC (rev 687)
+++ dcplusplus/trunk/client/stdinc.h 2006-12-13 20:39:44 UTC (rev 688)
@@ -33,6 +33,10 @@
#define BZ_NO_STDIO 1
#endif
+#ifndef USE_SYS_STL
+#define USE_SYS_STL 1
+#endif
+
#ifdef HAVE_STLPORT
# define _STLP_DONT_USE_SHORT_STRING_OPTIM 1 // Lots of memory issues with this undefined...wonder what's up with that..
# define _STLP_USE_PTR_SPECIALIZATIONS 1
Added: dcplusplus/trunk/help/settings_tabs.html
===================================================================
--- dcplusplus/trunk/help/settings_tabs.html (rev 0)
+++ dcplusplus/trunk/help/settings_tabs.html 2006-12-13 20:39:44 UTC (rev 688)
@@ -0,0 +1,44 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <title>Tabs</title>
+ <meta content="text/html; charset=us-ascii" http-equiv="content-type">
+ <link href="office11.css" rel="stylesheet" type="text/css">
+</head>
+<body>
+<h1>Tab bolding on contents change</h1>
+<dl style="margin-left: 40px;">
+ <dt>Finished Downloads</dt>
+ <dd>When a download completes, the Finished
+Downloads tab will turn bold if this option is selected.</dd>
+ <dt>Finished Uploads</dt>
+ <dd>When a upload completes, the Finished
+Uploads tab will turn bold if this option is selected.</dd>
+ <dt>Download Queue</dt>
+ <dd>This option controls whether or not the Download Queue's tab will
+highlight itself when a queue item changes state or finishes.</dd>
+ <dt>Hub</dt>
+ <dd>When a chat message appears in a hub that's
+not focused the tab will become bold if you have this option selected.</dd>
+<dt>Private message</dt>
+ <dd>When a private message appears that's
+not focused the tab will become bold if you have this option selected.</dd>
+<dt>Search</dt>
+ <dd>If more search result appear in an open search window that's
+not focused the tab will become bold if you have this option selected.</dd>
+<dt>Waiting users</dt>
+ <dd>If a user or an item is added or removed while the tab is not
+focused, the tab will become bold if you have this option selected.</dd>
+<dt>System log</dt>
+ <dd>If an system log entry is added while the tab is not focused, the tab will become bold if you have this option selected.</dd>
+</dl>
+<h2>Options</h2>
+<dl style="margin-left: 40px;">
+ <dt>Max Tab Rows</dt>
+ <dd>The maximum number of rows of tabs that DC++ will make. Any
+tabs that do not fit will be accessible through the chevron at the
+right of the tab control. (default: 2)</dd>
+</body>
+</html>
+
+
Modified: dcplusplus/trunk/yassl/README
===================================================================
--- dcplusplus/trunk/yassl/README 2006-12-13 17:10:06 UTC (rev 687)
+++ dcplusplus/trunk/yassl/README 2006-12-13 20:39:44 UTC (rev 688)
@@ -1,7 +1,59 @@
-yaSSL Release notes, version 1.4.0 (08/13/06)
+yaSSL Release notes, version 1.5.0 (11/09/06)
+ This release of yaSSL contains bug fixes, portability enhancements,
+ and full TLS 1.1 support. Use the functions:
+ SSL_METHOD *TLSv1_1_server_method(void);
+ SSL_METHOD *TLSv1_1_client_method(void);
+
+ or the SSLv23 versions (even though yaSSL doesn't support SSL 2.0 the v23
+ means to pick the highest of SSL 3.0, TLS 1.0, or TLS 1.1.
+
+
+See normal build instructions below under 1.0.6.
+See libcurl build instructions below under 1.3.0.
+
+
+
+****************yaSSL Release notes, version 1.4.5 (10/15/06)
+
+
This release of yaSSL contains bug fixes, portability enhancements,
+ zlib compression support, removal of assembly instructions at runtime if
+ not supported, and initial TLS 1.1 support.
+
+
+ Compression Notes: yaSSL uses zlib for compression and the compression
+ should only be used if yaSSL is at both ends because the implementation
+ details aren't yet standard. If you'd like to turn compression on use
+ the SSL_set_compression() function on the client before calling
+ SSL_connect(). If both the client and server were built with zlib support
+ then the connection will use compression. If the client isn't built with
+ support then SSL_set_compression() will return an error (-1).
+
+ To build yaSSL with zlib support on Unix simply have zlib support on your
+ system and configure will find it if it's in the standard locations. If
+ it's somewhere else use the option ./configure --with-zlib=DIR. If you'd
+ like to disable compression support in yaSSL use ./configure --without-zlib.
+
+ To build yaSSL with zlib support on Windows:
+
+ 1) download zlib from http://www.zlib.net/
+ 2) follow the instructions in zlib from projects/visualc6/README.txt
+ for how to add the zlib project into the yaSSL workspace noting that
+ you'll need to add configuration support for "Win32 Debug" and
+ "Win32 Release" in note 3 under "To use:".
+ 3) define HAVE_LIBZ when building yaSSL
+
+
+See normal build instructions below under 1.0.6.
+See libcurl build instructions below under 1.3.0.
+
+
+********************yaSSL Release notes, version 1.4.0 (08/13/06)
+
+
+ This release of yaSSL contains bug fixes, portability enhancements,
nonblocking connect and accept, better OpenSSL error mapping, and
certificate caching for session resumption.
@@ -122,19 +174,7 @@
run Debug\testsuite.exe from yaSSL-Home\testsuite to test the build
---To enable ia32 assembly for TaoCrypt ciphers and message digests
- On MSVC this is always on
-
- On GCC **, use ./configure --enable-ia32-asm
-
- ** This isn't on by default because of the use of intel syntax and the
- problem that olders versions of gas have with some addressing statements.
- If you enable this and get assemler errors during compilation or can't
- pass the TaoCrypt tests, please send to...@ya... a message and disable
- this option in the meantime.
-
-
***************** yaSSL Release notes, version 1.0.5
This release of yaSSL contains minor bug fixes, portability enhancements,
Modified: dcplusplus/trunk/yassl/certs/taoCert.txt
===================================================================
--- dcplusplus/trunk/yassl/certs/taoCert.txt 2006-12-13 17:10:06 UTC (rev 687)
+++ dcplusplus/trunk/yassl/certs/taoCert.txt 2006-12-13 20:39:44 UTC (rev 688)
@@ -47,4 +47,11 @@
b) openssl rsa -in key.pem -outform DER -out key.der
+**** To encrypt rsa key already in pem **********
+a) openssl rsa <server-key.pem.bak -des >server-keyEnc.pem
+
+note location of des
+
+
+
Modified: dcplusplus/trunk/yassl/include/buffer.hpp
===================================================================
--- dcplusplus/trunk/yassl/include/buffer.hpp 2006-12-13 17:10:06 UTC (rev 687)
+++ dcplusplus/trunk/yassl/include/buffer.hpp 2006-12-13 20:39:44 UTC (rev 688)
@@ -34,9 +34,12 @@
#include <assert.h> // assert
#include "yassl_types.hpp" // ysDelete
#include "memory.hpp" // mySTL::auto_ptr
-#include "algorithm.hpp" // mySTL::swap
+#include STL_ALGORITHM_FILE
+namespace STL = STL_NAMESPACE;
+
+
#ifdef _MSC_VER
// disable truncated debug symbols
#pragma warning(disable:4786)
@@ -199,7 +202,7 @@
void operator()(T*& p) const
{
T* tmp = 0;
- mySTL::swap(tmp, p);
+ STL::swap(tmp, p);
checked_delete(tmp);
}
};
Modified: dcplusplus/trunk/yassl/include/cert_wrapper.hpp
===================================================================
--- dcplusplus/trunk/yassl/include/cert_wrapper.hpp 2006-12-13 17:10:06 UTC (rev 687)
+++ dcplusplus/trunk/yassl/include/cert_wrapper.hpp 2006-12-13 20:39:44 UTC (rev 688)
@@ -41,9 +41,13 @@
#include "yassl_types.hpp" // SignatureAlgorithm
#include "buffer.hpp" // input_buffer
#include "asn.hpp" // SignerList
-#include "list.hpp" // mySTL::list
-#include "algorithm.hpp" // mySTL::for_each
+#include STL_LIST_FILE
+#include STL_ALGORITHM_FILE
+
+namespace STL = STL_NAMESPACE;
+
+
namespace yaSSL {
typedef unsigned char opaque;
@@ -72,7 +76,7 @@
// Certificate Manager keeps a list of the cert chain and public key
class CertManager {
- typedef mySTL::list<x509*> CertList;
+ typedef STL::list<x509*> CertList;
CertList list_; // self
input_buffer privateKey_;
Modified: dcplusplus/trunk/yassl/include/crypto_wrapper.hpp
===================================================================
--- dcplusplus/trunk/yassl/include/crypto_wrapper.hpp 2006-12-13 17:10:06 UTC (rev 687)
+++ dcplusplus/trunk/yassl/include/crypto_wrapper.hpp 2006-12-13 20:39:44 UTC (rev 688)
@@ -416,9 +416,19 @@
class x509;
-x509* PemToDer(FILE*, CertType);
+struct EncryptedInfo {
+ enum { IV_SZ = 32, NAME_SZ = 80 };
+ char name[NAME_SZ]; // max one line
+ byte iv[IV_SZ]; // in base16 rep
+ uint ivSz;
+ bool set;
+ EncryptedInfo() : ivSz(0), set(false) {}
+};
+x509* PemToDer(FILE*, CertType, EncryptedInfo* info = 0);
+
+
} // naemspace
#endif // yaSSL_CRYPTO_WRAPPER_HPP
Modified: dcplusplus/trunk/yassl/include/factory.hpp
===================================================================
--- dcplusplus/trunk/yassl/include/factory.hpp 2006-12-13 17:10:06 UTC (rev 687)
+++ dcplusplus/trunk/yassl/include/factory.hpp 2006-12-13 20:39:44 UTC (rev 688)
@@ -35,19 +35,16 @@
#ifndef yaSSL_FACTORY_HPP
#define yaSSL_FACTORY_HPP
-#include "vector.hpp"
-#include "pair.hpp"
+#include STL_VECTOR_FILE
+#include STL_PAIR_FILE
+namespace STL = STL_NAMESPACE;
-// VC60 workaround: it doesn't allow typename in some places
-#if defined(_MSC_VER) && (_MSC_VER < 1300)
- #define CPP_TYPENAME
-#else
- #define CPP_TYPENAME typename
-#endif
+
+
namespace yaSSL {
@@ -58,8 +55,8 @@
typename ProductCreator = AbstractProduct* (*)()
>
class Factory {
- typedef mySTL::pair<IdentifierType, ProductCreator> CallBack;
- typedef mySTL::vector<CallBack> CallBackVector;
+ typedef STL::pair<IdentifierType, ProductCreator> CallBack;
+ typedef STL::vector<CallBack> CallBackVector;
CallBackVector callbacks_;
public:
@@ -79,14 +76,16 @@
// register callback
void Register(const IdentifierType& id, ProductCreator pc)
{
- callbacks_.push_back(mySTL::make_pair(id, pc));
+ callbacks_.push_back(STL::make_pair(id, pc));
}
// THE Creator, returns a new object of the proper type or 0
AbstractProduct* CreateObject(const IdentifierType& id) const
{
- const CallBack* first = callbacks_.begin();
- const CallBack* last = callbacks_.end();
+ typedef typename STL::vector<CallBack>::const_iterator cIter;
+
+ cIter first = callbacks_.begin();
+ cIter last = callbacks_.end();
while (first != last) {
if (first->first == id)
Modified: dcplusplus/trunk/yassl/include/openssl/ssl.h
===================================================================
--- dcplusplus/trunk/yassl/include/openssl/ssl.h 2006-12-13 17:10:06 UTC (rev 687)
+++ dcplusplus/trunk/yassl/include/openssl/ssl.h 2006-12-13 20:39:44 UTC (rev 688)
@@ -41,7 +41,7 @@
#include "rsa.h"
-#define YASSL_VERSION "1.4.0"
+#define YASSL_VERSION "1.5.0"
#if defined(__cplusplus)
@@ -228,6 +228,7 @@
int SSL_set_session(SSL *ssl, SSL_SESSION *session);
SSL_SESSION* SSL_get_session(SSL* ssl);
long SSL_SESSION_set_timeout(SSL_SESSION*, long);
+long SSL_CTX_set_session_cache_mode(SSL_CTX* ctx, long mode);
X509* SSL_get_peer_certificate(SSL*);
long SSL_get_verify_result(SSL*);
@@ -359,8 +360,10 @@
SSL_METHOD *SSLv3_method(void);
SSL_METHOD *SSLv3_server_method(void);
SSL_METHOD *SSLv3_client_method(void);
-SSL_METHOD *TLSv1_server_method(void);
+SSL_METHOD *TLSv1_server_method(void);
SSL_METHOD *TLSv1_client_method(void);
+SSL_METHOD *TLSv1_1_server_method(void);
+SSL_METHOD *TLSv1_1_client_method(void);
SSL_METHOD *SSLv23_server_method(void);
int SSL_CTX_use_certificate_file(SSL_CTX*, const char*, int);
@@ -531,8 +534,12 @@
#define SSL_DEFAULT_CIPHER_LIST "" /* default all */
+/* yaSSL adds */
+int SSL_set_compression(SSL*); /* turn on yaSSL zlib compression */
+
+
#if defined(__cplusplus) && !defined(YASSL_MYSQL_COMPATIBLE)
} /* namespace */
} /* extern "C" */
Modified: dcplusplus/trunk/yassl/include/socket_wrapper.hpp
===================================================================
--- dcplusplus/trunk/yassl/include/socket_wrapper.hpp 2006-12-13 17:10:06 UTC (rev 687)
+++ dcplusplus/trunk/yassl/include/socket_wrapper.hpp 2006-12-13 20:39:44 UTC (rev 688)
@@ -70,8 +70,8 @@
// Wraps Windows Sockets and BSD Sockets
class Socket {
socket_t socket_; // underlying socket descriptor
- bool wouldBlock_; // for non-blocking data
- bool blocking_; // is option set
+ bool wouldBlock_; // if non-blocking data, for last read
+ bool nonBlocking_; // is option set
public:
explicit Socket(socket_t s = INVALID_SOCKET);
~Socket();
@@ -85,7 +85,7 @@
bool wait();
bool WouldBlock() const;
- bool IsBlocking() const;
+ bool IsNonBlocking() 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-12-13 17:10:06 UTC (rev 687)
+++ dcplusplus/trunk/yassl/include/yassl_error.hpp 2006-12-13 20:39:44 UTC (rev 688)
@@ -54,8 +54,15 @@
verify_error = 112,
send_error = 113,
receive_error = 114,
- certificate_error = 115
+ certificate_error = 115,
+ privateKey_error = 116,
+ badVersion_error = 117,
+ compress_error = 118,
+ decompress_error = 119,
+ pms_version_error = 120
+ // !!!! add error message to .cpp !!!!
+
// 1000+ from TaoCrypt error.hpp
};
Modified: dcplusplus/trunk/yassl/include/yassl_imp.hpp
===================================================================
--- dcplusplus/trunk/yassl/include/yassl_imp.hpp 2006-12-13 17:10:06 UTC (rev 687)
+++ dcplusplus/trunk/yassl/include/yassl_imp.hpp 2006-12-13 20:39:44 UTC (rev 688)
@@ -39,9 +39,12 @@
#include "yassl_types.hpp"
#include "factory.hpp"
-#include "list.hpp" // mySTL::list
+#include STL_LIST_FILE
+namespace STL = STL_NAMESPACE;
+
+
namespace yaSSL {
@@ -129,7 +132,6 @@
public:
Data();
Data(uint16 len, opaque* b);
- Data(uint16 len, const opaque* w);
friend output_buffer& operator<<(output_buffer&, const Data&);
@@ -138,9 +140,9 @@
ContentType get_type() const;
uint16 get_length() const;
- const opaque* get_buffer() const;
void set_length(uint16 l);
opaque* set_buffer();
+ void SetData(uint16, const opaque*);
void Process(input_buffer&, SSL&);
private:
Data(const Data&); // hide copy
@@ -229,11 +231,11 @@
void Process(input_buffer&, SSL&);
const opaque* get_random() const;
- friend void buildClientHello(SSL&, ClientHello&, CompressionMethod);
+ friend void buildClientHello(SSL&, ClientHello&);
friend void ProcessOldClientHello(input_buffer& input, SSL& ssl);
ClientHello();
- explicit ClientHello(ProtocolVersion pv);
+ ClientHello(ProtocolVersion pv, bool useCompression);
private:
ClientHello(const ClientHello&); // hide copy
ClientHello& operator=(const ClientHello&); // and assign
@@ -250,7 +252,7 @@
opaque cipher_suite_[SUITE_LEN];
CompressionMethod compression_method_;
public:
- explicit ServerHello(ProtocolVersion pv);
+ ServerHello(ProtocolVersion pv, bool useCompression);
ServerHello();
friend input_buffer& operator>>(input_buffer&, ServerHello&);
@@ -427,7 +429,7 @@
class CertificateRequest : public HandShakeBase {
ClientCertificateType certificate_types_[CERT_TYPES];
int typeTotal_;
- mySTL::list<DistinguishedName> certificate_authorities_;
+ STL::list<DistinguishedName> certificate_authorities_;
public:
CertificateRequest();
~CertificateRequest();
@@ -626,8 +628,11 @@
bool send_server_key_; // server key exchange?
bool master_clean_; // master secret clean?
bool TLS_; // TLSv1 or greater
+ bool TLSv1_1_; // TLSv1.1 or greater
bool sessionID_Set_; // do we have a session
- ProtocolVersion version_;
+ bool compression_; // zlib compression?
+ ProtocolVersion version_; // negotiated version
+ ProtocolVersion chVersion_; // client hello version
RandomPool& random_;
Connection(ProtocolVersion v, RandomPool& ran);
@@ -637,6 +642,7 @@
void CleanPreMaster();
void CleanMaster();
void TurnOffTLS();
+ void TurnOffTLS1_1();
private:
Connection(const Connection&); // hide copy
Connection& operator=(const Connection&); // and assign
Modified: dcplusplus/trunk/yassl/include/yassl_int.hpp
===================================================================
--- dcplusplus/trunk/yassl/include/yassl_int.hpp 2006-12-13 17:10:06 UTC (rev 687)
+++ dcplusplus/trunk/yassl/include/yassl_int.hpp 2006-12-13 20:39:44 UTC (rev 688)
@@ -40,11 +40,21 @@
#include "lock.hpp"
#include "openssl/ssl.h" // ASN1_STRING and DH
+// Check if _POSIX_THREADS should be forced
+#if !defined(_POSIX_THREADS) && (defined(__NETWARE__) || defined(__hpux))
+// HPUX does not define _POSIX_THREADS as it's not _fully_ implemented
+// Netware supports pthreads but does not announce it
+#define _POSIX_THREADS
+#endif
+
#ifdef _POSIX_THREADS
#include <pthread.h>
#endif
+namespace STL = STL_NAMESPACE;
+
+
namespace yaSSL {
@@ -262,7 +272,7 @@
// holds all sessions
class Sessions {
- mySTL::list<SSL_SESSION*> list_;
+ STL::list<SSL_SESSION*> list_;
RandomPool random_; // for session cleaning
Mutex mutex_; // no-op for single threaded
@@ -296,8 +306,8 @@
// holds all errors
class Errors {
- mySTL::list<ThreadError> list_;
- Mutex mutex_;
+ STL::list<ThreadError> list_;
+ Mutex mutex_;
Errors() {} // only GetErrors can create
public:
@@ -326,8 +336,10 @@
bool verifyPeer_; // request or send certificate
bool verifyNone_; // whether to verify certificate
bool failNoCert_;
+ bool multipleProtocol_; // for SSLv23 compatibility
public:
- explicit SSL_METHOD(ConnectionEnd ce, ProtocolVersion pv);
+ SSL_METHOD(ConnectionEnd ce, ProtocolVersion pv,
+ bool multipleProtocol = false);
ProtocolVersion getVersion() const;
ConnectionEnd getSide() const;
@@ -339,6 +351,7 @@
bool verifyPeer() const;
bool verifyNone() const;
bool failNoCert() const;
+ bool multipleProtocol() const;
private:
SSL_METHOD(const SSL_METHOD&); // hide copy
SSL_METHOD& operator=(const SSL_METHOD&); // and assign
@@ -408,32 +421,41 @@
// the SSL context
class SSL_CTX {
public:
- typedef mySTL::list<x509*> CertList;
+ typedef STL::list<x509*> CertList;
private:
- SSL_METHOD* method_;
- x509* certificate_;
- x509* privateKey_;
- CertList caList_;
- Ciphers ciphers_;
- DH_Parms dhParms_;
- Stats stats_;
- Mutex mutex_; // for Stats
+ SSL_METHOD* method_;
+ x509* certificate_;
+ x509* privateKey_;
+ CertList caList_;
+ Ciphers ciphers_;
+ DH_Parms dhParms_;
+ pem_password_cb passwordCb_;
+ void* userData_;
+ bool sessionCacheOff_;
+ Stats stats_;
+ Mutex mutex_; // for Stats
public:
explicit SSL_CTX(SSL_METHOD* meth);
~SSL_CTX();
- const x509* getCert() const;
- const x509* getKey() const;
- const SSL_METHOD* getMethod() const;
- const Ciphers& GetCiphers() const;
- const DH_Parms& GetDH_Parms() const;
- const Stats& GetStats() const;
+ const x509* getCert() const;
+ const x509* getKey() const;
+ const SSL_METHOD* getMethod() const;
+ const Ciphers& GetCiphers() const;
+ const DH_Parms& GetDH_Parms() const;
+ const Stats& GetStats() const;
+ pem_password_cb GetPasswordCb() const;
+ void* GetUserData() const;
+ bool GetSessionCacheOff() const;
void setVerifyPeer();
void setVerifyNone();
void setFailNoCert();
bool SetCipherList(const char*);
bool SetDH(const DH&);
+ void SetPasswordCb(pem_password_cb cb);
+ void SetUserData(void*);
+ void SetSessionCacheOff();
void IncrementStats(StatsField);
void AddCA(x509* ca);
@@ -508,8 +530,8 @@
// holds input and output buffers
class Buffers {
public:
- typedef mySTL::list<input_buffer*> inputList;
- typedef mySTL::list<output_buffer*> outputList;
+ typedef STL::list<input_buffer*> inputList;
+ typedef STL::list<output_buffer*> outputList;
private:
inputList dataList_; // list of users app data / handshake
outputList handShakeList_; // buffered handshake msgs
@@ -580,6 +602,8 @@
const sslFactory& getFactory() const;
const Socket& getSocket() const;
YasslError GetError() const;
+ bool GetMultiProtocol() const;
+ bool CompressionOn() const;
Crypto& useCrypto();
Security& useSecurity();
@@ -597,9 +621,12 @@
void set_preMaster(const opaque*, uint);
void set_masterSecret(const opaque*);
void SetError(YasslError);
+ int SetCompression();
+ void UnSetCompression();
// helpers
bool isTLS() const;
+ bool isTLSv1_1() const;
void order_error();
void makeMasterSecret();
void makeTLSMasterSecret();
@@ -633,7 +660,11 @@
};
+// compression
+int Compress(const byte*, int, input_buffer&);
+int DeCompress(input_buffer&, int, input_buffer&);
+
// conversion functions
void c32to24(uint32, uint24&);
void c24to32(const uint24, uint32&);
Modified: dcplusplus/trunk/yassl/include/yassl_types.hpp
===================================================================
--- dcplusplus/trunk/yassl/include/yassl_types.hpp 2006-12-13 17:10:06 UTC (rev 687)
+++ dcplusplus/trunk/yassl/include/yassl_types.hpp 2006-12-13 20:39:44 UTC (rev 688)
@@ -38,7 +38,9 @@
namespace yaSSL {
+#define YASSL_LIB
+
#ifdef YASSL_PURE_C
// library allocation
@@ -76,7 +78,7 @@
::operator delete[](ptr, yaSSL::ys);
}
- #define NEW_YS new (ys)
+ #define NEW_YS new (yaSSL::ys)
// to resolve compiler generated operator delete on base classes with
// virtual destructors (when on stack), make sure doesn't get called
@@ -88,7 +90,6 @@
#else // YASSL_PURE_C
-
template<typename T>
void ysDelete(T* ptr)
{
@@ -121,6 +122,39 @@
typedef unsigned int uint;
+
+#ifdef USE_SYS_STL
+ // use system STL
+ #define STL_VECTOR_FILE <vector>
+ #define STL_LIST_FILE <list>
+ #define STL_ALGORITHM_FILE <algorithm>
+ #define STL_MEMORY_FILE <memory>
+ #define STL_PAIR_FILE <utility>
+
+ #define STL_NAMESPACE std
+#else
+ // use mySTL
+ #define STL_VECTOR_FILE "vector.hpp"
+ #define STL_LIST_FILE "list.hpp"
+ #define STL_ALGORITHM_FILE "algorithm.hpp"
+ #define STL_MEMORY_FILE "memory.hpp"
+ #define STL_PAIR_FILE "pair.hpp"
+
+ #define STL_NAMESPACE mySTL
+#endif
+
+
+#ifdef min
+ #undef min
+#endif
+
+template <typename T>
+T min(T a, T b)
+{
+ return a < b ? a : b;
+}
+
+
// all length constants in bytes
const int ID_LEN = 32; // session id length
@@ -163,6 +197,7 @@
const int DES_IV_SZ = DES_BLOCK; // Init Vector length for DES
const int RC4_KEY_SZ = 16; // RC4 Key length
const int AES_128_KEY_SZ = 16; // AES 128bit Key length
+const int AES_192_KEY_SZ = 24; // AES 192bit Key length
const int AES_256_KEY_SZ = 32; // AES 256bit Key length
const int AES_BLOCK_SZ = 16; // AES 128bit block size, rfc 3268
const int AES_IV_SZ = AES_BLOCK_SZ; // AES Init Vector length
@@ -175,6 +210,7 @@
const int SEED_LEN = RAN_LEN * 2; // TLS seed, client + server random
const int DEFAULT_TIMEOUT = 500; // Default Session timeout in seconds
const int MAX_RECORD_SIZE = 16384; // 2^14, max size by standard
+const int COMPRESS_EXTRA = 1024; // extra compression possible addition
typedef uint8 Cipher; // first byte is always 0x00 for SSLv3 & TLS
@@ -186,7 +222,7 @@
typedef bool IsExportable;
-enum CompressionMethod { no_compression = 0 };
+enum CompressionMethod { no_compression = 0, zlib = 221 };
enum CipherType { stream, block };
Added: dc...
[truncated message content] |
|
From: <arn...@us...> - 2006-12-13 20:57:21
|
Revision: 689
http://svn.sourceforge.net/dcplusplus/?rev=689&view=rev
Author: arnetheduck
Date: 2006-12-13 12:57:11 -0800 (Wed, 13 Dec 2006)
Log Message:
-----------
patches, reorder hublists to put the working ones first
Modified Paths:
--------------
dcplusplus/trunk/Example.xml
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/client/FavoriteManager.cpp
dcplusplus/trunk/client/FavoriteManager.h
dcplusplus/trunk/client/SettingsManager.cpp
dcplusplus/trunk/client/StringDefs.cpp
dcplusplus/trunk/client/StringDefs.h
dcplusplus/trunk/client/Util.h
dcplusplus/trunk/windows/AboutDlg.h
dcplusplus/trunk/windows/PublicHubsFrm.cpp
dcplusplus/trunk/windows/PublicHubsFrm.h
Modified: dcplusplus/trunk/Example.xml
===================================================================
--- dcplusplus/trunk/Example.xml 2006-12-13 20:39:44 UTC (rev 688)
+++ dcplusplus/trunk/Example.xml 2006-12-13 20:57:11 UTC (rev 689)
@@ -178,6 +178,7 @@
<String Name="HubAddress">Address</String>
<String Name="HubListDownloaded">Hub list downloaded...</String>
<String Name="HubListEdit">Edit the hublist</String>
+ <String Name="HubListLoadedFromCache">Hub list loaded from cache...</String>
<String Name="HubName">Name</String>
<String Name="HubList">Hublist</String>
<String Name="HubPassword">Hub password</String>
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2006-12-13 20:39:44 UTC (rev 688)
+++ dcplusplus/trunk/changelog.txt 2006-12-13 20:57:11 UTC (rev 689)
@@ -22,6 +22,8 @@
* [bug 1112] Port sign cleanup (thanks steven sheehy)
* [ADC] Fixed client-to-client connection sequence
* [bug 1064] Updated to YaSSL 1.5.0, should fix crash
+* [bug 446] Public hub lists are cached and downloaded only when user requests it (thanks poy)
+* [bug 1117] Fixed subfolders being created on filelist downloads (thanks mikael eman)
-- 0.698 2006-10-10 --
* [bug 1065] Code cleanup (thanks steven sheehy)
Modified: dcplusplus/trunk/client/FavoriteManager.cpp
===================================================================
--- dcplusplus/trunk/client/FavoriteManager.cpp 2006-12-13 20:39:44 UTC (rev 688)
+++ dcplusplus/trunk/client/FavoriteManager.cpp 2006-12-13 20:57:11 UTC (rev 689)
@@ -30,6 +30,25 @@
#include "SimpleXML.h"
#include "UserCommand.h"
+FavoriteManager::FavoriteManager() : lastId(0), useHttp(false), running(false), c(NULL), lastServer(0), listType(TYPE_NORMAL), dontSave(false) {
+ SettingsManager::getInstance()->addListener(this);
+ ClientManager::getInstance()->addListener(this);
+
+ File::ensureDirectory(Util::getHubListsPath());
+}
+
+FavoriteManager::~FavoriteManager() throw() {
+ ClientManager::getInstance()->removeListener(this);
+ SettingsManager::getInstance()->removeListener(this);
+ if(c) {
+ c->removeListener(this);
+ delete c;
+ c = NULL;
+ }
+
+ for_each(favoriteHubs.begin(), favoriteHubs.end(), DeleteFunction());
+}
+
UserCommand FavoriteManager::addUserCommand(int type, int ctx, int flags, const string& name, const string& command, const string& hub) {
// No dupes, add it...
Lock l(cs);
@@ -230,12 +249,12 @@
return false;
}
-void FavoriteManager::onHttpFinished() throw() {
+void FavoriteManager::onHttpFinished(bool fromHttp) throw() {
string::size_type i, j;
string* x;
string bzlist;
- if(listType == TYPE_BZIP2) {
+ if((listType == TYPE_BZIP2) && (!downloadBuf.empty())) {
try {
CryptoManager::getInstance()->decodeBZ2((uint8_t*)downloadBuf.data(), downloadBuf.size(), bzlist);
} catch(const CryptoException&) {
@@ -272,6 +291,15 @@
}
}
}
+
+ if(fromHttp) {
+ try {
+ File f(Util::getHubListsPath() + Util::validateFileName(publicListServer), File::WRITE, File::CREATE | File::TRUNCATE);
+ f.write(downloadBuf);
+ f.close();
+ } catch(const FileException&) { }
+ }
+
downloadBuf = Util::emptyString;
}
@@ -555,17 +583,12 @@
return lists.getTokens();
}
-bool FavoriteManager::setHubList(int aHubList) {
- if(!running) {
- lastServer = aHubList;
- StringList sl = getHubLists();
- publicListServer = sl[(lastServer) % sl.size()];
- return true;
- }
- return false;
+void FavoriteManager::setHubList(int aHubList) {
+ lastServer = aHubList;
+ refresh();
}
-void FavoriteManager::refresh() {
+void FavoriteManager::refresh(bool forceDownload /* = false */) {
StringList sl = getHubLists();
if(sl.empty())
return;
@@ -575,14 +598,37 @@
return;
}
- fire(FavoriteManagerListener::DownloadStarting(), publicListServer);
+ if(!forceDownload) {
+ string path = Util::getHubListsPath() + Util::validateFileName(publicListServer);
+ if(File::getSize(path) > 0) {
+ useHttp = false;
+ {
+ Lock l(cs);
+ publicListMatrix[publicListServer].clear();
+ }
+ listType = (Util::stricmp(path.substr(path.size() - 4), ".bz2") == 0) ? TYPE_BZIP2 : TYPE_NORMAL;
+ try {
+ downloadBuf = File(path, File::READ, File::OPEN).read();
+ } catch(const FileException&) {
+ downloadBuf = Util::emptyString;
+ }
+ if(!downloadBuf.empty()) {
+ onHttpFinished(false);
+ fire(FavoriteManagerListener::LoadedFromCache(), publicListServer);
+ return;
+ }
+ }
+ }
+
if(!running) {
- if(!c)
- c = new HttpConnection();
+ useHttp = true;
{
Lock l(cs);
publicListMatrix[publicListServer].clear();
}
+ fire(FavoriteManagerListener::DownloadStarting(), publicListServer);
+ if(c == NULL)
+ c = new HttpConnection();
c->addListener(this);
c->downloadFile(publicListServer);
running = true;
@@ -634,29 +680,36 @@
// HttpConnectionListener
void FavoriteManager::on(Data, HttpConnection*, const uint8_t* buf, size_t len) throw() {
- downloadBuf.append((const char*)buf, len);
+ if(useHttp)
+ downloadBuf.append((const char*)buf, len);
}
void FavoriteManager::on(Failed, HttpConnection*, const string& aLine) throw() {
c->removeListener(this);
lastServer++;
running = false;
- fire(FavoriteManagerListener::DownloadFailed(), aLine);
+ if(useHttp)
+ fire(FavoriteManagerListener::DownloadFailed(), aLine);
}
void FavoriteManager::on(Complete, HttpConnection*, const string& aLine) throw() {
c->removeListener(this);
- onHttpFinished();
+ if(useHttp)
+ onHttpFinished(true);
running = false;
- fire(FavoriteManagerListener::DownloadFinished(), aLine);
+ if(useHttp)
+ fire(FavoriteManagerListener::DownloadFinished(), aLine);
}
void FavoriteManager::on(Redirected, HttpConnection*, const string& aLine) throw() {
- fire(FavoriteManagerListener::DownloadStarting(), aLine);
+ if(useHttp)
+ fire(FavoriteManagerListener::DownloadStarting(), aLine);
}
void FavoriteManager::on(TypeNormal, HttpConnection*) throw() {
- listType = TYPE_NORMAL;
+ if(useHttp)
+ listType = TYPE_NORMAL;
}
void FavoriteManager::on(TypeBZ2, HttpConnection*) throw() {
- listType = TYPE_BZIP2;
+ if(useHttp)
+ listType = TYPE_BZIP2;
}
void FavoriteManager::on(UserUpdated, const OnlineUser& user) throw() {
Modified: dcplusplus/trunk/client/FavoriteManager.h
===================================================================
--- dcplusplus/trunk/client/FavoriteManager.h 2006-12-13 20:39:44 UTC (rev 688)
+++ dcplusplus/trunk/client/FavoriteManager.h 2006-12-13 20:57:11 UTC (rev 689)
@@ -121,6 +121,7 @@
typedef X<5> UserAdded;
typedef X<6> UserRemoved;
typedef X<7> StatusChanged;
+ typedef X<8> LoadedFromCache;
virtual void on(DownloadStarting, const string&) throw() { }
virtual void on(DownloadFailed, const string&) throw() { }
@@ -130,6 +131,7 @@
virtual void on(UserAdded, const FavoriteUser&) throw() { }
virtual void on(UserRemoved, const FavoriteUser&) throw() { }
virtual void on(StatusChanged, const User::Ptr&) throw() { }
+ virtual void on(LoadedFromCache, const string&) throw() { }
};
class SimpleXML;
@@ -147,15 +149,15 @@
TYPE_BZIP2
};
StringList getHubLists();
- bool setHubList(int /*aHubList*/);
+ void setHubList(int aHubList);
int getSelectedHubList() { return lastServer; }
- void refresh();
+ void refresh(bool forceDownload = false);
HubTypes getHubListType() { return listType; }
HubEntry::List getPublicHubs() {
Lock l(cs);
return publicListMatrix[publicListServer];
}
- bool isDownloading() { return running; }
+ bool isDownloading() { return (useHttp && running); }
// Favorite Users
typedef HASH_MAP_X(CID, FavoriteUser, CID::Hash, equal_to<CID>, less<CID>) FavoriteMap;
@@ -214,7 +216,7 @@
typedef map<string, HubEntry::List> PubListMap;
PubListMap publicListMatrix;
string publicListServer;
- bool running;
+ bool useHttp, running;
HttpConnection* c;
int lastServer;
HubTypes listType;
@@ -225,23 +227,9 @@
friend class Singleton<FavoriteManager>;
- FavoriteManager() : lastId(0), running(false), c(NULL), lastServer(0), listType(TYPE_NORMAL), dontSave(false) {
- SettingsManager::getInstance()->addListener(this);
- ClientManager::getInstance()->addListener(this);
- }
+ FavoriteManager();
+ virtual ~FavoriteManager() throw();
- virtual ~FavoriteManager() throw() {
- ClientManager::getInstance()->removeListener(this);
- SettingsManager::getInstance()->removeListener(this);
- if(c) {
- c->removeListener(this);
- delete c;
- c = NULL;
- }
-
- for_each(favoriteHubs.begin(), favoriteHubs.end(), DeleteFunction());
- }
-
FavoriteHubEntry::Iter getFavoriteHub(const string& aServer) {
for(FavoriteHubEntry::Iter i = favoriteHubs.begin(); i != favoriteHubs.end(); ++i) {
if(Util::stricmp((*i)->getServer(), aServer) == 0) {
@@ -266,7 +254,7 @@
virtual void on(TypeNormal, HttpConnection*) throw();
virtual void on(TypeBZ2, HttpConnection*) throw();
- void onHttpFinished() throw();
+ void onHttpFinished(bool fromHttp) throw();
// SettingsManagerListener
virtual void on(SettingsManagerListener::Load, SimpleXML& xml) throw() {
Modified: dcplusplus/trunk/client/SettingsManager.cpp
===================================================================
--- dcplusplus/trunk/client/SettingsManager.cpp 2006-12-13 20:39:44 UTC (rev 688)
+++ dcplusplus/trunk/client/SettingsManager.cpp 2006-12-13 20:57:11 UTC (rev 689)
@@ -135,7 +135,7 @@
setDefault(IGNORE_BOT_PMS, false);
setDefault(LIST_DUPES, true);
setDefault(BUFFER_SIZE, 64);
- setDefault(HUBLIST_SERVERS, "http://home.bandicoot.nl/adchublist.xml.bz2;http://adchublist.com/hublist.xml.bz2;http://www.hublist.org/PublicHubList.xml.bz2;http://dchublist.com/hublist.xml.bz2");
+ setDefault(HUBLIST_SERVERS, "http://dchublist.com/hublist.xml.bz2;http://adchublist.com/hublist.xml.bz2;http://home.bandicoot.nl/adchublist.xml.bz2;http://www.hublist.org/PublicHubList.xml.bz2");
setDefault(DOWNLOAD_SLOTS, 3);
setDefault(MAX_DOWNLOAD_SPEED, 0);
setDefault(LOG_DIRECTORY, Util::getConfigPath() + "Logs" PATH_SEPARATOR_STR);
Modified: dcplusplus/trunk/client/StringDefs.cpp
===================================================================
--- dcplusplus/trunk/client/StringDefs.cpp 2006-12-13 20:39:44 UTC (rev 688)
+++ dcplusplus/trunk/client/StringDefs.cpp 2006-12-13 20:57:11 UTC (rev 689)
@@ -179,6 +179,7 @@
"Address",
"Hub list downloaded...",
"Edit the hublist",
+"Hub list loaded from cache...",
"Name",
"Hublist",
"Hub password",
@@ -811,6 +812,7 @@
"HubAddress",
"HubListDownloaded",
"HubListEdit",
+"HubListLoadedFromCache",
"HubName",
"HubList",
"HubPassword",
Modified: dcplusplus/trunk/client/StringDefs.h
===================================================================
--- dcplusplus/trunk/client/StringDefs.h 2006-12-13 20:39:44 UTC (rev 688)
+++ dcplusplus/trunk/client/StringDefs.h 2006-12-13 20:57:11 UTC (rev 689)
@@ -182,6 +182,7 @@
HUB_ADDRESS, // "Address"
HUB_LIST_DOWNLOADED, // "Hub list downloaded..."
HUB_LIST_EDIT, // "Edit the hublist"
+ HUB_LIST_LOADED_FROM_CACHE, // "Hub list loaded from cache..."
HUB_NAME, // "Name"
HUB_LIST, // "Hublist"
HUB_PASSWORD, // "Hub password"
Modified: dcplusplus/trunk/client/Util.h
===================================================================
--- dcplusplus/trunk/client/Util.h 2006-12-13 20:39:44 UTC (rev 688)
+++ dcplusplus/trunk/client/Util.h 2006-12-13 20:57:11 UTC (rev 689)
@@ -162,6 +162,8 @@
/** Path of file lists */
static string getListPath() { return getConfigPath() + "FileLists" PATH_SEPARATOR_STR; }
+ /** Path of hub lists */
+ static string getHubListsPath() { return getConfigPath() + "HubLists" PATH_SEPARATOR_STR; }
/** Notepad filename */
static string getNotepadFile() { return getConfigPath() + "Notepad.txt"; }
Modified: dcplusplus/trunk/windows/AboutDlg.h
===================================================================
--- dcplusplus/trunk/windows/AboutDlg.h 2006-12-13 20:39:44 UTC (rev 688)
+++ dcplusplus/trunk/windows/AboutDlg.h 2006-12-13 20:57:11 UTC (rev 689)
@@ -27,9 +27,9 @@
#include "../client/SimpleXML.h"
static const TCHAR thanks[] = _T("Big thanks to all donators and people who have contributed with ideas ")
-_T("and code! Thanks go out to sourceforge for hosting the project. This application uses libzip2, ")
-_T("thanks to Julian R Steward and team for providing it. This application uses STLPort ")
-_T("(www.stlport.org), a most excellent STL package. zlib is also used in this application. ")
+_T("and code! Thanks go out to sourceforge for hosting the project. This application uses bzip2 (www.bzip.org), ")
+_T("thanks to Julian Seward and team for providing it. Thiz application uses zlib (www.zlib.net), ")
+_T("thanks to Jean-loup Gailly and Mark Adler for providing it. ")
_T("This product includes GeoIP data created by MaxMind, available from http://maxmind.com/. ")
_T("This product uses yassl from www.yassl.com, thanks to Todd Ouska and Larry Stefonic.")
_T("The following people have contributed code to ")
@@ -42,7 +42,7 @@
_T("defr, ullner, fleetcommand, liny, xan, olle svensson, mark gillespie, jeremy huddleston, ")
_T("bsod, sulan, jonathan stone, tim burton, izzzo, guitarm, paka, nils maier, jens oknelid, yoji, ")
_T("krzysztof tyszecki, poison, pothead, pur, bigmuscle, martin, jove, bart vullings, ")
-_T("steven sheehy, tobias nygren, poy, dorian, stephan hohe, mafa_45. ")
+_T("steven sheehy, tobias nygren, poy, dorian, stephan hohe, mafa_45, mikael eman. ")
_T("Keep it coming!");
class AboutDlg : public CDialogImpl<AboutDlg>, private HttpConnectionListener
Modified: dcplusplus/trunk/windows/PublicHubsFrm.cpp
===================================================================
--- dcplusplus/trunk/windows/PublicHubsFrm.cpp 2006-12-13 20:39:44 UTC (rev 688)
+++ dcplusplus/trunk/windows/PublicHubsFrm.cpp 2006-12-13 20:57:11 UTC (rev 689)
@@ -139,10 +139,8 @@
hubs = FavoriteManager::getInstance()->getPublicHubs();
if(FavoriteManager::getInstance()->isDownloading())
ctrlStatus.SetText(0, CTSTRING(DOWNLOADING_HUB_LIST));
- else {
- if(hubs.empty())
- FavoriteManager::getInstance()->refresh();
- }
+ else if(hubs.empty())
+ FavoriteManager::getInstance()->refresh();
updateList();
@@ -210,12 +208,9 @@
}
LRESULT PublicHubsFrame::onClickedRefresh(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
- ctrlHubs.DeleteAllItems();
- users = 0;
- visibleHubs = 0;
ctrlStatus.SetText(0, CTSTRING(DOWNLOADING_HUB_LIST));
- FavoriteManager::getInstance()->refresh();
-
+ FavoriteManager::getInstance()->refresh(true);
+ updateDropDown();
return 0;
}
@@ -424,11 +419,11 @@
}
LRESULT PublicHubsFrame::onSpeaker(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) {
- if(wParam == FINISHED) {
+ if((wParam == FINISHED) || (wParam == LOADED_FROM_CACHE)) {
hubs = FavoriteManager::getInstance()->getPublicHubs();
updateList();
tstring* x = (tstring*)lParam;
- ctrlStatus.SetText(0, (TSTRING(HUB_LIST_DOWNLOADED) + _T(" (") + (*x) + _T(")")).c_str());
+ ctrlStatus.SetText(0, (((wParam == LOADED_FROM_CACHE) ? TSTRING(HUB_LIST_LOADED_FROM_CACHE) : TSTRING(HUB_LIST_DOWNLOADED)) + _T(" (") + (*x) + _T(")")).c_str());
delete x;
} else if(wParam == STARTING) {
tstring* x = (tstring*)lParam;
Modified: dcplusplus/trunk/windows/PublicHubsFrm.h
===================================================================
--- dcplusplus/trunk/windows/PublicHubsFrm.h 2006-12-13 20:39:44 UTC (rev 688)
+++ dcplusplus/trunk/windows/PublicHubsFrm.h 2006-12-13 20:57:11 UTC (rev 689)
@@ -124,6 +124,7 @@
enum {
FINISHED,
+ LOADED_FROM_CACHE,
STARTING,
FAILED
};
@@ -164,6 +165,7 @@
virtual void on(DownloadStarting, const string& l) throw() { speak(STARTING, l); }
virtual void on(DownloadFailed, const string& l) throw() { speak(FAILED, l); }
virtual void on(DownloadFinished, const string& l) throw() { speak(FINISHED, l); }
+ virtual void on(LoadedFromCache, const string& l) throw() { speak(LOADED_FROM_CACHE, l); }
void speak(int x, const string& l) {
PostMessage(WM_SPEAKER, x, (LPARAM)new tstring(Text::toT(l)));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <arn...@us...> - 2006-12-13 21:02:23
|
Revision: 690
http://svn.sourceforge.net/dcplusplus/?rev=690&view=rev
Author: arnetheduck
Date: 2006-12-13 13:02:16 -0800 (Wed, 13 Dec 2006)
Log Message:
-----------
removed files that are autogenerated
Modified Paths:
--------------
dcplusplus/trunk/changelog.txt
Removed Paths:
-------------
dcplusplus/trunk/Example.xml
dcplusplus/trunk/client/StringDefs.cpp
Deleted: dcplusplus/trunk/Example.xml
===================================================================
--- dcplusplus/trunk/Example.xml 2006-12-13 20:57:11 UTC (rev 689)
+++ dcplusplus/trunk/Example.xml 2006-12-13 21:02:16 UTC (rev 690)
@@ -1,636 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<Language Name="Example Language" Native="English" Code="en" Author="arnetheduck" Version="0.698" Revision="1" RightToLeft="0">
- <Strings>
- <String Name="Active">Active</String>
- <String Name="ActiveSearchString">Enabled / Search String</String>
- <String Name="Add">&Add</String>
- <String Name="AddToFavorites">Add To Favorites</String>
- <String Name="Added">Added</String>
- <String Name="AdlSearch">Automatic Directory Listing Search</String>
- <String Name="AdlsDestination">Destination Directory</String>
- <String Name="AdlsDiscard">Discard</String>
- <String Name="AdlsDownload">Download Matches</String>
- <String Name="AdlsEnabled">Enabled</String>
- <String Name="AdlsFullPath">Full Path</String>
- <String Name="AdlsProperties">ADLSearch Properties</String>
- <String Name="AdlsSearchString">Search String</String>
- <String Name="AdlsSizeMax">Max FileSize</String>
- <String Name="AdlsSizeMin">Min FileSize</String>
- <String Name="AdlsType">Search Type</String>
- <String Name="AdlsUnits">Size Type</String>
- <String Name="AllDownloadSlotsTaken">All download slots taken</String>
- <String Name="AllUsersOffline">All %d users offline</String>
- <String Name="All3UsersOffline">All 3 users offline</String>
- <String Name="All4UsersOffline">All 4 users offline</String>
- <String Name="All">All</String>
- <String Name="Any">Any</String>
- <String Name="AtLeast">At least</String>
- <String Name="AtMost">At most</String>
- <String Name="Audio">Audio</String>
- <String Name="AutoConnect">Auto connect / Name</String>
- <String Name="AutoGrant">Auto grant slot / Nick</String>
- <String Name="Average">Average/s: </String>
- <String Name="Away">AWAY</String>
- <String Name="AwayModeOff">Away mode off</String>
- <String Name="AwayModeOn">Away mode on: </String>
- <String Name="B">B</String>
- <String Name="BanUser">Ban user(s)</String>
- <String Name="BothUsersOffline">Both users offline</String>
- <String Name="Bps">B/s</String>
- <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="CertificateGenerationFailed">TLS disabled, failed to generate certificate: </String>
- <String Name="ChooseFolder">Choose folder</String>
- <String Name="Cid">CID</String>
- <String Name="Close">Close</String>
- <String Name="CloseConnection">Close connection</String>
- <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>
- <String Name="Connected">Connected</String>
- <String Name="Connecting">Connecting...</String>
- <String Name="ConnectingForced">Connecting (forced)...</String>
- <String Name="ConnectingTo">Connecting to </String>
- <String Name="Connection">Connection</String>
- <String Name="ConnectionClosed">Connection closed</String>
- <String Name="ConnectionTimeout">Connection timeout</String>
- <String Name="ConfiguredHubLists">Configured Public Hub Lists</String>
- <String Name="CopyFilename">Copy Filename</String>
- <String Name="CopyHub">Copy address to clipboard</String>
- <String Name="CopyMagnet">Copy magnet link to clipboard</String>
- <String Name="CopyNick">Copy nick to clipboard</String>
- <String Name="CouldNotOpenTargetFile">Could not open target file: </String>
- <String Name="Count">Count</String>
- <String Name="Country">Country</String>
- <String Name="CrcChecked">CRC Checked</String>
- <String Name="DecompressionError">Error during decompression</String>
- <String Name="Description">Description</String>
- <String Name="Destination">Destination</String>
- <String Name="Directory">Directory</String>
- <String Name="DirectoryAlreadyShared">Directory already shared</String>
- <String Name="DirectoryAddError">Directory or directory name already exists</String>
- <String Name="DiscFull">Disk full(?)</String>
- <String Name="DisconnectUser">Disconnect user(s)</String>
- <String Name="Disconnected">Disconnected</String>
- <String Name="DisconnectedUser">Disconnected user leaving the hub: </String>
- <String Name="Document">Document</String>
- <String Name="Done">Done</String>
- <String Name="DontRemoveSlashPassword">Don't remove /password before your password</String>
- <String Name="DontShareTempDirectory">The temporary download directory cannot be shared</String>
- <String Name="Download">Download</String>
- <String Name="DownloadFailed">Download failed: </String>
- <String Name="DownloadFinishedIdle">Download finished, idle...</String>
- <String Name="DownloadQueue">Download Queue</String>
- <String Name="DownloadStarting">Download starting...</String>
- <String Name="DownloadTo">Download to...</String>
- <String Name="DownloadWholeDir">Download whole directory</String>
- <String Name="DownloadWholeDirTo">Download whole directory to...</String>
- <String Name="Downloaded">Downloaded</String>
- <String Name="DownloadedBytes">Downloaded %s (%.01f%%) in %s</String>
- <String Name="DownloadedFrom"> downloaded from </String>
- <String Name="Downloading">Downloading...</String>
- <String Name="DownloadingHubList">Downloading public hub list...</String>
- <String Name="DownloadingList">Downloading list...</String>
- <String Name="Downloads">Downloads</String>
- <String Name="DuplicateFileNotShared">Duplicate file will not be shared: </String>
- <String Name="DuplicateMatch">Dupe matched against: </String>
- <String Name="DuplicateSource">Duplicate source</String>
- <String Name="Edit">Edit</String>
- <String Name="EditAccel">&Edit</String>
- <String Name="Email">E-Mail</String>
- <String Name="EnterNick">Please enter a nickname in the settings dialog!</String>
- <String Name="EnterPassword">Please enter a password</String>
- <String Name="EnterReason">Please enter a reason</String>
- <String Name="EnterSearchString">Enter search string</String>
- <String Name="EnterServer">Please enter a destination server</String>
- <String Name="Errors">Errors</String>
- <String Name="ErrorCreatingHashDataFile">Error creating hash data file: </String>
- <String Name="ErrorCreatingRegistryKeyAdc">Error creating adc registry key</String>
- <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="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>
- <String Name="FavoriteDirNameLong">Under what name you see the directory</String>
- <String Name="FavoriteHubAdded">Favorite hub added</String>
- <String Name="FavoriteHubAlreadyExists">Hub already exists as a favorite</String>
- <String Name="FavoriteHubDoesNotExist">This hub is not a favorite hub</String>
- <String Name="FavoriteHubIdentity">Identification (leave blank for defaults)</String>
- <String Name="FavoriteHubProperties">Favorite Hub Properties</String>
- <String Name="FavoriteHubRemoved">Favorite hub removed</String>
- <String Name="FavoriteHubs">Favorite Hubs</String>
- <String Name="FavoriteUserAdded">Favorite user added</String>
- <String Name="FavoriteUsers">Favorite Users</String>
- <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>
- <String Name="FileListRefreshInitiated">File list refresh initiated</String>
- <String Name="FileListRefrreshInProgress">File list refresh in progress, please wait for it to finish before trying to refresh again</String>
- <String Name="FileNotAvailable">File not available</String>
- <String Name="FileType">File type</String>
- <String Name="FileWithDifferentSize">A file with a different size already exists in the queue</String>
- <String Name="FileWithDifferentTth">A file with different tth root already exists in the queue</String>
- <String Name="Filename">Filename</String>
- <String Name="FilesLeft">files left</String>
- <String Name="FilesPerHour">files/h</String>
- <String Name="Filter">F&ilter</String>
- <String Name="Filtered">Filtered</String>
- <String Name="Find">Find</String>
- <String Name="FinishedDownloads">Finished Downloads</String>
- <String Name="FinishedUploads">Finished Uploads</String>
- <String Name="ForbiddenDollarFile">File with '$' cannot be downloaded and will not be shared: </String>
- <String Name="ForceAttempt">Force attempt</String>
- <String Name="Gib">GiB</String>
- <String Name="GetFileList">Get file list</String>
- <String Name="GoToDirectory">Go to directory</String>
- <String Name="GrantExtraSlot">Grant extra slot</String>
- <String Name="HashDatabase">Hash database</String>
- <String Name="HashProgress">Creating file index...</String>
- <String Name="HashProgressBackground">Run in background</String>
- <String Name="HashProgressStats">Statistics</String>
- <String Name="HashProgressText">Please wait while DC++ indexes your files (they won't be shared until they've been indexed)...</String>
- <String Name="HashReadFailed">Unable to read hash data file</String>
- <String Name="HashRebuilt">Hash database rebuilt</String>
- <String Name="HashingFailed">Hashing failed: </String>
- <String Name="HashingFinished">Finished hashing: </String>
- <String Name="High">High</String>
- <String Name="Highest">Highest</String>
- <String Name="HitRatio">Hit Ratio: </String>
- <String Name="Hits">Hits: </String>
- <String Name="Hub">Hub</String>
- <String Name="Hubs">Hubs</String>
- <String Name="HubAddress">Address</String>
- <String Name="HubListDownloaded">Hub list downloaded...</String>
- <String Name="HubListEdit">Edit the hublist</String>
- <String Name="HubListLoadedFromCache">Hub list loaded from cache...</String>
- <String Name="HubName">Name</String>
- <String Name="HubList">Hublist</String>
- <String Name="HubPassword">Hub password</String>
- <String Name="HubUsers">Users</String>
- <String Name="IgnoreTthSearches">Ignore TTH searches</String>
- <String Name="IgnoredMessage">Ignored message: </String>
- <String Name="IncompleteFavHub">Hub address cannot be empty.</String>
- <String Name="InvalidListname">Invalid file list name</String>
- <String Name="InvalidNumberOfSlots">Invalid number of slots</String>
- <String Name="InvalidTargetFile">Invalid target file (missing directory, check default download directory setting)</String>
- <String Name="InvalidTree">Full tree does not match TTH root</String>
- <String Name="Ip">IP: </String>
- <String Name="IpBare">IP</String>
- <String Name="Items">Items</String>
- <String Name="JoinShowingOff">Join/part showing off</String>
- <String Name="JoinShowingOn">Join/part showing on</String>
- <String Name="Joins">Joins: </String>
- <String Name="Kib">KiB</String>
- <String Name="Kibps">KiB/s</String>
- <String Name="KickUser">Kick user(s)</String>
- <String Name="LargerTargetFileExists">A file of equal or larger size already exists at the target location</String>
- <String Name="LastChange">Last change: </String>
- <String Name="LastHub">Hub (last seen on if offline)</String>
- <String Name="LastSeen">Time last seen</String>
- <String Name="Left">left</String>
- <String Name="ListenerFailed">Listening socket failed (you need to restart DC++): </String>
- <String Name="Loading">Loading DC++, please wait...</String>
- <String Name="LookupAtBitzi">Lookup TTH at Bitzi.com</String>
- <String Name="Low">Low</String>
- <String Name="Lowest">Lowest</String>
- <String Name="MagnetDlgFile">Filename:</String>
- <String Name="MagnetDlgHash">File Hash:</String>
- <String Name="MagnetDlgNothing">Do nothing</String>
- <String Name="MagnetDlgQueue">Add this file to your download queue</String>
- <String Name="MagnetDlgRemember">Do the same action next time without asking</String>
- <String Name="MagnetDlgSearch">Start a search for this file</String>
- <String Name="MagnetDlgTextBad">A MAGNET link was given to DC++, but it didn't contain a valid file hash for use on the Direct Connect network. No action will be taken.</String>
- <String Name="MagnetDlgTextGood">DC++ has detected a MAGNET link with a file hash that can be searched for on the Direct Connect network. What would you like to do?</String>
- <String Name="MagnetDlgTitle">MAGNET Link detected</String>
- <String Name="MagnetHandlerDesc">Download files from the Direct Connect network</String>
- <String Name="MagnetHandlerRoot">DC++</String>
- <String Name="MagnetShellDesc">URL:MAGNET URI</String>
- <String Name="MatchQueue">Match queue</String>
- <String Name="MatchedFiles">Matched %d file(s)</String>
- <String Name="MaxHubs">Max Hubs</String>
- <String Name="MaxSize">Max Size</String>
- <String Name="MaxUsers">Max Users</String>
- <String Name="MinSize">Min Size</String>
- <String Name="Mib">MiB</String>
- <String Name="Mibps">MiB/s</String>
- <String Name="Mibitsps">MiBits/s</String>
- <String Name="MenuAbout">About DC++...</String>
- <String Name="MenuAdlSearch">ADL Search</String>
- <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>
- <String Name="MenuDonate">Donate (paypal)</String>
- <String Name="MenuDownloadQueue">&Download Queue Ctrl+D</String>
- <String Name="MenuExit">E&xit</String>
- <String Name="MenuFaq">Frequently asked questions</String>
- <String Name="MenuFavoriteHubs">&Favorite Hubs Ctrl+F</String>
- <String Name="MenuFavoriteUsers">Favorite &Users Ctrl+U</String>
- <String Name="MenuFile">&File</String>
- <String Name="MenuFollowRedirect">Follow last redirec&t Ctrl+T</String>
- <String Name="MenuHashProgress">Indexing progress</String>
- <String Name="MenuHelp">&Help</String>
- <String Name="MenuHelpDownloads">Downloads</String>
- <String Name="MenuHelpGeoipfile">GeoIP database update</String>
- <String Name="MenuHelpForum">Help forum</String>
- <String Name="MenuHelpTranslations">Translations</String>
- <String Name="MenuHomepage">DC++ Homepage</String>
- <String Name="MenuHorizontalTile">Horizontal Tile</String>
- <String Name="MenuMinimizeAll">Minimize &All</String>
- <String Name="MenuRestoreAll">Restore All</String>
- <String Name="MenuNetworkStatistics">Network Statistics</String>
- <String Name="MenuNotepad">&Notepad Ctrl+N</String>
- <String Name="MenuOpenDownloadsDir">Open downloads directory</String>
- <String Name="MenuOpenFileList">Open file list... Ctrl+L</String>
- <String Name="MenuOpenMatchAll">Match downloaded lists</String>
- <String Name="MenuOpenOwnList">Open own list</String>
- <String Name="MenuPublicHubs">&Public Hubs Ctrl+P</String>
- <String Name="MenuQuickConnect">&Quick Connect ... Ctrl+Q</String>
- <String Name="MenuReconnect">&Reconnect Ctrl+R</String>
- <String Name="MenuRefreshFileList">Refresh file list Ctrl+E</String>
- <String Name="MenuReportBug">Report a bug</String>
- <String Name="MenuRequestFeature">Request a feature</String>
- <String Name="MenuSearch">&Search Ctrl+S</String>
- <String Name="MenuSearchSpy">Search Spy</String>
- <String Name="MenuSettings">Settings...</String>
- <String Name="MenuShow">Show</String>
- <String Name="MenuStatusBar">&Status bar Ctrl+2</String>
- <String Name="MenuSystemLog">System Log</String>
- <String Name="MenuToolbar">&Toolbar Ctrl+1</String>
- <String Name="MenuTransferView">T&ransfers Ctrl+3</String>
- <String Name="MenuVerticalTile">Vertical Tile</String>
- <String Name="MenuView">&View</String>
- <String Name="MenuWindow">&Window</String>
- <String Name="MinShare">Min Share</String>
- <String Name="MinSlots">Min Slots</String>
- <String Name="Move">Move/Rename</String>
- <String Name="MoveDown">Move &Down</String>
- <String Name="MoveUp">Move &Up</String>
- <String Name="NetworkStatistics">Network Statistics</String>
- <String Name="New">&New...</String>
- <String Name="Next">Next</String>
- <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="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>
- <String Name="NotListening">Not listening for connections - please restart DC++</String>
- <String Name="Notepad">Notepad</String>
- <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>
- <String Name="OpenDownloadPage">Open download page?</String>
- <String Name="OpenFolder">Open folder</String>
- <String Name="OperatingSystemNotCompatible">Operating system does not match minimum requirements for feature</String>
- <String Name="OutOfBufferSpace">Out of buffer space</String>
- <String Name="Parts">Parts: </String>
- <String Name="PassiveUser">Passive user</String>
- <String Name="Password">Password</String>
- <String Name="Path">Path</String>
- <String Name="Paused">Paused</String>
- <String Name="Pib">PiB</String>
- <String Name="Picture">Picture</String>
- <String Name="Port">Port: </String>
- <String Name="PreparingFileList">Preparing file list...</String>
- <String Name="PressFollow">Press the follow redirect button to connect to </String>
- <String Name="Priority">Priority</String>
- <String Name="PrivateMessage">Private message</String>
- <String Name="PrivateMessageFrom">Private message from </String>
- <String Name="Properties">&Properties</String>
- <String Name="PublicHubs">Public Hubs</String>
- <String Name="Purge">Purge</String>
- <String Name="QuickConnect">Quick Connect</String>
- <String Name="Rating">Rating</String>
- <String Name="Ratio">Ratio</String>
- <String Name="ReaddSource">Re-add source</String>
- <String Name="ReallyExit">Really exit?</String>
- <String Name="ReallyRemove">Really remove?</String>
- <String Name="Redirect">Redirect</String>
- <String Name="RedirectAlreadyConnected">Redirect request received to a hub that's already connected</String>
- <String Name="RedirectUser">Redirect user(s)</String>
- <String Name="Refresh">&Refresh</String>
- <String Name="RefreshUserList">Refresh user list</String>
- <String Name="Reliability">Reliability</String>
- <String Name="Remove">&Remove</String>
- <String Name="RemoveAll">Remove all</String>
- <String Name="RemoveAllSubdirectories">Remove all subdirectories before adding this one</String>
- <String Name="RemoveFromAll">Remove user from queue</String>
- <String Name="RemoveSource">Remove source</String>
- <String Name="RenamedTo"> renamed to </String>
- <String Name="RollbackInconsistency">Rollback inconsistency, existing file does not match the one being downloaded</String>
- <String Name="Running">Running...</String>
- <String Name="S">s</String>
- <String Name="Search">Search</String>
- <String Name="SearchFor">Search for</String>
- <String Name="SearchForAlternates">Search for alternates</String>
- <String Name="SearchForFile">Search for file</String>
- <String Name="SearchOptions">Search options</String>
- <String Name="SearchSpamFrom">Search spam detected from </String>
- <String Name="SearchSpy">Search Spy</String>
- <String Name="SearchString">Search String</String>
- <String Name="SearchingFor">Searching for </String>
- <String Name="SearchingReady">Ready to search...</String>
- <String Name="SearchingWait">Searching too soon, next search in %i seconds</String>
- <String Name="SeekBeyondEnd">Request to seek beyond the end of data</String>
- <String Name="SendPrivateMessage">Send private message</String>
- <String Name="Separator">Separator</String>
- <String Name="Server">Server</String>
- <String Name="SetPriority">Set priority</String>
- <String Name="Settings">Settings</String>
- <String Name="SettingsAddFinishedInstantly">Add finished files to share instantly (if shared)</String>
- <String Name="SettingsAddFolder">&Add folder</String>
- <String Name="SettingsAdlsBreakOnFirst">Break on first ADLSearch match</String>
- <String Name="SettingsAdvanced">Advanced</String>
- <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 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>
- <String Name="SettingsAppearance2">Appearance\Colors and sounds</String>
- <String Name="SettingsAutodropAutodropsettings">Autodrop settings</String>
- <String Name="SettingsAutodropSpeed">Drop sources below</String>
- <String Name="SettingsAutodropInterval">Check every</String>
- <String Name="SettingsAutodropElapsed">Min elapsed</String>
- <String Name="SettingsAutodropInactivity">Max inactivity</String>
- <String Name="SettingsAutodropMinsources">Min sources online</String>
- <String Name="SettingsAutodropFilesize">Min filesize</String>
- <String Name="SettingsAutodropAll">Autodrop slow sources for all queue items (except filelists)</String>
- <String Name="SettingsAutodropFilelists">Remove slow filelists</String>
- <String Name="SettingsAutodropDisconnect">Don't remove the source when autodropping, only disconnect</String>
- <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>
- <String Name="SettingsAutoOpen">Auto-open at startup</String>
- <String Name="SettingsAutoRefreshTime">Auto refresh time</String>
- <String Name="SettingsBindAddress">Bind address</String>
- <String Name="SettingsBoldOptions">Tab bolding on content change</String>
- <String Name="SettingsCertificates">Advanced\Security Certificates</String>
- <String Name="SettingsChange">&Change</String>
- <String Name="SettingsClearSearch">Clear search box after each search</String>
- <String Name="SettingsColors">Colors</String>
- <String Name="SettingsCommand">Command</String>
- <String Name="SettingsCompressTransfers">Enable safe and compressed transfers</String>
- <String Name="SettingsConfigureHubLists">Configure Public Hub Lists</String>
- <String Name="SettingsConfirmDialogOptions">Confirm dialog options</String>
- <String Name="SettingsConfirmExit">Confirm application exit</String>
- <String Name="SettingsConfirmHubRemoval">Confirm favorite hub removal</String>
- <String Name="SettingsConfirmItemRemoval">Confirm item removal in download queue</String>
- <String Name="SettingsConnectionType">Connection Type</String>
- <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>
- <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="SettingsExternalIp">External / WAN IP</String>
- <String Name="SettingsFavShowJoins">Only show joins / parts for favorite users</String>
- <String Name="SettingsFavoriteDirsPage">Downloads\Favorites</String>
- <String Name="SettingsFavoriteDirs">Favorite download directories</String>
- <String Name="SettingsFileName">Filename</String>
- <String Name="SettingsFilterMessages">Filter kick and NMDC debug messages</String>
- <String Name="SettingsFirewallNat">Firewall with manual port forwarding</String>
- <String Name="SettingsFirewallPassive">Firewall (passive, last resort)</String>
- <String Name="SettingsFirewallUpnp">Firewall with UPnP</String>
- <String Name="SettingsFormat">Format</String>
- <String Name="SettingsGeneral">Personal information</String>
- <String Name="SettingsGetUserCountry">Guess user country from IP</String>
- <String Name="SettingsHubUserCommands">Accept custom user commands from hub</String>
- <String Name="SettingsIgnoreHubPms">Ignore private messages from the hub</String>
- <String Name="SettingsIgnoreBotPms">Ignore private messages from bots</String>
- <String Name="SettingsIncoming">Incoming connection settings (see Help/FAQ if unsure)</String>
- <String Name="SettingsKeepLists">Don't delete file lists when exiting</String>
- <String Name="SettingsLanguageFile">Language file</String>
- <String Name="SettingsListDupes">Keep duplicate files in your file list</String>
- <String Name="SettingsLogDownloads">Log downloads</String>
- <String Name="SettingsLogFilelistTransfers">Log filelist transfers</String>
- <String Name="SettingsLogMainChat">Log main chat</String>
- <String Name="SettingsLogPrivateChat">Log private chat</String>
- <String Name="SettingsLogStatusMessages">Log status messages</String>
- <String Name="SettingsLogSystemMessages">Log system messages</String>
- <String Name="SettingsLogUploads">Log uploads</String>
- <String Name="SettingsLogging">Logging</String>
- <String Name="SettingsLogs">Advanced\Logs</String>
- <String Name="SettingsMagnetAsk">Ask what to do when a magnet link is detected.</String>
- <String Name="SettingsMaxFilelistSize">Max filelist size</String>
- <String Name="SettingsMaxHashSpeed">Max hash speed</String>
- <String Name="SettingsMaxTabRows">Max tab rows</String>
- <String Name="SettingsMinimizeTray">Minimize to tray</String>
- <String Name="SettingsName">Name</String>
- <String Name="SettingsNetwork">Connection settings</String>
- <String Name="SettingsNotificationSound">Notification sound</String>
- <String Name="SettingsNoAwaymsgToBots">Don't send the away message to bots</String>
- <String Name="SettingsOnlyHashed">Note; Files appear...
[truncated message content] |
|
From: <arn...@us...> - 2006-12-13 21:04:05
|
Revision: 691
http://svn.sourceforge.net/dcplusplus/?rev=691&view=rev
Author: arnetheduck
Date: 2006-12-13 13:04:04 -0800 (Wed, 13 Dec 2006)
Log Message:
-----------
ignore generated files
Property Changed:
----------------
dcplusplus/trunk/
dcplusplus/trunk/client/
Property changes on: dcplusplus/trunk
___________________________________________________________________
Name: svn:ignore
- vc7
ADC*
App*
DCPlusPlus.aps
DCPlusPlus.ncb
DCPlusPlus.suo
.*
*.vcproj.*
+ vc7
ADC*
App*
DCPlusPlus.aps
DCPlusPlus.ncb
DCPlusPlus.suo
.*
*.vcproj.*
Example.xml
Property changes on: dcplusplus/trunk/client
___________________________________________________________________
Name: svn:ignore
+ StringDefs.cpp
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <arn...@us...> - 2006-12-14 21:59:22
|
Revision: 692
http://svn.sourceforge.net/dcplusplus/?rev=692&view=rev
Author: arnetheduck
Date: 2006-12-14 13:59:19 -0800 (Thu, 14 Dec 2006)
Log Message:
-----------
release compile fix, yassl fixes
Modified Paths:
--------------
dcplusplus/trunk/DCPlusPlus.rc
dcplusplus/trunk/client/version.h
dcplusplus/trunk/yassl/include/buffer.hpp
dcplusplus/trunk/yassl/taocrypt/src/asn.cpp
dcplusplus/trunk/yassl/taocrypt/src/integer.cpp
dcplusplus/trunk/yassl/taocrypt/src/template_instnt.cpp
dcplusplus/trunk/yassl/yassl.vcproj
Removed Paths:
-------------
dcplusplus/trunk/yassl/mySTL/
dcplusplus/trunk/yassl/taocrypt/mySTL/algorithm.hpp
dcplusplus/trunk/yassl/taocrypt/mySTL/list.hpp
dcplusplus/trunk/yassl/taocrypt/mySTL/memory.hpp
dcplusplus/trunk/yassl/taocrypt/mySTL/pair.hpp
dcplusplus/trunk/yassl/taocrypt/mySTL/stdexcept.hpp
dcplusplus/trunk/yassl/taocrypt/mySTL/vector.hpp
Modified: dcplusplus/trunk/DCPlusPlus.rc
===================================================================
--- dcplusplus/trunk/DCPlusPlus.rc 2006-12-13 21:04:04 UTC (rev 691)
+++ dcplusplus/trunk/DCPlusPlus.rc 2006-12-14 21:59:19 UTC (rev 692)
@@ -7,7 +7,7 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
-#include "atlres.h"
+#include "wtl\\atlres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -831,8 +831,8 @@
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,6,9,8
- PRODUCTVERSION 0,6,9,8
+ FILEVERSION 0,6,9,9
+ PRODUCTVERSION 0,6,9,9
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -840,7 +840,7 @@
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
- FILETYPE 0x2L
+ FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
@@ -849,12 +849,12 @@
BEGIN
VALUE "Comments", "http://dcplusplus.sourceforge.net"
VALUE "FileDescription", "DC++"
- VALUE "FileVersion", "0, 6, 9, 8"
+ VALUE "FileVersion", "0, 6, 9, 9"
VALUE "InternalName", "DC++"
VALUE "LegalCopyright", "Copyright 2001-2006 Jacek Sieka"
VALUE "OriginalFilename", "DCPlusPlus.exe"
VALUE "ProductName", "DC++"
- VALUE "ProductVersion", "0, 6, 9, 8"
+ VALUE "ProductVersion", "0, 6, 9, 9"
END
END
BLOCK "VarFileInfo"
Modified: dcplusplus/trunk/client/version.h
===================================================================
--- dcplusplus/trunk/client/version.h 2006-12-13 21:04:04 UTC (rev 691)
+++ dcplusplus/trunk/client/version.h 2006-12-14 21:59:19 UTC (rev 692)
@@ -17,7 +17,7 @@
*/
#define APPNAME "DC++"
-#define VERSIONSTRING "0.698"
-#define VERSIONFLOAT 0.698
+#define VERSIONSTRING "0.699"
+#define VERSIONFLOAT 0.699
/* Update the .rc file as well... */
Modified: dcplusplus/trunk/yassl/include/buffer.hpp
===================================================================
--- dcplusplus/trunk/yassl/include/buffer.hpp 2006-12-13 21:04:04 UTC (rev 691)
+++ dcplusplus/trunk/yassl/include/buffer.hpp 2006-12-14 21:59:19 UTC (rev 692)
@@ -33,7 +33,7 @@
#include <assert.h> // assert
#include "yassl_types.hpp" // ysDelete
-#include "memory.hpp" // mySTL::auto_ptr
+#include "memory_array.hpp" // mySTL::auto_ptr
#include STL_ALGORITHM_FILE
Deleted: dcplusplus/trunk/yassl/taocrypt/mySTL/algorithm.hpp
===================================================================
--- dcplusplus/trunk/yassl/taocrypt/mySTL/algorithm.hpp 2006-12-13 21:04:04 UTC (rev 691)
+++ dcplusplus/trunk/yassl/taocrypt/mySTL/algorithm.hpp 2006-12-14 21:59:19 UTC (rev 692)
@@ -1,115 +0,0 @@
-/* mySTL algorithm.hpp
- *
- * 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.
- *
- * There are special exceptions to the terms and conditions of the GPL as it
- * is applied to yaSSL. View the full text of the exception in the file
- * FLOSS-EXCEPTIONS in the directory of this software distribution.
- *
- * 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
- */
-
-
-/* mySTL algorithm implements max, min, for_each, swap, find_if, copy,
- * copy_backward, fill
- */
-
-#ifndef mySTL_ALGORITHM_HPP
-#define mySTL_ALGORITHM_HPP
-
-
-namespace mySTL {
-
-
-template<typename T>
-inline const T& max(const T& a, const T&b)
-{
- return a < b ? b : a;
-}
-
-
-template<typename T>
-inline const T& min(const T& a, const T&b)
-{
- return b < a ? b : a;
-}
-
-
-template<typename InIter, typename Func>
-Func for_each(InIter first, InIter last, Func op)
-{
- while (first != last) {
- op(*first);
- ++first;
- }
- return op;
-}
-
-
-template<typename T>
-inline void swap(T& a, T& b)
-{
- T tmp = a;
- a = b;
- b = tmp;
-}
-
-
-template<typename InIter, typename Pred>
-InIter find_if(InIter first, InIter last, Pred pred)
-{
- while (first != last && !pred(*first))
- ++first;
- return first;
-}
-
-
-template<typename InputIter, typename OutputIter>
-inline OutputIter copy(InputIter first, InputIter last, OutputIter place)
-{
- while (first != last) {
- *place = *first;
- ++first;
- ++place;
- }
- return place;
-}
-
-
-template<typename InputIter, typename OutputIter>
-inline OutputIter
-copy_backward(InputIter first, InputIter last, OutputIter place)
-{
- while (first != last)
- *--place = *--last;
- return place;
-}
-
-
-template<typename InputIter, typename T>
-void fill(InputIter first, InputIter last, const T& v)
-{
- while (first != last) {
- *first = v;
- ++first;
- }
-}
-
-
-} // namespace mySTL
-
-#endif // mySTL_ALGORITHM_HPP
Deleted: dcplusplus/trunk/yassl/taocrypt/mySTL/list.hpp
===================================================================
--- dcplusplus/trunk/yassl/taocrypt/mySTL/list.hpp 2006-12-13 21:04:04 UTC (rev 691)
+++ dcplusplus/trunk/yassl/taocrypt/mySTL/list.hpp 2006-12-14 21:59:19 UTC (rev 692)
@@ -1,374 +0,0 @@
-/* mySTL list.hpp
- *
- * 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.
- *
- * There are special exceptions to the terms and conditions of the GPL as it
- * is applied to yaSSL. View the full text of the exception in the file
- * FLOSS-EXCEPTIONS in the directory of this software distribution.
- *
- * 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
- */
-
-
-/* mySTL list implements a simple list
- *
- */
-
-#ifndef mySTL_LIST_HPP
-#define mySTL_LIST_HPP
-
-
-#include "helpers.hpp"
-
-
-namespace mySTL {
-
-
-
-template<typename T>
-class list {
-
-#ifdef __SUNPRO_CC
-/*
- Sun Forte 7 C++ v. 5.4 needs class 'node' public to be visible to
- the nested class 'iterator' (a non-standard behaviour).
-*/
-public:
-#endif
-
- struct node {
- node(T t) : prev_(0), next_(0), value_(t) {}
-
- node* prev_;
- node* next_;
- T value_;
- };
-public:
- list() : head_(0), tail_(0), sz_(0) {}
- ~list();
-
- void push_front(T);
- void pop_front();
- T front() const;
- void push_back(T);
- void pop_back();
- T back() const;
- bool remove(T);
- size_t size() const { return sz_; }
- bool empty() const { return sz_ == 0; }
-
- class iterator {
- node* current_;
- public:
- explicit iterator(node* p = 0) : current_(p) {}
-
- T& operator*() const
- {
- return current_->value_;
- }
-
- T* operator->() const
- {
- return &(operator*());
- }
-
- iterator& operator++()
- {
- current_ = current_->next_;
- return *this;
- }
-
- iterator& operator--()
- {
- current_ = current_->prev_;
- return *this;
- }
-
- iterator operator++(int)
- {
- iterator tmp = *this;
- current_ = current_->next_;
- return tmp;
- }
-
- iterator operator--(int)
- {
- iterator tmp = *this;
- current_ = current_->prev_;
- return tmp;
- }
-
- bool operator==(const iterator& other) const
- {
- return current_ == other.current_;
- }
-
- bool operator!=(const iterator& other) const
- {
- return current_ != other.current_;
- }
-
- friend class list<T>;
- };
-
-
- class reverse_iterator {
- node* current_;
- public:
- explicit reverse_iterator(node* p = 0) : current_(p) {}
-
- T& operator*() const
- {
- return current_->value_;
- }
-
- T* operator->() const
- {
- return &(operator*());
- }
-
- reverse_iterator& operator++()
- {
- current_ = current_->prev_;
- return *this;
- }
-
- reverse_iterator& operator--()
- {
- current_ = current_->next_;
- return *this;
- }
-
- reverse_iterator operator++(int)
- {
- reverse_iterator tmp = *this;
- current_ = current_->prev_;
- return tmp;
- }
-
- reverse_iterator operator--(int)
- {
- reverse_iterator tmp = *this;
- current_ = current_->next_;
- return tmp;
- }
-
- bool operator==(const reverse_iterator& other) const
- {
- return current_ == other.current_;
- }
-
- bool operator!=(const reverse_iterator& other) const
- {
- return current_ != other.current_;
- }
-
- friend class list<T>;
- };
-
- bool erase(iterator);
-
- iterator begin() const { return iterator(head_); }
- reverse_iterator rbegin() const { return reverse_iterator(tail_); }
- iterator end() const { return iterator(); }
- reverse_iterator rend() const { return reverse_iterator(); }
-
- typedef iterator const_iterator; // for now
-
- class underflow {};
- class overflow {};
-private:
- node* head_;
- node* tail_;
- size_t sz_;
-
- node* look_up(T);
-
- list(const list&); // hide copy
- list& operator=(const list&); // and assign
-};
-
-
-template<typename T>
-list<T>::~list()
-{
- node* start = head_;
- node* next_;
-
- for (; start; start = next_) {
- next_ = start->next_;
- destroy(start);
- FreeMemory(start);
- }
-}
-
-
-template<typename T>
-void list<T>::push_front(T t)
-{
- void* mem = GetMemory(sizeof(node));
- node* add = new (reinterpret_cast<yassl_pointer>(mem)) node(t);
-
- if (head_) {
- add->next_ = head_;
- head_->prev_ = add;
- }
- else
- tail_ = add;
-
- head_ = add;
- ++sz_;
-}
-
-
-template<typename T>
-void list<T>::pop_front()
-{
- node* front = head_;
-
- if (head_ == 0)
- return;
- else if (head_ == tail_)
- head_ = tail_ = 0;
- else {
- head_ = head_->next_;
- head_->prev_ = 0;
- }
- destroy(front);
- FreeMemory(front);
- --sz_;
-}
-
-
-template<typename T>
-T list<T>::front() const
-{
- if (head_ == 0) return T();
- return head_->value_;
-}
-
-
-template<typename T>
-void list<T>::push_back(T t)
-{
- void* mem = GetMemory(sizeof(node));
- node* add = new (reinterpret_cast<yassl_pointer>(mem)) node(t);
-
- if (tail_) {
- tail_->next_ = add;
- add->prev_ = tail_;
- }
- else
- head_ = add;
-
- tail_ = add;
- ++sz_;
-}
-
-
-template<typename T>
-void list<T>::pop_back()
-{
- node* rear = tail_;
-
- if (tail_ == 0)
- return;
- else if (tail_ == head_)
- tail_ = head_ = 0;
- else {
- tail_ = tail_->prev_;
- tail_->next_ = 0;
- }
- destroy(rear);
- FreeMemory(rear);
- --sz_;
-}
-
-
-template<typename T>
-T list<T>::back() const
-{
- if (tail_ == 0) return T();
- return tail_->value_;
-}
-
-
-template<typename T>
-typename list<T>::node* list<T>::look_up(T t)
-{
- node* list = head_;
-
- if (list == 0) return 0;
-
- for (; list; list = list->next_)
- if (list->value_ == t)
- return list;
-
- return 0;
-}
-
-
-template<typename T>
-bool list<T>::remove(T t)
-{
- node* del = look_up(t);
-
- if (del == 0)
- return false;
- else if (del == head_)
- pop_front();
- else if (del == tail_)
- pop_back();
- else {
- del->prev_->next_ = del->next_;
- del->next_->prev_ = del->prev_;
-
- destroy(del);
- FreeMemory(del);
- --sz_;
- }
- return true;
-}
-
-
-template<typename T>
-bool list<T>::erase(iterator iter)
-{
- node* del = iter.current_;
-
- if (del == 0)
- return false;
- else if (del == head_)
- pop_front();
- else if (del == tail_)
- pop_back();
- else {
- del->prev_->next_ = del->next_;
- del->next_->prev_ = del->prev_;
-
- destroy(del);
- FreeMemory(del);
- --sz_;
- }
- return true;
-}
-
-
-
-} // namespace mySTL
-
-#endif // mySTL_LIST_HPP
Deleted: dcplusplus/trunk/yassl/taocrypt/mySTL/memory.hpp
===================================================================
--- dcplusplus/trunk/yassl/taocrypt/mySTL/memory.hpp 2006-12-13 21:04:04 UTC (rev 691)
+++ dcplusplus/trunk/yassl/taocrypt/mySTL/memory.hpp 2006-12-14 21:59:19 UTC (rev 692)
@@ -1,143 +0,0 @@
-/* mySTL memory.hpp
- *
- * 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.
- *
- * There are special exceptions to the terms and conditions of the GPL as it
- * is applied to yaSSL. View the full text of the exception in the file
- * FLOSS-EXCEPTIONS in the directory of this software distribution.
- *
- * 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
- */
-
-
-/* mySTL memory implements auto_ptr
- *
- */
-
-#ifndef mySTL_MEMORY_HPP
-#define mySTL_MEMORY_HPP
-
-#include "memory_array.hpp" // for auto_array
-
-#ifdef _MSC_VER
- // disable operator-> warning for builtins
- #pragma warning(disable:4284)
-#endif
-
-
-namespace mySTL {
-
-
-template<typename T>
-struct auto_ptr_ref {
- T* ptr_;
- explicit auto_ptr_ref(T* p) : ptr_(p) {}
-};
-
-
-template<typename T>
-class auto_ptr {
- T* ptr_;
-
- void Destroy()
- {
- #ifdef YASSL_LIB
- yaSSL::ysDelete(ptr_);
- #else
- TaoCrypt::tcDelete(ptr_);
- #endif
- }
-public:
- explicit auto_ptr(T* p = 0) : ptr_(p) {}
-
- ~auto_ptr()
- {
- Destroy();
- }
-
-
- auto_ptr(auto_ptr& other) : ptr_(other.release()) {}
-
- auto_ptr& operator=(auto_ptr& that)
- {
- if (this != &that) {
- Destroy();
- ptr_ = that.release();
- }
- return *this;
- }
-
-
- T* operator->() const
- {
- return ptr_;
- }
-
- T& operator*() const
- {
- return *ptr_;
- }
-
- T* get() const
- {
- return ptr_;
- }
-
- T* release()
- {
- T* tmp = ptr_;
- ptr_ = 0;
- return tmp;
- }
-
- void reset(T* p = 0)
- {
- if (ptr_ != p) {
- Destroy();
- ptr_ = p;
- }
- }
-
- // auto_ptr_ref conversions
- auto_ptr(auto_ptr_ref<T> ref) : ptr_(ref.ptr_) {}
-
- auto_ptr& operator=(auto_ptr_ref<T> ref)
- {
- if (this->ptr_ != ref.ptr_) {
- Destroy();
- ptr_ = ref.ptr_;
- }
- return *this;
- }
-
- template<typename T2>
- operator auto_ptr<T2>()
- {
- return auto_ptr<T2>(this->release());
- }
-
- template<typename T2>
- operator auto_ptr_ref<T2>()
- {
- return auto_ptr_ref<T2>(this->release());
- }
-};
-
-
-} // namespace mySTL
-
-#endif // mySTL_MEMORY_HPP
Deleted: dcplusplus/trunk/yassl/taocrypt/mySTL/pair.hpp
===================================================================
--- dcplusplus/trunk/yassl/taocrypt/mySTL/pair.hpp 2006-12-13 21:04:04 UTC (rev 691)
+++ dcplusplus/trunk/yassl/taocrypt/mySTL/pair.hpp 2006-12-14 21:59:19 UTC (rev 692)
@@ -1,65 +0,0 @@
-/* mySTL pair.hpp
- *
- * 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.
- *
- * There are special exceptions to the terms and conditions of the GPL as it
- * is applied to yaSSL. View the full text of the exception in the file
- * FLOSS-EXCEPTIONS in the directory of this software distribution.
- *
- * 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
- */
-
-
-/* mySTL pair implements pair
- *
- */
-
-#ifndef mySTL_PAIR_HPP
-#define mySTL_PAIR_HPP
-
-
-
-namespace mySTL {
-
-
-template<typename T1, typename T2>
-struct pair {
- typedef T1 first_type;
- typedef T2 second_type;
-
- first_type first;
- second_type second;
-
- pair() {}
- pair(const T1& t1, const T2& t2) : first(t1), second(t2) {}
-
- template<typename U1, typename U2>
- pair(const pair<U1, U2>& p) : first(p.first), second(p.second) {}
-};
-
-
-template<typename T1, typename T2>
-inline pair<T1, T2> make_pair(const T1& a, const T2& b)
-{
- return pair<T1, T2>(a, b);
-}
-
-
-
-} // namespace mySTL
-
-#endif // mySTL_PAIR_HPP
Deleted: dcplusplus/trunk/yassl/taocrypt/mySTL/stdexcept.hpp
===================================================================
--- dcplusplus/trunk/yassl/taocrypt/mySTL/stdexcept.hpp 2006-12-13 21:04:04 UTC (rev 691)
+++ dcplusplus/trunk/yassl/taocrypt/mySTL/stdexcept.hpp 2006-12-14 21:59:19 UTC (rev 692)
@@ -1,84 +0,0 @@
-/* mySTL stdexcept.hpp
- *
- * 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.
- *
- * There are special exceptions to the terms and conditions of the GPL as it
- * is applied to yaSSL. View the full text of the exception in the file
- * FLOSS-EXCEPTIONS in the directory of this software distribution.
- *
- * 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
- */
-
-
-/* mySTL memory implements exception, runtime_error
- *
- */
-
-#ifndef mySTL_STDEXCEPT_HPP
-#define mySTL_STDEXCEPT_HPP
-
-
-#include <string.h> // strncpy
-#include <assert.h> // assert
-#include <stdlib.h> // size_t
-
-
-namespace mySTL {
-
-
-class exception {
-public:
- exception() {}
- virtual ~exception() {} // to shut up compiler warnings
-
- virtual const char* what() const { return ""; }
-
- // for compiler generated call, never used
- static void operator delete(void*) { assert(0); }
-private:
- // don't allow dynamic creation of exceptions
- static void* operator new(size_t);
-};
-
-
-class named_exception : public exception {
-public:
- enum { NAME_SIZE = 80 };
-
- explicit named_exception(const char* str)
- {
- strncpy(name_, str, NAME_SIZE);
- name_[NAME_SIZE - 1] = 0;
- }
-
- virtual const char* what() const { return name_; }
-private:
- char name_[NAME_SIZE];
-};
-
-
-class runtime_error : public named_exception {
-public:
- explicit runtime_error(const char* str) : named_exception(str) {}
-};
-
-
-
-
-} // namespace mySTL
-
-#endif // mySTL_STDEXCEPT_HPP
Deleted: dcplusplus/trunk/yassl/taocrypt/mySTL/vector.hpp
===================================================================
--- dcplusplus/trunk/yassl/taocrypt/mySTL/vector.hpp 2006-12-13 21:04:04 UTC (rev 691)
+++ dcplusplus/trunk/yassl/taocrypt/mySTL/vector.hpp 2006-12-14 21:59:19 UTC (rev 692)
@@ -1,161 +0,0 @@
-/* mySTL vector.hpp
- *
- * 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.
- *
- * There are special exceptions to the terms and conditions of the GPL as it
- * is applied to yaSSL. View the full text of the exception in the file
- * FLOSS-EXCEPTIONS in the directory of this software distribution.
- *
- * 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
- */
-
-
-/* mySTL vector implements simple vector, w/ swap
- *
- */
-
-#ifndef mySTL_VECTOR_HPP
-#define mySTL_VECTOR_HPP
-
-#include "helpers.hpp" // construct, destory, fill, etc.
-#include "algorithm.hpp" // swap
-#include <assert.h> // assert
-
-
-namespace mySTL {
-
-
-template <typename T>
-struct vector_base {
- T* start_;
- T* finish_;
- T* end_of_storage_;
-
- vector_base() : start_(0), finish_(0), end_of_storage_(0) {}
- vector_base(size_t n)
- {
- start_ = GetArrayMemory<T>(n);
- finish_ = start_;
- end_of_storage_ = start_ + n;
- }
-
- ~vector_base()
- {
- FreeArrayMemory(start_);
- }
-
- void Swap(vector_base& that)
- {
- swap(start_, that.start_);
- swap(finish_, that.finish_);
- swap(end_of_storage_, that.end_of_storage_);
- }
-};
-
-
-
-template <typename T>
-class vector {
-public:
- typedef T* iterator;
- typedef const T* const_iterator;
-
- vector() {}
- explicit vector(size_t n) : vec_(n)
- {
- vec_.finish_ = uninit_fill_n(vec_.start_, n, T());
- }
-
- ~vector() { destroy(vec_.start_, vec_.finish_); }
-
- vector(const vector& other) : vec_(other.size())
- {
- vec_.finish_ = uninit_copy(other.vec_.start_, other.vec_.finish_,
- vec_.start_);
- }
-
- size_t capacity() const { return vec_.end_of_storage_ - vec_.start_; }
-
- size_t size() const { return vec_.finish_ - vec_.start_; }
-
- T& operator[](size_t idx) { return *(vec_.start_ + idx); }
- const T& operator[](size_t idx) const { return *(vec_.start_ + idx); }
-
- const T* begin() const { return vec_.start_; }
- const T* end() const { return vec_.finish_; }
-
- void push_back(const T& v)
- {
- if (vec_.finish_ != vec_.end_of_storage_) {
- construct(vec_.finish_, v);
- ++vec_.finish_;
- }
- else {
- vector tmp(size() * 2 + 1, *this);
- construct(tmp.vec_.finish_, v);
- ++tmp.vec_.finish_;
- Swap(tmp);
- }
- }
-
- void resize(size_t n, const T& v)
- {
- if (n == size()) return;
-
- if (n < size()) {
- T* first = vec_.start_ + n;
- destroy(first, vec_.finish_);
- vec_.finish_ -= vec_.finish_ - first;
- }
- else {
- vector tmp(n, *this);
- tmp.vec_.finish_ = uninit_fill_n(tmp.vec_.finish_, n - size(), v);
- Swap(tmp);
- }
- }
-
- void reserve(size_t n)
- {
- if (capacity() < n) {
- vector tmp(n, *this);
- Swap(tmp);
- }
- }
-
- void Swap(vector& that)
- {
- vec_.Swap(that.vec_);
- }
-private:
- vector_base<T> vec_;
-
- vector& operator=(const vector&); // hide assign
-
- // for growing, n must be bigger than other size
- vector(size_t n, const vector& other) : vec_(n)
- {
- assert(n > other.size());
- vec_.finish_ = uninit_copy(other.vec_.start_, other.vec_.finish_,
- vec_.start_);
- }
-};
-
-
-
-} // namespace mySTL
-
-#endif // mySTL_VECTOR_HPP
Modified: dcplusplus/trunk/yassl/taocrypt/src/asn.cpp
===================================================================
--- dcplusplus/trunk/yassl/taocrypt/src/asn.cpp 2006-12-13 21:04:04 UTC (rev 691)
+++ dcplusplus/trunk/yassl/taocrypt/src/asn.cpp 2006-12-14 21:59:19 UTC (rev 692)
@@ -857,7 +857,7 @@
bool CertDecoder::ConfirmSignature(Source& pub)
{
HashType ht;
- mySTL::auto_ptr<HASH> hasher;
+ STL_NAMESPACE::auto_ptr<HASH> hasher;
if (signatureOID_ == MD5wRSA) {
hasher.reset(NEW_TC MD5);
Modified: dcplusplus/trunk/yassl/taocrypt/src/integer.cpp
===================================================================
--- dcplusplus/trunk/yassl/taocrypt/src/integer.cpp 2006-12-13 21:04:04 UTC (rev 691)
+++ dcplusplus/trunk/yassl/taocrypt/src/integer.cpp 2006-12-14 21:59:19 UTC (rev 692)
@@ -572,24 +572,24 @@
class Portable
{
public:
- static word Add(word *C, const word *A, const word *B, unsigned int N);
- static word Subtract(word *C, const word *A, const word*B, unsigned int N);
+ static word TAOCRYPT_CDECL Add(word *C, const word *A, const word *B, unsigned int N);
+ static word TAOCRYPT_CDECL Subtract(word *C, const word *A, const word*B, unsigned int N);
- static void Multiply2(word *C, const word *A, const word *B);
- static word Multiply2Add(word *C, const word *A, const word *B);
- static void Multiply4(word *C, const word *A, const word *B);
- static void Multiply8(word *C, const word *A, const word *B);
- static unsigned int MultiplyRecursionLimit() {return 8;}
+ static void TAOCRYPT_CDECL Multiply2(word *C, const word *A, const word *B);
+ static word TAOCRYPT_CDECL Multiply2Add(word *C, const word *A, const word *B);
+ static void TAOCRYPT_CDECL Multiply4(word *C, const word *A, const word *B);
+ static void TAOCRYPT_CDECL Multiply8(word *C, const word *A, const word *B);
+ static unsigned int TAOCRYPT_CDECL MultiplyRecursionLimit() {return 8;}
- static void Multiply2Bottom(word *C, const word *A, const word *B);
- static void Multiply4Bottom(word *C, const word *A, const word *B);
- static void Multiply8Bottom(word *C, const word *A, const word *B);
- static unsigned int MultiplyBottomRecursionLimit() {return 8;}
+ static void TAOCRYPT_CDECL Multiply2Bottom(word *C, const word *A, const word *B);
+ static void TAOCRYPT_CDECL Multiply4Bottom(word *C, const word *A, const word *B);
+ static void TAOCRYPT_CDECL Multiply8Bottom(word *C, const word *A, const word *B);
+ static unsigned int TAOCRYPT_CDECL MultiplyBottomRecursionLimit() {return 8;}
- static void Square2(word *R, const word *A);
- static void Square4(word *R, const word *A);
- static void Square8(word *R, const word *A) {assert(false);}
- static unsigned int SquareRecursionLimit() {return 4;}
+ static void TAOCRYPT_CDECL Square2(word *R, const word *A);
+ static void TAOCRYPT_CDECL Square4(word *R, const word *A);
+ static void TAOCRYPT_CDECL Square8(word *R, const word *A) {assert(false);}
+ static unsigned int TAOCRYPT_CDECL SquareRecursionLimit() {return 4;}
};
word Portable::Add(w...
[truncated message content] |