diff --git a/airdcpp-core/airdcpp/AdcHub.cpp b/airdcpp-core/airdcpp/AdcHub.cpp index 90ac6e1f..0eb91aaa 100644 --- a/airdcpp-core/airdcpp/AdcHub.cpp +++ b/airdcpp-core/airdcpp/AdcHub.cpp @@ -345,7 +345,7 @@ void AdcHub::handle(AdcCommand::MSG, AdcCommand& c) noexcept { if(c.getParameters().empty()) return; - auto message = make_shared(c.getParam(0), findUser(c.getFrom())); + auto message = std::make_shared(c.getParam(0), findUser(c.getFrom())); if(!message->getFrom()) return; @@ -643,7 +643,7 @@ void AdcHub::handle(AdcCommand::STA, AdcCommand& c) noexcept { } } - auto message = make_shared(c.getParam(1), u); + auto message = std::make_shared(c.getParam(1), u); onChatMessage(message); } } diff --git a/airdcpp-core/airdcpp/Client.cpp b/airdcpp-core/airdcpp/Client.cpp index 23fb2cdf..1d026d94 100644 --- a/airdcpp-core/airdcpp/Client.cpp +++ b/airdcpp-core/airdcpp/Client.cpp @@ -243,7 +243,7 @@ void Client::setConnectState(State aState) noexcept { } void Client::statusMessage(const string& aMessage, LogMessage::Severity aSeverity, int aFlag) noexcept { - auto message = make_shared(aMessage, aSeverity); + auto message = std::make_shared(aMessage, aSeverity); if (aFlag != ClientListener::FLAG_IS_SPAM) { cache.addMessage(message); diff --git a/airdcpp-core/airdcpp/ClientManager.cpp b/airdcpp-core/airdcpp/ClientManager.cpp index 47667a7d..c2182c0b 100644 --- a/airdcpp-core/airdcpp/ClientManager.cpp +++ b/airdcpp-core/airdcpp/ClientManager.cpp @@ -58,10 +58,10 @@ ClientManager::~ClientManager() { ClientPtr ClientManager::createClient(const string& aHubURL, const ClientPtr& aOldClient) noexcept { if (AirUtil::isAdcHub(aHubURL)) { - return make_shared(aHubURL, aOldClient); + return std::make_shared(aHubURL, aOldClient); } - return make_shared(aHubURL, aOldClient); + return std::make_shared(aHubURL, aOldClient); } ClientPtr ClientManager::createClient(const RecentHubEntryPtr& aEntry, ProfileToken aProfile) noexcept { diff --git a/airdcpp-core/airdcpp/ConnectionManager.cpp b/airdcpp-core/airdcpp/ConnectionManager.cpp index 40079009..048627d6 100644 --- a/airdcpp-core/airdcpp/ConnectionManager.cpp +++ b/airdcpp-core/airdcpp/ConnectionManager.cpp @@ -317,10 +317,9 @@ void ConnectionManager::attemptDownloads(uint64_t aTick, StringList& removedToke cqi->setErrors(protocolError ? -1 : (cqi->getErrors() + 1)); // protocol error dcassert(!lastError.empty()); fire(ConnectionManagerListener::Failed(), cqi, lastError); - } - else { + } else { cqi->setHubUrl(hubHint); - fire(ConnectionManagerListener::StatusChanged(), cqi); + fire(ConnectionManagerListener::Connecting(), cqi); attempts++; } } diff --git a/airdcpp-core/airdcpp/ConnectionManager.h b/airdcpp-core/airdcpp/ConnectionManager.h index b975dc68..e32a4c6e 100644 --- a/airdcpp-core/airdcpp/ConnectionManager.h +++ b/airdcpp-core/airdcpp/ConnectionManager.h @@ -169,6 +169,8 @@ class ConnectionManager : public Speaker, public Clie void failDownload(const string& aToken, const string& aError, bool fatalError); SharedMutex& getCS() { return cs; } + + // Unsafe const ConnectionQueueItem::List& getTransferConnections(bool aDownloads) const { return aDownloads ? cqis[CONNECTION_TYPE_DOWNLOAD] : cqis[CONNECTION_TYPE_UPLOAD]; } diff --git a/airdcpp-core/airdcpp/ConnectionManagerListener.h b/airdcpp-core/airdcpp/ConnectionManagerListener.h index 72a683bf..289cca55 100644 --- a/airdcpp-core/airdcpp/ConnectionManagerListener.h +++ b/airdcpp-core/airdcpp/ConnectionManagerListener.h @@ -32,7 +32,7 @@ class ConnectionManagerListener { typedef X<1> Connected; typedef X<2> Removed; typedef X<3> Failed; - typedef X<4> StatusChanged; + typedef X<4> Connecting; typedef X<5> UserUpdated; typedef X<6> Forced; @@ -40,7 +40,7 @@ class ConnectionManagerListener { virtual void on(Connected, const ConnectionQueueItem*, UserConnection*) noexcept{} virtual void on(Removed, const ConnectionQueueItem*) noexcept { } virtual void on(Failed, const ConnectionQueueItem*, const string&) noexcept { } - virtual void on(StatusChanged, const ConnectionQueueItem*) noexcept { } + virtual void on(Connecting, const ConnectionQueueItem*) noexcept { } virtual void on(UserUpdated, const ConnectionQueueItem*) noexcept { } virtual void on(Forced, const ConnectionQueueItem*) noexcept { } }; diff --git a/airdcpp-core/airdcpp/Download.cpp b/airdcpp-core/airdcpp/Download.cpp index dc13550e..a3a46e73 100644 --- a/airdcpp-core/airdcpp/Download.cpp +++ b/airdcpp-core/airdcpp/Download.cpp @@ -104,6 +104,24 @@ Download::~Download() { getUserConnection().setDownload(0); } +void Download::appendFlags(OrderedStringSet& flags_) const noexcept { + if (isSet(Download::FLAG_PARTIAL)) { + flags_.insert("P"); + } + + if (isSet(Download::FLAG_TTH_CHECK)) { + flags_.insert("T"); + } + if (isSet(Download::FLAG_ZDOWNLOAD)) { + flags_.insert("Z"); + } + if (isSet(Download::FLAG_CHUNKED)) { + flags_.insert("C"); + } + + Transfer::appendFlags(flags_); +} + AdcCommand Download::getCommand(bool zlib, const string& mySID) const noexcept { AdcCommand cmd(AdcCommand::CMD_GET); diff --git a/airdcpp-core/airdcpp/Download.h b/airdcpp-core/airdcpp/Download.h index b1873ecf..6a256664 100644 --- a/airdcpp-core/airdcpp/Download.h +++ b/airdcpp-core/airdcpp/Download.h @@ -100,6 +100,8 @@ class Download : public Transfer, public Flags { return bundle->getStringToken(); } + + void appendFlags(OrderedStringSet& flags_) const noexcept; private: Download(const Download&); Download& operator=(const Download&); diff --git a/airdcpp-core/airdcpp/LogManager.cpp b/airdcpp-core/airdcpp/LogManager.cpp index 960caeb4..abad1004 100644 --- a/airdcpp-core/airdcpp/LogManager.cpp +++ b/airdcpp-core/airdcpp/LogManager.cpp @@ -120,7 +120,7 @@ string LogManager::getPath(const UserPtr& aUser, ParamMap& params, bool addCache } void LogManager::message(const string& msg, LogMessage::Severity severity) { - auto messageData = make_shared(msg, severity); + auto messageData = std::make_shared(msg, severity); if (severity != LogMessage::SEV_NOTIFY) { if (SETTING(LOG_SYSTEM)) { ParamMap params; diff --git a/airdcpp-core/airdcpp/MessageManager.cpp b/airdcpp-core/airdcpp/MessageManager.cpp index f8658797..0d63196f 100644 --- a/airdcpp-core/airdcpp/MessageManager.cpp +++ b/airdcpp-core/airdcpp/MessageManager.cpp @@ -58,7 +58,7 @@ PrivateChatPtr MessageManager::addChat(const HintedUser& user, bool aReceivedMes { WLock l(cs); - chat = make_shared(user, getPMConn(user.user)); + chat = std::make_shared(user, getPMConn(user.user)); chats.emplace(user.user, chat); } diff --git a/airdcpp-core/airdcpp/NmdcHub.cpp b/airdcpp-core/airdcpp/NmdcHub.cpp index 68865fe9..914a015d 100644 --- a/airdcpp-core/airdcpp/NmdcHub.cpp +++ b/airdcpp-core/airdcpp/NmdcHub.cpp @@ -280,7 +280,7 @@ void NmdcHub::onLine(const string& aLine) noexcept { text = text.substr(4); } - auto chatMessage = make_shared(text, findUser(nick)); + auto chatMessage = std::make_shared(text, findUser(nick)); chatMessage->setThirdPerson(thirdPerson); if(!chatMessage->getFrom()) { @@ -868,7 +868,7 @@ void NmdcHub::onLine(const string& aLine) noexcept { text = text.substr(4); } - auto message = make_shared(text, findUser(fromNick), &getUser(getMyNick()), findUser(rtNick)); + auto message = std::make_shared(text, findUser(fromNick), &getUser(getMyNick()), findUser(rtNick)); message->setThirdPerson(thirdPerson); if(!message->getReplyTo() || !message->getFrom()) { @@ -1113,7 +1113,7 @@ bool NmdcHub::privateMessage(const OnlineUserPtr& aUser, const string& aMessage, // Emulate a returning message... OnlineUserPtr ou = findUser(getMyNick()); if(ou) { - auto message = make_shared(aMessage, ou, aUser, ou); + auto message = std::make_shared(aMessage, ou, aUser, ou); MessageManager::getInstance()->onPrivateMessage(message); return true; } diff --git a/airdcpp-core/airdcpp/PrivateChat.cpp b/airdcpp-core/airdcpp/PrivateChat.cpp index 59d9c7a9..5e02bc5f 100644 --- a/airdcpp-core/airdcpp/PrivateChat.cpp +++ b/airdcpp-core/airdcpp/PrivateChat.cpp @@ -142,7 +142,7 @@ int PrivateChat::clearCache() noexcept { } void PrivateChat::statusMessage(const string& aMessage, LogMessage::Severity aSeverity) noexcept { - auto message = make_shared(aMessage, aSeverity); + auto message = std::make_shared(aMessage, aSeverity); fire(PrivateChatListener::StatusMessage(), this, message); cache.addMessage(message); diff --git a/airdcpp-core/airdcpp/SettingsManager.cpp b/airdcpp-core/airdcpp/SettingsManager.cpp index abbcdf7e..7cdc5dc5 100644 --- a/airdcpp-core/airdcpp/SettingsManager.cpp +++ b/airdcpp-core/airdcpp/SettingsManager.cpp @@ -185,7 +185,7 @@ const string SettingsManager::settingTags[] = "PopupFont", "PopupTitleFont", "PopupFile", "SkiplistDownload", "HighPrioFiles", "MediaToolbar", "password", "DownloadSpeed", "HighlightList", "IconPath", "AutoSearchFrame2Order", "AutoSearchFrame2Widths", "ToolbarPos", "TBProgressFont", "LastSearchFiletype", "LastSearchDisabledHubs", "LastASFiletype", "LastSearchExcluded", - "UsersFrmVisible2", "ListViewFont", "LogShareScanPath", "LastFilelistFiletype", "NmdcEncoding", "AsDefaultFailedGroup", + "UsersFrmVisible2", "ListViewFont", "LogShareScanPath", "LastFilelistFiletype", "NmdcEncoding", "AsDefaultFailedGroup", "AutosearchFrmVisible", "SENTRY", // Ints @@ -914,6 +914,8 @@ SettingsManager::SettingsManager() : connectionRegex("(\\d+(\\.\\d+)?)") setDefault(REMOVE_FINISHED_BUNDLES, false); setDefault(LOG_CRC_OK, false); setDefault(ALWAYS_CCPM, false); + setDefault(AUTOSEARCHFRAME_VISIBLE, "1,1,1,1,1,1,1,1,1,1,1"); + // not in GUI setDefault(IGNORE_INDIRECT_SR, false); diff --git a/airdcpp-core/airdcpp/SettingsManager.h b/airdcpp-core/airdcpp/SettingsManager.h index 5fabafdc..a1ae5f33 100644 --- a/airdcpp-core/airdcpp/SettingsManager.h +++ b/airdcpp-core/airdcpp/SettingsManager.h @@ -85,7 +85,7 @@ class SettingsManager : public Singleton, public Speaker splashF, function(STRING(DEFAULT), SETTING(DEFAULT_SP)); + auto sp = std::make_shared(STRING(DEFAULT), SETTING(DEFAULT_SP)); shareProfiles.push_back(sp); } else { SettingsManager::getInstance()->set(SettingsManager::DEFAULT_SP, shareProfiles.front()->getToken()); } } - ShareProfilePtr hidden = make_shared(STRING(SHARE_HIDDEN), SP_HIDDEN); + ShareProfilePtr hidden = std::make_shared(STRING(SHARE_HIDDEN), SP_HIDDEN); shareProfiles.push_back(hidden); setSkipList(); @@ -1205,7 +1205,7 @@ ShareManager::DirMap::const_iterator ShareManager::findRoot(const string& aPath) } void ShareManager::loadProfile(SimpleXML& aXml, const string& aName, ProfileToken aToken) { - auto sp = make_shared(aName, aToken); + auto sp = std::make_shared(aName, aToken); shareProfiles.push_back(sp); aXml.stepIn(); @@ -2179,7 +2179,7 @@ void ShareManager::setDefaultProfile(ProfileToken aNewDefault) noexcept { void ShareManager::addProfiles(const ShareProfileInfo::List& aProfiles) noexcept { for (auto& sp : aProfiles) { - addProfile(make_shared(sp->name, sp->token)); + addProfile(std::make_shared(sp->name, sp->token)); } } @@ -2772,7 +2772,7 @@ void ShareManager::restoreFailedMonitoredPaths() { ShareDirectoryInfoPtr ShareManager::getRootInfo(const Directory::Ptr& aDir) const noexcept { auto& pd = aDir->getProfileDir(); - auto info = make_shared(aDir->getRealPath()); + auto info = std::make_shared(aDir->getRealPath()); info->profiles = pd->getRootProfiles(); info->incoming = pd->getIncoming(); info->size = aDir->getSize(); @@ -3684,7 +3684,7 @@ ShareProfileInfo::List ShareManager::getProfileInfos() const noexcept { ShareProfileInfo::List ret; for (const auto& sp : shareProfiles) { if (sp->getToken() != SP_HIDDEN) { - auto p = make_shared(sp->getPlainName(), sp->getToken()); + auto p = std::make_shared(sp->getPlainName(), sp->getToken()); if (p->token == SETTING(DEFAULT_SP)) { p->isDefault = true; ret.emplace(ret.begin(), p); diff --git a/airdcpp-core/airdcpp/TrackableDownloadItem.cpp b/airdcpp-core/airdcpp/TrackableDownloadItem.cpp index aed473c9..1cc9a9e0 100644 --- a/airdcpp-core/airdcpp/TrackableDownloadItem.cpp +++ b/airdcpp-core/airdcpp/TrackableDownloadItem.cpp @@ -77,7 +77,6 @@ namespace dcpp { timeFinished = GET_TIME(); } - dcassert(completedDownloads); bool empty = false; { WLock l(cs); diff --git a/airdcpp-core/airdcpp/Transfer.cpp b/airdcpp-core/airdcpp/Transfer.cpp index 7c382ea2..50f66a1f 100644 --- a/airdcpp-core/airdcpp/Transfer.cpp +++ b/airdcpp-core/airdcpp/Transfer.cpp @@ -120,6 +120,20 @@ const string& Transfer::getToken() const { return getUserConnection().getToken(); } +void Transfer::appendFlags(OrderedStringSet& flags_) const noexcept { + if (getUserConnection().isSet(UserConnection::FLAG_MCN1)) { + flags_.insert("M"); + } + + if (getUserConnection().isSecure()) { + if (getUserConnection().isSet(UserConnection::FLAG_TRUSTED)) { + flags_.insert("S"); + } else { + flags_.insert("U"); + } + } +} + void Transfer::resetPos() { pos = 0; actual = 0; diff --git a/airdcpp-core/airdcpp/Transfer.h b/airdcpp-core/airdcpp/Transfer.h index 17505af3..b9ebde8e 100644 --- a/airdcpp-core/airdcpp/Transfer.h +++ b/airdcpp-core/airdcpp/Transfer.h @@ -88,8 +88,9 @@ class Transfer : private boost::noncopyable { GETSET(Segment, segment, Segment); GETSET(Type, type, Type); GETSET(uint64_t, start, Start); + + virtual void appendFlags(OrderedStringSet& flags_) const noexcept; private: - typedef std::pair Sample; typedef deque SampleList; diff --git a/airdcpp-core/airdcpp/Upload.cpp b/airdcpp-core/airdcpp/Upload.cpp index ba4d4527..447186fe 100644 --- a/airdcpp-core/airdcpp/Upload.cpp +++ b/airdcpp-core/airdcpp/Upload.cpp @@ -70,5 +70,21 @@ void Upload::resume(int64_t aStart, int64_t aSize) noexcept { } } +void Upload::appendFlags(OrderedStringSet& flags_) const noexcept { + if (isSet(Upload::FLAG_PARTIAL)) { + flags_.insert("P"); + } + + if (isSet(Upload::FLAG_ZUPLOAD)) { + flags_.insert("Z"); + } + + if (isSet(Upload::FLAG_CHUNKED)) { + flags_.insert("C"); + } + + Transfer::appendFlags(flags_); +} + } // namespace dcpp diff --git a/airdcpp-core/airdcpp/Upload.h b/airdcpp-core/airdcpp/Upload.h index 5485d300..9a694561 100644 --- a/airdcpp-core/airdcpp/Upload.h +++ b/airdcpp-core/airdcpp/Upload.h @@ -54,6 +54,8 @@ class Upload : public Transfer, public Flags { InputStream* getStream(); void setFiltered(); void resume(int64_t aStart, int64_t aSize) noexcept; + + void appendFlags(OrderedStringSet& flags_) const noexcept; private: unique_ptr stream; }; diff --git a/airdcpp-core/airdcpp/UserConnection.cpp b/airdcpp-core/airdcpp/UserConnection.cpp index b1235027..bcf70e21 100644 --- a/airdcpp-core/airdcpp/UserConnection.cpp +++ b/airdcpp-core/airdcpp/UserConnection.cpp @@ -269,7 +269,7 @@ void UserConnection::handlePM(const AdcCommand& c, bool echo) noexcept{ string tmp; - auto msg = make_shared(message, peer, me, peer); + auto msg = std::make_shared(message, peer, me, peer); if (c.getParam("TS", 1, tmp)) { msg->setTime(Util::toInt64(tmp)); } diff --git a/airdcpp-core/airdcpp/ViewFileManager.cpp b/airdcpp-core/airdcpp/ViewFileManager.cpp index 86ce54c7..4e4c7955 100644 --- a/airdcpp-core/airdcpp/ViewFileManager.cpp +++ b/airdcpp-core/airdcpp/ViewFileManager.cpp @@ -88,7 +88,7 @@ namespace dcpp { } ViewFilePtr ViewFileManager::createFile(const string& aFileName, const TTHValue& aTTH, bool aIsText, bool aIsLocalFile) noexcept { - auto file = make_shared(aFileName, aTTH, aIsText, aIsLocalFile, + auto file = std::make_shared(aFileName, aTTH, aIsText, aIsLocalFile, std::bind(&ViewFileManager::onFileStateUpdated, this, std::placeholders::_1)); {