Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1.  
  2. === modified file 'SConstruct'
  3. --- SConstruct 2011-07-08 04:40:25 +0000
  4. +++ SConstruct 2012-10-19 18:41:36 +0000
  5. @@ -290,6 +290,7 @@
  6.  
  7. env.Append(LIBPATH = env['build_path'] + CORE_PACKAGE)
  8. env.Prepend(LIBS = 'dcpp')
  9. + env.Append(LIBS = 'boost_regex')
  10.  
  11. if os.sys.platform == 'linux2':
  12. env.Append(LINKFLAGS = '-Wl,--as-needed')
  13.  
  14. === modified file 'dcpp/ShareManager.cpp'
  15. --- dcpp/ShareManager.cpp 2009-12-27 22:03:53 +0000
  16. +++ dcpp/ShareManager.cpp 2012-10-19 18:42:39 +0000
  17. @@ -48,6 +48,8 @@
  18. #endif
  19.  
  20. #include <limits>
  21. +#include <fstream>
  22. +#include <string>
  23.  
  24. namespace dcpp {
  25.  
  26. @@ -59,6 +61,29 @@
  27. TimerManager::getInstance()->addListener(this);
  28. DownloadManager::getInstance()->addListener(this);
  29. HashManager::getInstance()->addListener(this);
  30. +
  31. + try {
  32. + std::string cfg = Util::getPath(Util::PATH_USER_CONFIG) + "/skiplist";
  33. + std::ifstream regexes(cfg.c_str());
  34. +
  35. + while(!regexes.eof() && !regexes.fail()) {
  36. + std::string expression;
  37. + std::getline(regexes, expression);
  38. + dcdebug("Evaluating %s\n", expression.c_str());
  39. +
  40. + try {
  41. + boost::regex re(expression);
  42. + skiplist.push_back(re);
  43. + } catch(boost::bad_expression) {
  44. + dcdebug("Expression %s not used for skiplist\n", expression.c_str());
  45. + }
  46. + }
  47. +
  48. + }
  49. + catch(...) {
  50. + dcdebug("Skiplist not built");
  51. + }
  52. +
  53. }
  54.  
  55. ShareManager::~ShareManager() {
  56. @@ -746,8 +771,23 @@
  57. dir->directories[name] = buildTree(newName, dir);
  58. }
  59. } else {
  60. + bool skip = false;
  61. + for (std::vector<boost::regex>::const_iterator regi = skiplist.begin(); regi != skiplist.end(); ++regi) {
  62. + boost::smatch result;
  63. + if (boost::regex_match(name, result, *regi)) {
  64. + dcdebug("Skipping %s due to skiplist\n", name.c_str());
  65. + skip = true;
  66. + break;
  67. + }
  68. + if (boost::regex_match(aName + name, result, *regi)) {
  69. + dcdebug("Skipping %s due to skiplist\n", std::string(aName + name).c_str());
  70. + skip = true;
  71. + break;
  72. + }
  73. +
  74. + }
  75. // Not a directory, assume it's a file...make sure we're not sharing the settings file...
  76. - if( (Util::stricmp(name.c_str(), "DCPlusPlus.xml") != 0) &&
  77. + if( !skip && (Util::stricmp(name.c_str(), "DCPlusPlus.xml") != 0) &&
  78. (Util::stricmp(name.c_str(), "Favorites.xml") != 0)) {
  79.  
  80. int64_t size = i->getSize();
  81.  
  82. === modified file 'dcpp/ShareManager.h'
  83. --- dcpp/ShareManager.h 2009-12-27 22:03:53 +0000
  84. +++ dcpp/ShareManager.h 2012-10-19 18:10:55 +0000
  85. @@ -34,6 +34,8 @@
  86. #include "MerkleTree.h"
  87. #include "Pointer.h"
  88.  
  89. +#include <boost/regex.hpp>
  90. +
  91. namespace dcpp {
  92.  
  93. STANDARD_EXCEPTION(ShareException);
  94. @@ -256,6 +258,8 @@
  95.  
  96. mutable CriticalSection cs;
  97.  
  98. + std::vector<boost::regex> skiplist;
  99. +
  100. // List of root directory items
  101. typedef std::list<Directory::Ptr> DirList;
  102. DirList directories;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement