← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3360: Added ability to filter out files.

 

------------------------------------------------------------
revno: 3360
committer: Fredrik Ullner <ullner@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Fri 2013-11-01 19:38:32 +0100
message:
  Added ability to filter out files.
  Added int64 management in textboxes
added:
  help/settings_sharing_filtering.html
  res/UploadFiltering.ico
  win32/ItemsEditDlg.cpp
  win32/ItemsEditDlg.h
  win32/UploadFilteringPage.cpp
  win32/UploadFilteringPage.h
modified:
  changelog.txt
  dcpp/SettingsManager.cpp
  dcpp/SettingsManager.h
  dcpp/ShareManager.cpp
  dcpp/ShareManager.h
  help/DCPlusPlus.hhp
  help/index.html
  help/resource.h
  help/settings_sharing.html
  win32/DCPlusPlus.rc
  win32/PropPage.cpp
  win32/PropPage.h
  win32/SettingsDialog.cpp
  win32/UploadPage.cpp
  win32/resource.h


--
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 'changelog.txt'
--- changelog.txt	2013-09-29 14:47:02 +0000
+++ changelog.txt	2013-11-01 18:38:32 +0000
@@ -1,4 +1,5 @@
 * [ADC] Don't disconnect CCPM conns after 3 minutes of inactivity (poy)
+* [L#1115765] Added ability to filter out files and directories from the share (ullner)
 
 -- 0.830 2013-09-22 --
 * [L#1010996] Correct search responses (maksis, poy)

=== modified file 'dcpp/SettingsManager.cpp'
--- dcpp/SettingsManager.cpp	2013-09-22 13:55:59 +0000
+++ dcpp/SettingsManager.cpp	2013-11-01 18:38:32 +0000
@@ -60,6 +60,7 @@
 	"TLSPrivateKeyFile", "TLSCertificateFile", "TLSTrustedCertificatesPath",
 	"Language", "Toolbar", "LastSearchType", "Mapper",
 	"SoundMainChat", "SoundPM", "SoundPMWindow", "SoundFinishedDL", "SoundFinishedFL", "LastSharedFolder",
+	"SharingSkiplistExtensions", "SharingSkiplistRegEx", "SharingSkiplistPaths",
 	"SENTRY",
 	// Ints
 	"IncomingConnections", "OutgoingConnections", "InPort", "UDPPort", "TLSPort",
@@ -110,7 +111,7 @@
 	"UsersFilterFavorite", "UsersFilterOnline", "UsersFilterQueue", "UsersFilterWaiting",
 	"SENTRY",
 	// Int64
-	"TotalUpload", "TotalDownload",
+	"TotalUpload", "TotalDownload", "SharingSkiplistMinSize", "SharingSkiplistMaxSize",
 	"SENTRY",
 	// Floats
 	"FileListPanedPos", "HubPanedPos", "QueuePanedPos", "SearchPanedPos",
@@ -353,6 +354,11 @@
 	setDefault(ENABLE_CCPM, true);
 	setDefault(ALWAYS_CCPM, false);
 	setDefault(LAST_SHARED_FOLDER, Util::emptyString);
+	setDefault(SHARING_SKIPLIST_EXTENSIONS, Util::emptyString);
+	setDefault(SHARING_SKIPLIST_REGEX, Util::emptyString);
+	setDefault(SHARING_SKIPLIST_PATHS, Util::emptyString);
+	setDefault(SHARING_SKIPLIST_MINSIZE, 0);
+	setDefault(SHARING_SKIPLIST_MAXSIZE, 0);
 
 	setSearchTypeDefaults();
 

=== modified file 'dcpp/SettingsManager.h'
--- dcpp/SettingsManager.h	2013-08-19 20:13:24 +0000
+++ dcpp/SettingsManager.h	2013-11-01 18:38:32 +0000
@@ -86,6 +86,7 @@
 		TLS_PRIVATE_KEY_FILE, TLS_CERTIFICATE_FILE, TLS_TRUSTED_CERTIFICATES_PATH,
 		LANGUAGE, TOOLBAR, LAST_SEARCH_TYPE, MAPPER,
 		SOUND_MAIN_CHAT, SOUND_PM, SOUND_PM_WINDOW, SOUND_FINISHED_DL, SOUND_FINISHED_FL, LAST_SHARED_FOLDER,
+		SHARING_SKIPLIST_EXTENSIONS, SHARING_SKIPLIST_REGEX, SHARING_SKIPLIST_PATHS,
 		STR_LAST };
 
 	enum IntSetting { INT_FIRST = STR_LAST + 1,
@@ -118,7 +119,7 @@
 		MAX_FILELIST_SIZE, MAX_HASH_SPEED, MAX_MESSAGE_LINES, MAX_PM_WINDOWS, MIN_MESSAGE_LINES,
 		MIN_UPLOAD_SPEED, PM_LAST_LOG_LINES, SEARCH_HISTORY, SET_MINISLOT_SIZE,
 		SETTINGS_SAVE_INTERVAL, SLOTS, TAB_STYLE, TAB_WIDTH, TOOLBAR_SIZE,
-		AUTO_SEARCH_INTERVAL,
+		AUTO_SEARCH_INTERVAL, 
 
 		INT_LAST };
 
@@ -150,6 +151,7 @@
 
 	enum Int64Setting { INT64_FIRST = BOOL_LAST + 1,
 		TOTAL_UPLOAD = INT64_FIRST, TOTAL_DOWNLOAD,
+		SHARING_SKIPLIST_MINSIZE, SHARING_SKIPLIST_MAXSIZE,
 		INT64_LAST };
 
 	enum FloatSetting { FLOAT_FIRST = INT64_LAST + 1,

=== modified file 'dcpp/ShareManager.cpp'
--- dcpp/ShareManager.cpp	2013-08-02 19:13:38 +0000
+++ dcpp/ShareManager.cpp	2013-11-01 18:38:32 +0000
@@ -589,6 +589,9 @@
 		if(i->isDirectory()) {
 			auto newRealPath = realPath + name + PATH_SEPARATOR;
 
+			if(!checkInvalidPaths(newRealPath))
+				continue;
+
 			// don't share unfinished downloads
 			if(newRealPath == SETTING(TEMP_DOWNLOAD_DIRECTORY)) { continue; }
 
@@ -613,6 +616,12 @@
 
 			auto size = i->getSize();
 			auto fileName = realPath + name;
+			
+			if(!checkInvalidFileName(name))
+				continue;
+
+			if(!checkInvalidFileSize(size))
+				continue;
 
 			// don't share the private key file
 			if(fileName == SETTING(TLS_PRIVATE_KEY_FILE)) { continue; }
@@ -637,6 +646,113 @@
 	return true;
 }
 
+bool ShareManager::checkInvalidFileName(const string& name) const
+{
+	for(auto& f: cachedFilterSkiplistRegEx)
+	{
+		if(checkRegEx(f, name))
+		{
+			return false;
+		}
+	}
+
+	for(auto& f: cachedFilterSkiplistFileExtensions)
+	{
+		if(checkRegEx(f, name))
+		{
+			dcdebug("Filtering away the file '%s' with the pattern matching '%s'\n", name.c_str(), f.pattern.c_str());
+
+			return false;
+		}
+	}
+
+	return true;
+}
+
+bool ShareManager::checkInvalidPaths(const string& name) const
+{
+	for(auto& f: cachedFilterSkiplistPaths)
+	{
+		if(checkRegEx(f, name))
+		{
+			return false;
+		}
+	}
+
+	return true;
+}
+
+bool ShareManager::checkInvalidFileSize(uint64_t size) const
+{
+	uint64_t minimumSize = SETTING(SHARING_SKIPLIST_MINSIZE);
+	if(minimumSize != 0)
+	{
+		if( size < minimumSize )
+		{
+			return false;
+		}
+	}
+
+	uint64_t maximumSize = SETTING(SHARING_SKIPLIST_MAXSIZE);
+	if(maximumSize != 0)
+	{
+		if( size > maximumSize )
+		{
+			return false;
+		}
+	}
+
+	return true;
+}
+
+bool ShareManager::checkRegEx(const StringMatch& matcher, const string& match) const
+{
+	if(match.empty())
+	{
+		return false;
+	}
+	
+	return matcher.match(match);
+}
+
+void ShareManager::updateFilterCache()
+{
+	updateFilterCache(SETTING(SHARING_SKIPLIST_REGEX), cachedFilterSkiplistRegEx);
+	updateFilterCache(SETTING(SHARING_SKIPLIST_EXTENSIONS), "$", true, cachedFilterSkiplistFileExtensions);
+	updateFilterCache(SETTING(SHARING_SKIPLIST_PATHS), cachedFilterSkiplistPaths);
+}
+
+void ShareManager::updateFilterCache(const std::string& strSetting, std::list<StringMatch>& lst)
+{
+	updateFilterCache(strSetting, "", false, lst);
+}
+
+void ShareManager::updateFilterCache(const std::string& strSetting, const std::string& strExtraPattern, bool escapeDot, std::list<StringMatch>& lst)
+{
+	lst.clear();
+
+	auto tokens = StringTokenizer<string>(strSetting, ';').getTokens();
+	for(auto& pattern: tokens)
+	{
+		if(pattern.empty())
+		{
+			continue;
+		}
+
+		if(escapeDot)
+		{
+			Util::replace(".", "\\.", pattern);
+		}
+
+		StringMatch matcher;
+		matcher.pattern = pattern + strExtraPattern;
+		matcher.setMethod(StringMatch::REGEX);
+		matcher.prepare();
+
+		lst.push_back(matcher);
+	}
+}
+
 void ShareManager::updateIndices(Directory& dir) {
 	bloom.add(Text::toLower(dir.getName()));
 
@@ -742,6 +858,9 @@
 
 		float progressCounter = 0, dirCount = dirs.size();
 
+		// Make sure that the cache is updated.
+		updateFilterCache();
+
 		for(auto& i: dirs) {
 			if(checkHidden(i.second)) {
 				auto dp = buildTree(i.second);

=== modified file 'dcpp/ShareManager.h'
--- dcpp/ShareManager.h	2013-07-31 21:49:25 +0000
+++ dcpp/ShareManager.h	2013-11-01 18:38:32 +0000
@@ -41,6 +41,7 @@
 #include "FastAlloc.h"
 #include "MerkleTree.h"
 #include "Pointer.h"
+#include "StringMatch.h"
 
 #include "atomic.h"
 
@@ -124,6 +125,8 @@
 		return tthIndex.find(tth) != tthIndex.end();
 	}
 
+	void updateFilterCache();
+
 	GETSET(uint32_t, hits, Hits);
 	GETSET(string, bzXmlFile, BZXmlFile);
 
@@ -271,10 +274,21 @@
 
 	BloomFilter<5> bloom;
 
+	std::list<StringMatch> cachedFilterSkiplistRegEx;
+	std::list<StringMatch> cachedFilterSkiplistFileExtensions;
+	std::list<StringMatch> cachedFilterSkiplistPaths;
+
 	const Directory::File& findFile(const string& virtualFile) const;
 
 	Directory::Ptr buildTree(const string& realPath, optional<const string&> dirName = nullptr, const Directory::Ptr& parent = nullptr);
 	bool checkHidden(const string& realPath) const;
+	bool checkInvalidFileName(const string& realPath) const;
+	bool checkInvalidPaths(const string& realPath) const;
+	bool checkInvalidFileSize(uint64_t size) const;
+	bool checkRegEx(const StringMatch& matcher, const string& match) const;
+
+	void updateFilterCache(const std::string& strSetting, std::list<StringMatch>& lst);
+	void updateFilterCache(const std::string& strSetting, const std::string& strExtraPattern, bool escapeDot, std::list<StringMatch>& lst);
 
 	void rebuildIndices();
 

=== modified file 'help/DCPlusPlus.hhp'
--- help/DCPlusPlus.hhp	2013-03-21 23:03:56 +0000
+++ help/DCPlusPlus.hhp	2013-11-01 18:38:32 +0000
@@ -62,6 +62,7 @@
 IDH_FAVORITE_DIRSPAGE=settings_favoritedirs.html
 IDH_QUEUEPAGE=settings_queue.html
 IDH_UPLOADPAGE=settings_sharing.html
+IDH_UPLOADFILTERINGPAGE=settings_sharing_filtering.html
 IDH_APPEARANCEPAGE=settings_appearance.html
 IDH_STYLESPAGE=settings_styles.html
 IDH_TABSPAGE=settings_tabs.html

=== modified file 'help/index.html'
--- help/index.html	2013-03-21 23:03:56 +0000
+++ help/index.html	2013-11-01 18:38:32 +0000
@@ -84,6 +84,7 @@
 </ul>
 </li>
 <li><placeholder><a href="settings_sharing.html">Sharing</a></placeholder></li>
+<li><placeholder><a href="settings_sharing_filtering.html">Filtering</a></placeholder></li>
 <li>
 <div><placeholder><a href="settings_appearance.html">Appearance</a></placeholder></div>
 <ul>

=== modified file 'help/resource.h'
--- help/resource.h	2013-03-21 23:03:56 +0000
+++ help/resource.h	2013-11-01 18:38:32 +0000
@@ -65,6 +65,7 @@
 #define IDH_SEARCHTYPESPAGE 10319
 #define IDH_USERMATCHPAGE 10320
 #define IDH_PLUGINPAGE 10321
+#define IDH_UPLOADFILTERINGPAGE 10322
 
 // reserved for cshelp ids
 #define IDH_CSHELP_BEGIN 11000

=== modified file 'help/settings_sharing.html'
--- help/settings_sharing.html	2012-07-12 13:17:54 +0000
+++ help/settings_sharing.html	2013-11-01 18:38:32 +0000
@@ -17,12 +17,6 @@
 <p style="font-weight: bold;">If you enter the Sharing tab and press OK; the client may appear to
 freeze, this is due to a refresh of the file list.</p>
 <dl style="margin-left: 40px;">
-  <dt>Share hidden files</dt>
-  <dd cshelp="IDH_SETTINGS_UPLOAD_SHAREHIDDEN">Share files with the Hidden attribute set and files inside
-directory with the Hidden attribute set. With this option off, files
-starting with a . (full stop) will not be shared. Note: this option requires a
-refresh of the file list, and may cause the client to appear to freeze.<br/>
-</dd>
   <dt>Add folder</dt>
   <dd cshelp="IDH_SETTINGS_UPLOAD_ADD">Browse for a new folder to add to your share. If another
 existing file shares that name, the new name will be made unique by

=== added file 'help/settings_sharing_filtering.html'
--- help/settings_sharing_filtering.html	1970-01-01 00:00:00 +0000
+++ help/settings_sharing_filtering.html	2013-11-01 18:38:32 +0000
@@ -0,0 +1,41 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+  <link type="text/css" rel="stylesheet" href="office11.css"/>
+<link type="text/css" rel="stylesheet" href="style.css"/>
+</head>
+<body>
+<h1>Filtering</h1>
+<dl style="margin-left: 40px;">
+  <dt>Share hidden files</dt>
+  <dd cshelp="IDH_SETTINGS_UPLOAD_SHAREHIDDEN">Share files with the Hidden attribute set and files inside
+directory with the Hidden attribute set. With this option off, files
+starting with a . (full stop) will not be shared. Note: this option requires a
+refresh of the file list, and may cause the client to appear to freeze.<br/>
+    </dd>
+
+    <dt>File minimum size</dt>
+  <dd cshelp="IDH_SETTINGS_UPLOAD_SKIPLIST_MINSIZE"><br/>
+      Only include include files in thee share that has a file size above the specified value. Value is specified in bytes. The value 0 removes the filter and is the default.
+    </dd>
+    <dt>File maximum size</dt>
+  <dd cshelp="IDH_SETTINGS_UPLOAD_SKIPLIST_MAXSIZE"><br/>
+      Only include include files in the share that has a file size below the specified value. Value is specified in bytes. The value 0 removes the filter and is the default.
+    </dd>
+
+    <dt>File name filtering with Regular expressions</dt>
+  <dd cshelp="IDH_SETTINGS_UPLOAD_SKIPLIST_REGEX"><br/>
+      Filters out any file with a name that matches a regular expression that is listed here. Use semicolon to separate multiple regular expressions. For example, the value ^.*\.txt;^.*\.png will remove any file that has the extensions txt or png.
+    </dd>
+
+    <dt>File extension filtering</dt>
+  <dd cshelp="IDH_SETTINGS_UPLOAD_SKIPLIST_EXTENSIONS"><br/>
+      Filters out any file with an extension that is listed here. Use semicolon to separate multiple extensions. For example, the value txt;png will remove any file that has the extensions txt or png.
+    </dd><dt>Path filtering</dt>
+  <dd cshelp="IDH_SETTINGS_UPLOAD_SKIPLIST_PATHS"><br/>
+      Filters out any path that is listed here. Use semicolon to separate multiple paths. For example, the value "download;secret_files" will remove any directory that has download or secret_files in the path.
+    </dd>
+</dl>
+</body>
+</html>

=== added file 'res/UploadFiltering.ico'
Binary files res/UploadFiltering.ico	1970-01-01 00:00:00 +0000 and res/UploadFiltering.ico	2013-11-01 18:38:32 +0000 differ
=== modified file 'win32/DCPlusPlus.rc'
--- win32/DCPlusPlus.rc	2013-09-22 14:15:28 +0000
+++ win32/DCPlusPlus.rc	2013-11-01 18:38:32 +0000
@@ -50,6 +50,7 @@
 IDI_WHATS_THIS          ICON                    "res/WhatsThis.ico"
 IDI_DOWNLOAD            ICON                    "res/Download.ico"
 IDI_UPLOAD              ICON                    "res/Upload.ico"
+IDI_UPLOAD_FILTERING    ICON                    "res/UploadFiltering.ico"
 IDI_CHANGELOG           ICON                    "res/Changelog.ico"
 IDI_DONATE              ICON                    "res/Donate.ico"
 IDI_GET_STARTED         ICON                    "res/GetStarted.ico"

=== added file 'win32/ItemsEditDlg.cpp'
--- win32/ItemsEditDlg.cpp	1970-01-01 00:00:00 +0000
+++ win32/ItemsEditDlg.cpp	2013-11-01 18:38:32 +0000
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2001-2013 Jacek Sieka, arnetheduck on gmail point com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "stdafx.h"
+#include "ItemsEditDlg.h"
+
+#include <dcpp/FavoriteManager.h>
+#include <dcpp/StringTokenizer.h>
+#include <dcpp/format.h>
+#include <dcpp/version.h>
+
+#include <dwt/widgets/MessageBox.h>
+
+#include "resource.h"
+#include "ParamDlg.h"
+
+ItemsEditDlg::ItemsEditDlg(dwt::Widget* parent, const tstring& name_, const TStringList& lst) :
+StringListDlg(parent, lst),
+name(name_)
+{
+}
+
+tstring ItemsEditDlg::getTitle() const {
+	return _title;
+}
+
+tstring ItemsEditDlg::getEditTitle() const {
+	return _edittitle;
+}
+
+tstring ItemsEditDlg::getEditDescription() const {
+	return _description;
+}
+
+void ItemsEditDlg::setTitle(const tstring& newTitle)
+{
+	_title = newTitle;
+}
+
+void ItemsEditDlg::setEditTitle(const tstring& title)
+{
+	_edittitle = title;
+}
+
+void ItemsEditDlg::setDescription(const tstring& desc)
+{
+	_description = desc;
+}
+
+void ItemsEditDlg::add(const tstring& s) {
+	StringTokenizer<tstring> t(s, ';');
+	for(auto& i: t.getTokens()) {
+		if(!i.empty()) {
+			insert(i);
+		}
+	}
+}
+
+void ItemsEditDlg::edit(unsigned row, const tstring& s) {
+	ParamDlg dlg(this, getEditTitle(), getEditDescription(), s);
+	if(dlg.run() == IDOK) {
+		bool modified = false;
+		StringTokenizer<tstring> t(dlg.getValue(), ';');
+		for(auto& i: t.getTokens()) {
+			if(!i.empty()) {
+				if(!modified) {
+					modify(row, i);
+					modified = true;
+				} else {
+					insert(i, ++row);
+				}
+			}
+		}
+	}
+}

=== added file 'win32/ItemsEditDlg.h'
--- win32/ItemsEditDlg.h	1970-01-01 00:00:00 +0000
+++ win32/ItemsEditDlg.h	2013-11-01 18:38:32 +0000
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2001-2013 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.
+ */
+
+#ifndef DCPLUSPLUS_WIN32_ITEMS_EDIT_DLG_H
+#define DCPLUSPLUS_WIN32_ITEMS_EDIT_DLG_H
+
+#include "StringListDlg.h"
+
+class ItemsEditDlg : public StringListDlg
+{
+public:
+	ItemsEditDlg(dwt::Widget* parent, const tstring& name_, const TStringList& extList);
+
+	void setTitle(const tstring& title);
+	void setEditTitle(const tstring& title);
+	void setDescription(const tstring& description);
+
+private:
+	tstring getTitle() const;
+	tstring getEditTitle() const;
+	tstring getEditDescription() const;
+
+	void add(const tstring& s);
+	void edit(unsigned row, const tstring& s);
+
+	const tstring name;
+	tstring _title;
+	tstring _edittitle;
+	tstring _description;
+};
+
+#endif // !defined(DCPLUSPLUS_WIN32_ITEMS_EDIT_DLG_H)

=== modified file 'win32/PropPage.cpp'
--- win32/PropPage.cpp	2013-01-18 21:28:38 +0000
+++ win32/PropPage.cpp	2013-11-01 18:38:32 +0000
@@ -82,6 +82,20 @@
 				static_cast<TextBoxPtr>(i.widget)->setText(Text::toT(Util::toString(settings->get(setting))));
 				break;
 			}
+		case T_INT64:
+			{
+				auto setting = static_cast<SettingsManager::Int64Setting>(i.setting);
+				if(!settings->isDefault(setting)) {
+					static_cast<TextBoxPtr>(i.widget)->setText(Text::toT(Util::toString(settings->get(setting))));
+				}
+				break;
+			}
+		case T_INT64_WITH_SPIN:
+			{
+				auto setting = static_cast<SettingsManager::Int64Setting>(i.setting);
+				static_cast<TextBoxPtr>(i.widget)->setText(Text::toT(Util::toString(settings->get(setting))));
+				break;
+			}
 		case T_BOOL:
 			{
 				auto setting = static_cast<SettingsManager::BoolSetting>(i.setting);
@@ -128,6 +142,13 @@
 				settings->set(setting, Text::fromT(static_cast<TextBoxPtr>(i.widget)->getText()));
 				break;
 			}
+		case T_INT64:
+		case T_INT64_WITH_SPIN:
+			{
+				auto setting = static_cast<SettingsManager::Int64Setting>(i.setting);
+				settings->set(setting, Text::fromT(static_cast<TextBoxPtr>(i.widget)->getText()));
+				break;
+			}
 		case T_BOOL:
 			{
 				auto setting = static_cast<SettingsManager::BoolSetting>(i.setting);

=== modified file 'win32/PropPage.h'
--- win32/PropPage.h	2013-01-18 21:28:38 +0000
+++ win32/PropPage.h	2013-11-01 18:38:32 +0000
@@ -40,6 +40,8 @@
 		T_STR,
 		T_INT,
 		T_INT_WITH_SPIN, // fill even when the current value is the same as the default value (for controls with a spin buddy)
+		T_INT64,
+		T_INT64_WITH_SPIN, // fill even when the current value is the same as the default value (for controls with a spin buddy)
 		T_BOOL
 	};
 

=== modified file 'win32/SettingsDialog.cpp'
--- win32/SettingsDialog.cpp	2013-05-13 18:22:52 +0000
+++ win32/SettingsDialog.cpp	2013-11-01 18:38:32 +0000
@@ -43,6 +43,7 @@
 #include "QueuePage.h"
 
 #include "UploadPage.h"
+#include "UploadFilteringPage.h"
 
 #include "AppearancePage.h"
 #include "StylesPage.h"
@@ -168,7 +169,10 @@
 			addPage(T_("Queue"), new QueuePage(container), IDI_QUEUE, item);
 		}
 
-		addPage(T_("Sharing"), new UploadPage(container), IDI_UPLOAD, TVI_ROOT);
+		{
+			HTREEITEM item = addPage(T_("Sharing"), new UploadPage(container), IDI_UPLOAD, TVI_ROOT);
+			addPage(T_("Filtering"), new UploadFilteringPage(container), IDI_UPLOAD_FILTERING, item);
+		}
 
 		{
 			HTREEITEM item = addPage(T_("Appearance"), new AppearancePage(container), IDI_DCPP, TVI_ROOT);

=== added file 'win32/UploadFilteringPage.cpp'
--- win32/UploadFilteringPage.cpp	1970-01-01 00:00:00 +0000
+++ win32/UploadFilteringPage.cpp	2013-11-01 18:38:32 +0000
@@ -0,0 +1,221 @@
+/*
+ * Copyright (C) 2001-2013 Jacek Sieka, arnetheduck on gmail point com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "stdafx.h"
+
+#include "resource.h"
+
+#include "UploadFilteringPage.h"
+
+#include <dwt/widgets/FolderDialog.h>
+#include <dwt/widgets/Grid.h>
+#include <dwt/widgets/Label.h>
+#include <dwt/widgets/MessageBox.h>
+#include <dwt/widgets/Spinner.h>
+
+#include <dcpp/format.h>
+#include <dcpp/SettingsManager.h>
+#include <dcpp/ShareManager.h>
+#include <dcpp/version.h>
+#include "ParamDlg.h"
+#include "HashProgressDlg.h"
+#include "WinUtil.h"
+#include "ItemsEditDlg.h"
+
+using dwt::FolderDialog;
+using dwt::Grid;
+using dwt::GridInfo;
+using dwt::Label;
+using dwt::Spinner;
+
+UploadFilteringPage::UploadFilteringPage(dwt::Widget* parent) :
+PropPage(parent, 6, 1),
+minSizeControl(0),
+maxSizeControl(0),
+modifyRegExButton(0),
+modifyExtensionsButton(0),
+modifyPathsButton(0)
+{
+	//setHelpId(IDH_UPLOADFILTERINGPAGE);
+
+	grid->column(0).mode = GridInfo::FILL;
+
+	{
+		auto optionsGroup = grid->addChild(GroupBox::Seed(T_("Options")));
+
+		// dummy grid so that the check-box doesn't fill the whole row.
+		shareHiddenCheckBox = optionsGroup->addChild(Grid::Seed(1, 1))->addChild(CheckBox::Seed(T_("Share hidden files")));
+		items.emplace_back(shareHiddenCheckBox, SettingsManager::SHARE_HIDDEN, PropPage::T_BOOL);
+		shareHiddenCheckBox->setHelpId(IDH_SETTINGS_UPLOAD_SHAREHIDDEN);
+	}
+
+	{
+		auto fileSizeGroup = grid->addChild(GroupBox::Seed(T_("Only share files whose file size is above/below")));
+
+		auto fileSizeGrid = fileSizeGroup->addChild(Grid::Seed(1, 2));
+		fileSizeGrid->column(0).mode = GridInfo::FILL;
+		fileSizeGrid->column(1).mode = GridInfo::FILL;
+
+		{
+			dwt::Control* ctrl;
+			addItem(fileSizeGrid, ctrl, T_("Above (minimum size)"), SettingsManager::SHARING_SKIPLIST_MINSIZE, PropPage::T_INT64, IDH_SETTINGS_UPLOAD_SKIPLIST_MINSIZE, T_("B"));
+			minSizeControl = dynamic_cast<TextBoxPtr>(ctrl);
+		}
+		{
+			dwt::Control* ctrl;
+			addItem(fileSizeGrid, ctrl, T_("Below (maximum size)"), SettingsManager::SHARING_SKIPLIST_MAXSIZE, PropPage::T_INT64, IDH_SETTINGS_UPLOAD_SKIPLIST_MAXSIZE, T_("B"));
+			maxSizeControl = dynamic_cast<TextBoxPtr>(ctrl);
+		}
+	}
+
+	{
+		auto regexGroup = grid->addChild(GroupBox::Seed(T_("File name filtering with regular expressions")));
+
+		auto regexGrid = regexGroup->addChild(Grid::Seed(2, 2));
+		regexGrid->column(0).mode = GridInfo::FILL;
+
+		regexTextBox = regexGrid->addChild(WinUtil::Seeds::Dialog::textBox);
+		items.emplace_back(regexTextBox, SettingsManager::SHARING_SKIPLIST_REGEX, PropPage::T_STR);
+		regexTextBox->setHelpId(IDH_SETTINGS_UPLOAD_SKIPLIST_REGEX);
+
+		modifyRegExButton = regexGrid->addChild(Button::Seed(T_("M&odify")));
+		modifyRegExButton->onClicked([this] { handleModButtonClicked(T_("Regular expressions"), regexTextBox); });
+
+		regexGrid->addChild(Label::Seed(T_("Use semicolon to separate multiple regular expressions.")));
+	}
+
+	{
+		auto extensionsGroup = grid->addChild(GroupBox::Seed(T_("File extension filtering")));
+
+		auto extensionsGrid = extensionsGroup->addChild(Grid::Seed(2, 2));
+		extensionsGrid->column(0).mode = GridInfo::FILL;
+
+		extensionsTextBox = extensionsGrid->addChild(WinUtil::Seeds::Dialog::textBox);
+		items.emplace_back(extensionsTextBox, SettingsManager::SHARING_SKIPLIST_EXTENSIONS, PropPage::T_STR);
+		extensionsTextBox->setHelpId(IDH_SETTINGS_UPLOAD_SKIPLIST_EXTENSIONS);
+
+		modifyExtensionsButton = extensionsGrid->addChild(Button::Seed(T_("M&odify")));
+		modifyExtensionsButton->onClicked([this] { handleModButtonClicked(T_("File extensions"), extensionsTextBox); });
+
+		extensionsGrid->addChild(Label::Seed(T_("Use semicolon to separate multiple extensions.")));
+	}
+
+	{
+		auto pathsGroup = grid->addChild(GroupBox::Seed(T_("Path filtering")));
+
+		auto pathsGrid = pathsGroup->addChild(Grid::Seed(2, 2));
+		pathsGrid->column(0).mode = GridInfo::FILL;
+
+		pathsTextBox = pathsGrid->addChild(WinUtil::Seeds::Dialog::textBox);
+		items.emplace_back(pathsTextBox, SettingsManager::SHARING_SKIPLIST_PATHS, PropPage::T_STR);
+		pathsTextBox->setHelpId(IDH_SETTINGS_UPLOAD_SKIPLIST_PATHS);
+
+		modifyPathsButton = pathsGrid->addChild(Button::Seed(T_("M&odify")));
+		modifyPathsButton->onClicked([this] { handleModButtonClicked(T_("Paths"), pathsTextBox); });
+
+		pathsGrid->addChild(Label::Seed(T_("Use semicolon to separate multiple paths.")));
+	}
+
+	PropPage::read(items);
+}
+
+UploadFilteringPage::~UploadFilteringPage() {
+}
+
+void UploadFilteringPage::layout() {
+	PropPage::layout();
+}
+
+void UploadFilteringPage::write()
+{
+	if(isModified())
+	{
+		PropPage::write(items);
+
+		ShareManager::getInstance()->updateFilterCache();
+
+		ShareManager::getInstance()->setDirty();
+		ShareManager::getInstance()->refresh(true, false, true);
+	}
+}
+
+void UploadFilteringPage::addItem(dwt::Grid* parent, dwt::Control*& control, const tstring& text, int setting, PropPage::Type t, unsigned helpId, const tstring& text2) {
+	auto group = parent->addChild(GroupBox::Seed(text));
+	group->setHelpId(helpId);
+
+	auto cur = group->addChild(Grid::Seed(1, 2));
+	if(!text.empty() && !text2.empty())
+	{
+		cur->column(0).mode = GridInfo::FILL;
+	}
+
+	if((t == PropPage::T_INT) || (t == PropPage::T_INT64))
+	{
+		control = cur->addChild(WinUtil::Seeds::Dialog::intTextBox);
+	}
+	else if(t == PropPage::T_STR)
+	{
+		control = cur->addChild(WinUtil::Seeds::Dialog::textBox);
+	}
+	else if(t == PropPage::T_BOOL)
+	{
+		control = cur->addChild(WinUtil::Seeds::Dialog::checkBox);
+	}
+
+	items.emplace_back(control, setting, t);
+
+	if(text2.empty())
+		cur->setWidget(control, 0, 0, 1, 2);
+	else
+		cur->addChild(Label::Seed(text2));
+}
+
+void UploadFilteringPage::handleModButtonClicked(const tstring& strName, TextBoxPtr textBox )
+{
+	handleModButtonClicked(strName, strName, strName, strName, textBox);
+}
+
+void UploadFilteringPage::handleModButtonClicked(const tstring& strDialogName, const tstring& strTitle, const tstring& strDescription, const tstring& strEditTitle, TextBoxPtr textBox )
+{
+	TStringList lst = StringTokenizer<tstring>(textBox->getText(), ';').getTokens();
+
+	ItemsEditDlg dlg(this, strDialogName, lst);
+	dlg.setTitle(strTitle);
+	dlg.setDescription(strDescription);
+	dlg.setEditTitle(strEditTitle);
+
+	if(dlg.run() == IDOK)
+	{
+		StringList lstValue;
+		Text::fromT(dlg.getValues(), lstValue);
+
+		textBox->setText(Text::toT(Util::toString(";", lstValue)));
+	}
+}
+
+bool UploadFilteringPage::isModified()
+{
+	bool isModified = 
+		(shareHiddenCheckBox->getChecked() != SETTING(SHARE_HIDDEN)) ||
+		(Util::toInt64(Text::fromT(minSizeControl->getText())) != SETTING(SHARING_SKIPLIST_MINSIZE)) ||
+		(Util::toInt64(Text::fromT(maxSizeControl->getText())) != SETTING(SHARING_SKIPLIST_MAXSIZE)) ||
+		(Text::fromT(regexTextBox->getText()) != SETTING(SHARING_SKIPLIST_REGEX)) ||
+		(Text::fromT(extensionsTextBox->getText()) != SETTING(SHARING_SKIPLIST_EXTENSIONS)) ||
+		(Text::fromT(pathsTextBox->getText()) != SETTING(SHARING_SKIPLIST_PATHS));
+	return isModified;
+}

=== added file 'win32/UploadFilteringPage.h'
--- win32/UploadFilteringPage.h	1970-01-01 00:00:00 +0000
+++ win32/UploadFilteringPage.h	2013-11-01 18:38:32 +0000
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2001-2013 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.
+ */
+
+#ifndef DCPLUSPLUS_WIN32_UPLOAD_FILTERING_PAGE_H
+#define DCPLUSPLUS_WIN32_UPLOAD_FILTERING_PAGE_H
+
+#include <dcpp/typedefs.h>
+
+#include "PropPage.h"
+
+class UploadFilteringPage : public PropPage
+{
+public:
+	UploadFilteringPage(dwt::Widget* parent);
+	virtual ~UploadFilteringPage();
+
+	virtual void layout();
+	virtual void write();
+
+private:
+	
+	ItemList items;
+
+	CheckBoxPtr shareHiddenCheckBox;
+
+	TextBoxPtr minSizeControl;
+	TextBoxPtr maxSizeControl;
+
+	TextBoxPtr regexTextBox;
+	TextBoxPtr extensionsTextBox;
+	TextBoxPtr pathsTextBox;
+
+	ButtonPtr modifyRegExButton;
+	ButtonPtr modifyExtensionsButton;
+	ButtonPtr modifyPathsButton;
+
+	void addItem(dwt::Grid* parent, dwt::Control*& control, const tstring& text, int setting, PropPage::Type t, unsigned helpId, const tstring& text2 = _T(""));
+
+	void handleModButtonClicked(const tstring& strName, TextBoxPtr textBox );
+	void handleModButtonClicked(const tstring& strDialogName, const tstring& strTitle, const tstring& strDescription, const tstring& strEditTitle, TextBoxPtr textBox );
+
+	bool isModified();
+
+	void handleShareHiddenClicked(CheckBoxPtr checkBox, int setting);
+
+};
+
+#endif // !defined(DCPLUSPLUS_WIN32_UPLOAD_FILTERING_PAGE_H)

=== modified file 'win32/UploadPage.cpp'
--- win32/UploadPage.cpp	2013-01-18 21:28:38 +0000
+++ win32/UploadPage.cpp	2013-11-01 18:38:32 +0000
@@ -93,12 +93,6 @@
 
 		cur->addChild(Label::Seed(T_("Note; Files appear in the share only after they've been hashed!")));
 
-		// dummy grid so that the check-box doesn't fill the whole row.
-		CheckBoxPtr shareHidden = cur->addChild(Grid::Seed(1, 1))->addChild(CheckBox::Seed(T_("Share hidden files")));
-		items.emplace_back(shareHidden, SettingsManager::SHARE_HIDDEN, PropPage::T_BOOL);
-
-		shareHidden->onClicked([=] { handleShareHiddenClicked(shareHidden, SettingsManager::SHARE_HIDDEN); });
-		shareHidden->setHelpId(IDH_SETTINGS_UPLOAD_SHAREHIDDEN);
 	}
 
 	{

=== modified file 'win32/resource.h'
--- win32/resource.h	2013-07-19 16:24:10 +0000
+++ win32/resource.h	2013-11-01 18:38:32 +0000
@@ -82,6 +82,7 @@
 #define IDI_DLIMIT 176
 #define IDI_OPEN_OWN_FILE_LIST 177
 #define IDI_PLUGINS 178
+#define IDI_UPLOAD_FILTERING 179
 
 // Stuff that uses multiple id's