← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2251: blacklist touch-ups

 

------------------------------------------------------------
revno: 2251
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-10-01 16:24:13 +0200
message:
  blacklist touch-ups
modified:
  dcpp/FavoriteManager.cpp
  dcpp/FavoriteManager.h
  dcpp/NmdcHub.cpp
  win32/MainWindow.cpp
  win32/PublicHubsFrame.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dcpp/FavoriteManager.cpp'
--- dcpp/FavoriteManager.cpp	2010-09-30 17:34:28 +0000
+++ dcpp/FavoriteManager.cpp	2010-10-01 14:24:13 +0000
@@ -42,8 +42,16 @@
 
 	File::ensureDirectory(Util::getHubListsPath());
 
-	blacklist.insert(make_pair("adchublist.com", "Domain used for spam purposes."));
-	blacklist.insert(make_pair("openhublist.org", "Domain used for spam purposes."));
+	/* after the release of the first version including this blacklist, remember to also update
+	version.xml when a domain has to be added to this list, using the following format:
+	<Blacklist>
+		<Blacklisted Domain="example1.com" Reason="Domain used for spam purposes."/>
+		<Blacklisted Domain="example2.com" Reason="Domain used for spam purposes."/>
+	</Blacklist>
+	(the "Blacklist" tag should be under the main "DCUpdate" tag.) */
+	addBlacklist("adchublist.com", "Domain used for spam purposes.");
+	addBlacklist("hublist.org", "Domain used for spam purposes.");
+	addBlacklist("openhublist.org", "Domain used for spam purposes.");
 }
 
 FavoriteManager::~FavoriteManager() throw() {
@@ -666,10 +674,10 @@
 	return i->second;
 }
 
-void FavoriteManager::addBlacklist(const string& url, const string& reason) {
-	if(url.empty() || reason.empty())
+void FavoriteManager::addBlacklist(const string& domain, const string& reason) {
+	if(domain.empty() || reason.empty())
 		return;
-	blacklist[url] = reason;
+	blacklist[domain] = reason;
 }
 
 FavoriteHubEntryList::iterator FavoriteManager::getFavoriteHub(const string& aServer) {

=== modified file 'dcpp/FavoriteManager.h'
--- dcpp/FavoriteManager.h	2010-09-30 17:34:28 +0000
+++ dcpp/FavoriteManager.h	2010-10-01 14:24:13 +0000
@@ -59,9 +59,10 @@
 	}
 	bool isDownloading() { return (useHttp && running); }
 	const string& getCurrentHubList() const { return publicListServer; }
-	/// @return ref to the reason string the current list is blacklisted; or empty string otherwise.
+	/// @return ref to the reason string the current list is blacklisted for; or empty string otherwise
 	const string& blacklisted() const;
-	void addBlacklist(const string& url, const string& reason);
+	/// @param domain a domain name with 2 words max, such as "example.com"
+	void addBlacklist(const string& domain, const string& reason);
 
 // Favorite Users
 	typedef unordered_map<CID, FavoriteUser> FavoriteMap;

=== modified file 'dcpp/NmdcHub.cpp'
--- dcpp/NmdcHub.cpp	2010-08-30 14:04:10 +0000
+++ dcpp/NmdcHub.cpp	2010-10-01 14:24:13 +0000
@@ -979,8 +979,6 @@
 		protectedIPs.clear();
 
 		protectedIPs.push_back("dcpp.net");
-		protectedIPs.push_back("hublist.org");
-		protectedIPs.push_back("openhublist.org");
 		protectedIPs.push_back("dchublist.com");
 		protectedIPs.push_back("hublista.hu");
 		protectedIPs.push_back("adcportal.com");

=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp	2010-09-30 17:34:28 +0000
+++ win32/MainWindow.cpp	2010-10-01 14:24:13 +0000
@@ -1186,13 +1186,13 @@
 		if(xml.findChild("Blacklist")) {
 			xml.stepIn();
 			while(xml.findChild("Blacklisted")) {
-				const string& url = xml.getChildAttrib("Url");
-				if(url.empty())
+				const string& domain = xml.getChildAttrib("Domain");
+				if(domain.empty())
 					continue;
 				const string& reason = xml.getChildAttrib("Reason");
 				if(reason.empty())
 					continue;
-				FavoriteManager::getInstance()->addBlacklist(url, reason);
+				FavoriteManager::getInstance()->addBlacklist(domain, reason);
 			}
 			xml.stepOut();
 		}

=== modified file 'win32/PublicHubsFrame.cpp'
--- win32/PublicHubsFrame.cpp	2010-09-30 17:34:28 +0000
+++ win32/PublicHubsFrame.cpp	2010-10-01 14:24:13 +0000
@@ -103,6 +103,7 @@
 
 		{
 			TextBox::Seed seed = WinUtil::Seeds::textBox;
+			seed.style &= ~WS_VISIBLE;
 			seed.style |= WS_DISABLED | ES_MULTILINE | WS_VSCROLL | ES_READONLY;
 			seed.lines = 8;
 			blacklist = upper->addChild(seed);
@@ -262,6 +263,7 @@
 	const string& blacklisted = FavoriteManager::getInstance()->blacklisted();
 	if(blacklisted.empty()) {
 		if(blacklist->getEnabled()) {
+			blacklist->setText(Util::emptyStringT);
 			blacklist->setEnabled(false);
 			blacklist->setVisible(false);
 			upper->row(0).mode = GridInfo::STATIC;