From: <arn...@us...> - 2006-06-19 19:17:14
|
Revision: 622 Author: arnetheduck Date: 2006-06-19 12:16:49 -0700 (Mon, 19 Jun 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=622&view=rev Log Message: ----------- Fixes / patches Modified Paths: -------------- dcplusplus/trunk/DCPlusPlus.rc dcplusplus/trunk/Example.xml dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/ClientManager.cpp dcplusplus/trunk/client/NmdcHub.cpp dcplusplus/trunk/client/Util.cpp dcplusplus/trunk/client/Util.h dcplusplus/trunk/client/version.h dcplusplus/trunk/windows/ExListViewCtrl.cpp dcplusplus/trunk/windows/ExListViewCtrl.h dcplusplus/trunk/windows/HubFrame.cpp dcplusplus/trunk/windows/WinUtil.cpp dcplusplus/trunk/windows/WinUtil.h Modified: dcplusplus/trunk/DCPlusPlus.rc =================================================================== --- dcplusplus/trunk/DCPlusPlus.rc 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/DCPlusPlus.rc 2006-06-19 19:16:49 UTC (rev 622) @@ -933,8 +933,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,6,9,1 - PRODUCTVERSION 0,6,9,1 + FILEVERSION 0,6,9,2 + PRODUCTVERSION 0,6,9,2 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -951,12 +951,12 @@ BEGIN VALUE "Comments", "http://dcplusplus.sourceforge.net" VALUE "FileDescription", "DC++" - VALUE "FileVersion", "0, 6, 9, 1" + VALUE "FileVersion", "0, 6, 9, 2" VALUE "InternalName", "DC++" VALUE "LegalCopyright", "Copyright 2001-2006 Jacek Sieka" VALUE "OriginalFilename", "DCPlusPlus.exe" VALUE "ProductName", "DC++" - VALUE "ProductVersion", "0, 6, 9, 1" + VALUE "ProductVersion", "0, 6, 9, 2" END END BLOCK "VarFileInfo" Modified: dcplusplus/trunk/Example.xml =================================================================== --- dcplusplus/trunk/Example.xml 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/Example.xml 2006-06-19 19:16:49 UTC (rev 622) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> -<Language Name="Example Language" Author="arnetheduck" Version="0.691" Revision="1" RightToLeft="0"> +<Language Name="Example Language" Author="arnetheduck" Version="0.692" Revision="1" RightToLeft="0"> <Strings> <String Name="Active">Active</String> <String Name="ActiveSearchString">Enabled / Search String</String> Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/changelog.txt 2006-06-19 19:16:49 UTC (rev 622) @@ -23,7 +23,11 @@ * Fixed targetdrive bug for temp target location * Fixed a crash bug when hash data cannot be saved * Possibly fixed issues with queue items not being updated +* Added warning when someone tries to spam hublist.org or dcpp.net with your client +* [bug 968] Fixed unix compile issue (thanks pothead) +* [bug 975] Fixed silly warning (thanks pothead) + -- 0.691 2006-06-03 -- * Links to bugzilla in html changelog * [bug 122] Added userlist filter (thanks trem) Modified: dcplusplus/trunk/client/ClientManager.cpp =================================================================== --- dcplusplus/trunk/client/ClientManager.cpp 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/client/ClientManager.cpp 2006-06-19 19:16:49 UTC (rev 622) @@ -29,6 +29,7 @@ #include "SimpleXML.h" #include "UserCommand.h" #include "ResourceManager.h" +#include "LogManager.h" #include "AdcHub.h" #include "NmdcHub.h" @@ -364,7 +365,15 @@ u_int16_t port = 0; Util::decodeUrl(aSeeker, ip, port, file); ip = Socket::resolve(ip); - if(port == 0) port = 412; + + // Temporary fix to avoid spamming hublist.org and dcpp.net + if(ip == "70.85.55.252" || ip == "207.44.220.108") { + LogManager::getInstance()->message("Someone is trying to use your client to spam " + ip + ", please urge hub owner to fix this"); + return; + } + + if(port == 0) + port = 412; for(SearchResult::Iter i = l.begin(); i != l.end(); ++i) { SearchResult* sr = *i; s.writeTo(ip, port, sr->toSR(*aClient)); Modified: dcplusplus/trunk/client/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/client/NmdcHub.cpp 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/client/NmdcHub.cpp 2006-06-19 19:16:49 UTC (rev 622) @@ -800,22 +800,6 @@ tmp.replace(i, 5, "&"); i++; } -#if 0 -/// @todo move this to a better place - if(checkNewLines) { - // Check all '<' and '[' after newlines... - i = 0; - while( (i = tmp.find('\n', i)) != string::npos) { - if(i + 1 < tmp.length()) { - if(tmp[i+1] == '[' || tmp[i+1] == '<') { - tmp.insert(i+1, "- "); - i += 2; - } - } - i++; - } - } -#endif } else { i = 0; while( (i = tmp.find("&", i)) != string::npos) { Modified: dcplusplus/trunk/client/Util.cpp =================================================================== --- dcplusplus/trunk/client/Util.cpp 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/client/Util.cpp 2006-06-19 19:16:49 UTC (rev 622) @@ -341,24 +341,6 @@ return buf; } -double Util::toBytes(TCHAR* aSize) { - double bytes = _tstof(aSize); - - if (_tcsstr(aSize, CTSTRING(PIB))) { - return bytes * 1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0; - } else if (_tcsstr(aSize, CTSTRING(TiB))) { - return bytes * 1024.0 * 1024.0 * 1024.0 * 1024.0; - } else if (_tcsstr(aSize, CTSTRING(GiB))) { - return bytes * 1024.0 * 1024.0 * 1024.0; - } else if (_tcsstr(aSize, CTSTRING(MiB))) { - return bytes * 1024.0 * 1024.0; - } else if (_tcsstr(aSize, CTSTRING(KiB))) { - return bytes * 1024.0; - } else { - return bytes; - } -} - string Util::formatExactSize(int64_t aBytes) { #ifdef _WIN32 TCHAR buf[64]; @@ -916,3 +898,19 @@ } return tmp2; } + +string Util::formatMessage(const string& nick, const string& message) { + string tmp = '<' + nick + "> " + message; + // Check all '<' and '[' after newlines as they're probably pasts... + size_t i = 0; + while( (i = tmp.find('\n', i)) != string::npos) { + if(i + 1 < tmp.length()) { + if(tmp[i+1] == '[' || tmp[i+1] == '<') { + tmp.insert(i+1, "- "); + i += 2; + } + } + i++; + } + return toDOS(tmp); +} \ No newline at end of file Modified: dcplusplus/trunk/client/Util.h =================================================================== --- dcplusplus/trunk/client/Util.h 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/client/Util.h 2006-06-19 19:16:49 UTC (rev 622) @@ -274,8 +274,7 @@ return formatBytes(toInt64(aString)); } - static double toBytes(TCHAR* aSize); - + static string formatMessage(const string& nick, const string& message); static string toDOS(const string& tmp); static string getShortTimeString(time_t t = time(NULL) ); Modified: dcplusplus/trunk/client/version.h =================================================================== --- dcplusplus/trunk/client/version.h 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/client/version.h 2006-06-19 19:16:49 UTC (rev 622) @@ -17,8 +17,8 @@ */ #define APPNAME "DC++" -#define VERSIONSTRING "0.691" -#define VERSIONFLOAT 0.691 +#define VERSIONSTRING "0.692" +#define VERSIONFLOAT 0.692 /* Update the .rc file as well... */ Modified: dcplusplus/trunk/windows/ExListViewCtrl.cpp =================================================================== --- dcplusplus/trunk/windows/ExListViewCtrl.cpp 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/windows/ExListViewCtrl.cpp 2006-06-19 19:16:49 UTC (rev 622) @@ -45,9 +45,9 @@ lvi.iItem = newPos; } int i = InsertItem(&lvi); - int j = 0; - for(TStringIter k = l.begin(); k != l.end(); ++k, j++) { - SetItemText(i, j, k->c_str()); + int m = 0; + for(TStringIter k = l.begin(); k != l.end(); ++k, m++) { + SetItemText(i, m, k->c_str()); } EnsureVisible(i, FALSE); Modified: dcplusplus/trunk/windows/ExListViewCtrl.h =================================================================== --- dcplusplus/trunk/windows/ExListViewCtrl.h 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/windows/ExListViewCtrl.h 2006-06-19 19:16:49 UTC (rev 622) @@ -23,8 +23,8 @@ #pragma once #endif // _MSC_VER > 1000 -#include "../client/Util.h" #include "ListViewArrows.h" +#include "WinUtil.h" class ExListViewCtrl : public CWindowImpl<ExListViewCtrl, CListViewCtrl, CControlWinTraits>, public ListViewArrows<ExListViewCtrl> @@ -147,7 +147,7 @@ } else if(result == SORT_BYTES) { p->GetItemText(na, p->sortColumn, buf, 128); p->GetItemText(nb, p->sortColumn, buf2, 128); - result = compare(Util::toBytes(buf), Util::toBytes(buf2)); + result = compare(WinUtil::toBytes(buf), WinUtil::toBytes(buf2)); } if(!p->ascending) result = -result; Modified: dcplusplus/trunk/windows/HubFrame.cpp =================================================================== --- dcplusplus/trunk/windows/HubFrame.cpp 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/windows/HubFrame.cpp 2006-06-19 19:16:49 UTC (rev 622) @@ -1250,7 +1250,7 @@ speak(SET_WINDOW_TITLE, hubName); } void HubFrame::on(Message, Client*, const OnlineUser& from, const string& msg) throw() { - speak(ADD_CHAT_LINE, Util::toDOS("<" + from.getIdentity().getNick() + "> " + msg)); + speak(ADD_CHAT_LINE, Util::formatMessage(from.getIdentity().getNick(), msg)); } void HubFrame::on(StatusMessage, Client*, const string& line) { @@ -1268,7 +1268,7 @@ } void HubFrame::on(PrivateMessage, Client*, const OnlineUser& from, const OnlineUser& to, const OnlineUser& replyTo, const string& line) throw() { - speak(from, to, replyTo, Util::toDOS("<" + from.getIdentity().getNick() + "> " + line)); + speak(from, to, replyTo, Util::formatMessage(from.getIdentity().getNick(), line)); } void HubFrame::on(NickTaken, Client*) throw() { speak(ADD_STATUS_LINE, STRING(NICK_TAKEN)); Modified: dcplusplus/trunk/windows/WinUtil.cpp =================================================================== --- dcplusplus/trunk/windows/WinUtil.cpp 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/windows/WinUtil.cpp 2006-06-19 19:16:49 UTC (rev 622) @@ -1113,6 +1113,24 @@ } } +double WinUtil::toBytes(TCHAR* aSize) { + double bytes = _tstof(aSize); + + if (_tcsstr(aSize, CTSTRING(PIB))) { + return bytes * 1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0; + } else if (_tcsstr(aSize, CTSTRING(TiB))) { + return bytes * 1024.0 * 1024.0 * 1024.0 * 1024.0; + } else if (_tcsstr(aSize, CTSTRING(GiB))) { + return bytes * 1024.0 * 1024.0 * 1024.0; + } else if (_tcsstr(aSize, CTSTRING(MiB))) { + return bytes * 1024.0 * 1024.0; + } else if (_tcsstr(aSize, CTSTRING(KiB))) { + return bytes * 1024.0; + } else { + return bytes; + } +} + int WinUtil::getOsMajor() { OSVERSIONINFOEX ver; memset(&ver, 0, sizeof(OSVERSIONINFOEX)); Modified: dcplusplus/trunk/windows/WinUtil.h =================================================================== --- dcplusplus/trunk/windows/WinUtil.h 2006-06-18 21:46:33 UTC (rev 621) +++ dcplusplus/trunk/windows/WinUtil.h 2006-06-19 19:16:49 UTC (rev 622) @@ -312,6 +312,8 @@ static int getDirIconIndex() { return dirIconIndex; } static int getDirMaskedIndex() { return dirMaskedIndex; } + + static double toBytes(TCHAR* aSize); static int getOsMajor(); static int getOsMinor(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |