Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- === modified file 'SConstruct'
- --- SConstruct 2011-07-08 04:40:25 +0000
- +++ SConstruct 2012-10-19 18:41:36 +0000
- @@ -290,6 +290,7 @@
- env.Append(LIBPATH = env['build_path'] + CORE_PACKAGE)
- env.Prepend(LIBS = 'dcpp')
- + env.Append(LIBS = 'boost_regex')
- if os.sys.platform == 'linux2':
- env.Append(LINKFLAGS = '-Wl,--as-needed')
- === modified file 'dcpp/ShareManager.cpp'
- --- dcpp/ShareManager.cpp 2009-12-27 22:03:53 +0000
- +++ dcpp/ShareManager.cpp 2012-10-19 18:42:39 +0000
- @@ -48,6 +48,8 @@
- #endif
- #include <limits>
- +#include <fstream>
- +#include <string>
- namespace dcpp {
- @@ -59,6 +61,29 @@
- TimerManager::getInstance()->addListener(this);
- DownloadManager::getInstance()->addListener(this);
- HashManager::getInstance()->addListener(this);
- +
- + try {
- + std::string cfg = Util::getPath(Util::PATH_USER_CONFIG) + "/skiplist";
- + std::ifstream regexes(cfg.c_str());
- +
- + while(!regexes.eof() && !regexes.fail()) {
- + std::string expression;
- + std::getline(regexes, expression);
- + dcdebug("Evaluating %s\n", expression.c_str());
- +
- + try {
- + boost::regex re(expression);
- + skiplist.push_back(re);
- + } catch(boost::bad_expression) {
- + dcdebug("Expression %s not used for skiplist\n", expression.c_str());
- + }
- + }
- +
- + }
- + catch(...) {
- + dcdebug("Skiplist not built");
- + }
- +
- }
- ShareManager::~ShareManager() {
- @@ -746,8 +771,23 @@
- dir->directories[name] = buildTree(newName, dir);
- }
- } else {
- + bool skip = false;
- + for (std::vector<boost::regex>::const_iterator regi = skiplist.begin(); regi != skiplist.end(); ++regi) {
- + boost::smatch result;
- + if (boost::regex_match(name, result, *regi)) {
- + dcdebug("Skipping %s due to skiplist\n", name.c_str());
- + skip = true;
- + break;
- + }
- + if (boost::regex_match(aName + name, result, *regi)) {
- + dcdebug("Skipping %s due to skiplist\n", std::string(aName + name).c_str());
- + skip = true;
- + break;
- + }
- +
- + }
- // Not a directory, assume it's a file...make sure we're not sharing the settings file...
- - if( (Util::stricmp(name.c_str(), "DCPlusPlus.xml") != 0) &&
- + if( !skip && (Util::stricmp(name.c_str(), "DCPlusPlus.xml") != 0) &&
- (Util::stricmp(name.c_str(), "Favorites.xml") != 0)) {
- int64_t size = i->getSize();
- === modified file 'dcpp/ShareManager.h'
- --- dcpp/ShareManager.h 2009-12-27 22:03:53 +0000
- +++ dcpp/ShareManager.h 2012-10-19 18:10:55 +0000
- @@ -34,6 +34,8 @@
- #include "MerkleTree.h"
- #include "Pointer.h"
- +#include <boost/regex.hpp>
- +
- namespace dcpp {
- STANDARD_EXCEPTION(ShareException);
- @@ -256,6 +258,8 @@
- mutable CriticalSection cs;
- + std::vector<boost::regex> skiplist;
- +
- // List of root directory items
- typedef std::list<Directory::Ptr> DirList;
- DirList directories;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement