Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.60 KB | None | 0 0
  1. === modified file 'dcpp/Util.cpp'
  2. --- dcpp/Util.cpp   2011-01-29 14:15:43 +0000
  3. +++ dcpp/Util.cpp   2011-02-11 17:41:50 +0000
  4. @@ -460,7 +460,7 @@
  5.         fileStart = authorityEnd;
  6.     }
  7.  
  8. -   protocol = url.substr(protoStart, protoEnd - protoStart);
  9. +   protocol = protocol = (protoEnd == string::npos ? Util::emptyString : url.substr(protoStart, protoEnd - protoStart));
  10.  
  11.     if(authorityEnd > authorityStart) {
  12.         dcdebug("x");
  13. @@ -499,7 +499,7 @@
  14.                 port = 80;
  15.             } else if(protocol == "https") {
  16.                 port = 443;
  17. -           } else if(protocol == "dchub") {
  18. +           } else if(protocol == "dchub"  || protocol.empty()) {
  19.                 port = 411;
  20.             }
  21.         } else {
  22.  
  23. === modified file 'win32/WinUtil.cpp'
  24. --- win32/WinUtil.cpp   2011-02-01 21:05:24 +0000
  25. +++ win32/WinUtil.cpp   2011-02-11 18:01:38 +0000
  26. @@ -1163,35 +1163,30 @@
  27.  bool WinUtil::parseDBLClick(const tstring& str) {
  28.     auto url = Text::fromT(str);
  29.     string proto, host, file, query, fragment;
  30. -   uint16_t port = 411;
  31. +   uint16_t port;
  32.     Util::decodeUrl(url, proto, host, port, file, query, fragment);
  33.  
  34.     if(Util::stricmp(proto.c_str(), "adc") == 0 ||
  35.         Util::stricmp(proto.c_str(), "adcs") == 0 ||
  36. -       Util::stricmp(proto.c_str(), "dchub") == 0 ||
  37. -       proto.empty())
  38. +       Util::stricmp(proto.c_str(), "dchub") == 0 )
  39.     {
  40. -       if(host == "magnet") {
  41. -           parseMagnetUri(str);
  42. -       } else {
  43. -           if(!host.empty()) {
  44. -               HubFrame::openWindow(mainWindow->getTabView(), url);
  45. +       if(!host.empty()) {
  46. +           HubFrame::openWindow(mainWindow->getTabView(), url);
  47. +       }
  48. +
  49. +       if(!file.empty()) {
  50. +           if(file[0] == '/') {
  51. +               // Remove any '/' in from of the file
  52. +               file = file.substr(1);
  53. +               if(file.empty()) return true;
  54.             }
  55. -
  56. -           if(!file.empty()) {
  57. -               if(file[0] == '/') {
  58. -                   // Remove any '/' in from of the file
  59. -                   file = file.substr(1);
  60. -                   if(file.empty()) return true;
  61. -               }
  62. -               try {
  63. -                   UserPtr user = ClientManager::getInstance()->findLegacyUser(file);
  64. -                   if(user)
  65. -                       QueueManager::getInstance()->addList(HintedUser(user, url), QueueItem::FLAG_CLIENT_VIEW);
  66. -                   // @todo else report error
  67. -               } catch (const Exception&) {
  68. -                   // ...
  69. -               }
  70. +           try {
  71. +               UserPtr user = ClientManager::getInstance()->findLegacyUser(file);
  72. +               if(user)
  73. +                   QueueManager::getInstance()->addList(HintedUser(user, url), QueueItem::FLAG_CLIENT_VIEW);
  74. +               // @todo else report error
  75. +           } catch (const Exception&) {
  76. +               // ...
  77.             }
  78.         }
  79.  
  80. @@ -1201,6 +1196,9 @@
  81.         Util::strnicmp(str.c_str(), _T("mailto:"), 7) == 0) {
  82.         openLink(str);
  83.         return true;
  84. +   } else if(host == "magnet") {
  85. +       parseMagnetUri(str);
  86. +       return true;
  87.     }
  88.  
  89.     return false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement