Skip to content

Commit

Permalink
Merge commit '2b8989433b36f94b6ae784993ba9f83c78058f2a' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
maksis committed Jan 30, 2016
2 parents 46384ff + 2b89894 commit 379fd4f
Show file tree
Hide file tree
Showing 22 changed files with 83 additions and 28 deletions.
4 changes: 2 additions & 2 deletions airdcpp-core/airdcpp/AdcHub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void AdcHub::handle(AdcCommand::MSG, AdcCommand& c) noexcept {
if(c.getParameters().empty())
return;

auto message = make_shared<ChatMessage>(c.getParam(0), findUser(c.getFrom()));
auto message = std::make_shared<ChatMessage>(c.getParam(0), findUser(c.getFrom()));
if(!message->getFrom())
return;

Expand Down Expand Up @@ -643,7 +643,7 @@ void AdcHub::handle(AdcCommand::STA, AdcCommand& c) noexcept {
}
}

auto message = make_shared<ChatMessage>(c.getParam(1), u);
auto message = std::make_shared<ChatMessage>(c.getParam(1), u);
onChatMessage(message);
}
}
Expand Down
2 changes: 1 addition & 1 deletion airdcpp-core/airdcpp/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<LogMessage>(aMessage, aSeverity);
auto message = std::make_shared<LogMessage>(aMessage, aSeverity);

if (aFlag != ClientListener::FLAG_IS_SPAM) {
cache.addMessage(message);
Expand Down
4 changes: 2 additions & 2 deletions airdcpp-core/airdcpp/ClientManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ ClientManager::~ClientManager() {

ClientPtr ClientManager::createClient(const string& aHubURL, const ClientPtr& aOldClient) noexcept {
if (AirUtil::isAdcHub(aHubURL)) {
return make_shared<AdcHub>(aHubURL, aOldClient);
return std::make_shared<AdcHub>(aHubURL, aOldClient);
}

return make_shared<NmdcHub>(aHubURL, aOldClient);
return std::make_shared<NmdcHub>(aHubURL, aOldClient);
}

ClientPtr ClientManager::createClient(const RecentHubEntryPtr& aEntry, ProfileToken aProfile) noexcept {
Expand Down
5 changes: 2 additions & 3 deletions airdcpp-core/airdcpp/ConnectionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
}
Expand Down
2 changes: 2 additions & 0 deletions airdcpp-core/airdcpp/ConnectionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ class ConnectionManager : public Speaker<ConnectionManagerListener>, 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];
}
Expand Down
4 changes: 2 additions & 2 deletions airdcpp-core/airdcpp/ConnectionManagerListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ 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;

virtual void on(Added, const ConnectionQueueItem*) noexcept { }
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 { }
};
Expand Down
18 changes: 18 additions & 0 deletions airdcpp-core/airdcpp/Download.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions airdcpp-core/airdcpp/Download.h
Original file line number Diff line number Diff line change
Expand Up @@ -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&);
Expand Down
2 changes: 1 addition & 1 deletion airdcpp-core/airdcpp/LogManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<LogMessage>(msg, severity);
auto messageData = std::make_shared<LogMessage>(msg, severity);
if (severity != LogMessage::SEV_NOTIFY) {
if (SETTING(LOG_SYSTEM)) {
ParamMap params;
Expand Down
2 changes: 1 addition & 1 deletion airdcpp-core/airdcpp/MessageManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ PrivateChatPtr MessageManager::addChat(const HintedUser& user, bool aReceivedMes

{
WLock l(cs);
chat = make_shared<PrivateChat>(user, getPMConn(user.user));
chat = std::make_shared<PrivateChat>(user, getPMConn(user.user));
chats.emplace(user.user, chat);
}

Expand Down
6 changes: 3 additions & 3 deletions airdcpp-core/airdcpp/NmdcHub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ void NmdcHub::onLine(const string& aLine) noexcept {
text = text.substr(4);
}

auto chatMessage = make_shared<ChatMessage>(text, findUser(nick));
auto chatMessage = std::make_shared<ChatMessage>(text, findUser(nick));
chatMessage->setThirdPerson(thirdPerson);

if(!chatMessage->getFrom()) {
Expand Down Expand Up @@ -868,7 +868,7 @@ void NmdcHub::onLine(const string& aLine) noexcept {
text = text.substr(4);
}

auto message = make_shared<ChatMessage>(text, findUser(fromNick), &getUser(getMyNick()), findUser(rtNick));
auto message = std::make_shared<ChatMessage>(text, findUser(fromNick), &getUser(getMyNick()), findUser(rtNick));
message->setThirdPerson(thirdPerson);

if(!message->getReplyTo() || !message->getFrom()) {
Expand Down Expand Up @@ -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<ChatMessage>(aMessage, ou, aUser, ou);
auto message = std::make_shared<ChatMessage>(aMessage, ou, aUser, ou);
MessageManager::getInstance()->onPrivateMessage(message);
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion airdcpp-core/airdcpp/PrivateChat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ int PrivateChat::clearCache() noexcept {
}

void PrivateChat::statusMessage(const string& aMessage, LogMessage::Severity aSeverity) noexcept {
auto message = make_shared<LogMessage>(aMessage, aSeverity);
auto message = std::make_shared<LogMessage>(aMessage, aSeverity);

fire(PrivateChatListener::StatusMessage(), this, message);
cache.addMessage(message);
Expand Down
4 changes: 3 additions & 1 deletion airdcpp-core/airdcpp/SettingsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion airdcpp-core/airdcpp/SettingsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class SettingsManager : public Singleton<SettingsManager>, public Speaker<Settin
POPUP_FONT, POPUP_TITLE_FONT, POPUPFILE, SKIPLIST_DOWNLOAD, HIGH_PRIO_FILES,
MEDIATOOLBAR, PASSWORD, DOWNLOAD_SPEED, HIGHLIGHT_LIST, ICON_PATH,
AUTOSEARCHFRAME_ORDER, AUTOSEARCHFRAME_WIDTHS, TOOLBAR_POS, TB_PROGRESS_FONT, LAST_SEARCH_FILETYPE, LAST_SEARCH_DISABLED_HUBS, LAST_AS_FILETYPE, LAST_SEARCH_EXCLUDED,
USERS_FRAME_VISIBLE, LIST_VIEW_FONT, LOG_SHARE_SCAN_PATH, LAST_FL_FILETYPE, NMDC_ENCODING, AS_FAILED_DEFAULT_GROUP,
USERS_FRAME_VISIBLE, LIST_VIEW_FONT, LOG_SHARE_SCAN_PATH, LAST_FL_FILETYPE, NMDC_ENCODING, AS_FAILED_DEFAULT_GROUP, AUTOSEARCHFRAME_VISIBLE,
STR_LAST };

enum IntSetting { INT_FIRST = STR_LAST + 1,
Expand Down
12 changes: 6 additions & 6 deletions airdcpp-core/airdcpp/ShareManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ void ShareManager::startup(function<void(const string&)> splashF, function<void(
AirUtil::updateCachedSettings();
if (!getShareProfile(SETTING(DEFAULT_SP))) {
if (shareProfiles.empty()) {
auto sp = make_shared<ShareProfile>(STRING(DEFAULT), SETTING(DEFAULT_SP));
auto sp = std::make_shared<ShareProfile>(STRING(DEFAULT), SETTING(DEFAULT_SP));
shareProfiles.push_back(sp);
} else {
SettingsManager::getInstance()->set(SettingsManager::DEFAULT_SP, shareProfiles.front()->getToken());
}
}

ShareProfilePtr hidden = make_shared<ShareProfile>(STRING(SHARE_HIDDEN), SP_HIDDEN);
ShareProfilePtr hidden = std::make_shared<ShareProfile>(STRING(SHARE_HIDDEN), SP_HIDDEN);
shareProfiles.push_back(hidden);

setSkipList();
Expand Down Expand Up @@ -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<ShareProfile>(aName, aToken);
auto sp = std::make_shared<ShareProfile>(aName, aToken);
shareProfiles.push_back(sp);

aXml.stepIn();
Expand Down Expand Up @@ -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<ShareProfile>(sp->name, sp->token));
addProfile(std::make_shared<ShareProfile>(sp->name, sp->token));
}
}

Expand Down Expand Up @@ -2772,7 +2772,7 @@ void ShareManager::restoreFailedMonitoredPaths() {
ShareDirectoryInfoPtr ShareManager::getRootInfo(const Directory::Ptr& aDir) const noexcept {
auto& pd = aDir->getProfileDir();

auto info = make_shared<ShareDirectoryInfo>(aDir->getRealPath());
auto info = std::make_shared<ShareDirectoryInfo>(aDir->getRealPath());
info->profiles = pd->getRootProfiles();
info->incoming = pd->getIncoming();
info->size = aDir->getSize();
Expand Down Expand Up @@ -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<ShareProfileInfo>(sp->getPlainName(), sp->getToken());
auto p = std::make_shared<ShareProfileInfo>(sp->getPlainName(), sp->getToken());
if (p->token == SETTING(DEFAULT_SP)) {
p->isDefault = true;
ret.emplace(ret.begin(), p);
Expand Down
1 change: 0 additions & 1 deletion airdcpp-core/airdcpp/TrackableDownloadItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ namespace dcpp {
timeFinished = GET_TIME();
}

dcassert(completedDownloads);
bool empty = false;
{
WLock l(cs);
Expand Down
14 changes: 14 additions & 0 deletions airdcpp-core/airdcpp/Transfer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion airdcpp-core/airdcpp/Transfer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint64_t, int64_t> Sample;
typedef deque<Sample> SampleList;

Expand Down
16 changes: 16 additions & 0 deletions airdcpp-core/airdcpp/Upload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions airdcpp-core/airdcpp/Upload.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<InputStream> stream;
};
Expand Down
2 changes: 1 addition & 1 deletion airdcpp-core/airdcpp/UserConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ void UserConnection::handlePM(const AdcCommand& c, bool echo) noexcept{

string tmp;

auto msg = make_shared<ChatMessage>(message, peer, me, peer);
auto msg = std::make_shared<ChatMessage>(message, peer, me, peer);
if (c.getParam("TS", 1, tmp)) {
msg->setTime(Util::toInt64(tmp));
}
Expand Down
2 changes: 1 addition & 1 deletion airdcpp-core/airdcpp/ViewFileManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace dcpp {
}

ViewFilePtr ViewFileManager::createFile(const string& aFileName, const TTHValue& aTTH, bool aIsText, bool aIsLocalFile) noexcept {
auto file = make_shared<ViewFile>(aFileName, aTTH, aIsText, aIsLocalFile,
auto file = std::make_shared<ViewFile>(aFileName, aTTH, aIsText, aIsLocalFile,
std::bind(&ViewFileManager::onFileStateUpdated, this, std::placeholders::_1));

{
Expand Down

0 comments on commit 379fd4f

Please sign in to comment.