Skip to content

Commit

Permalink
Merge pull request #66 from airdcpp-web/develop
Browse files Browse the repository at this point in the history
0.15.0
  • Loading branch information
maksis committed Jan 31, 2016
2 parents 2698289 + 46c3e51 commit 89921d0
Show file tree
Hide file tree
Showing 50 changed files with 942 additions and 184 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ sudo make uninstall

Follow the instructions in the [Compile and install](#compile-and-install) section to install the new version.

**IMPORTANT**: if you had the Web UI open in browser during the upgrade, you should close and reopen the tabs to make sure that the latest UI files are fetched by the browser. Otherwise the UI won't function properly.

Note that if you check the version numbers from the About page (Settings -> About), the last numbers in UI and client versions may differ because minor updates can be released separately for both projects. However, the major version numbers (0.**xx**.x) should always match. The latest available Web UI version can be checked from [the NPM package page](https://www.npmjs.com/package/airdcpp-webui).

## Uninstalling

Expand Down
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
2 changes: 1 addition & 1 deletion airdcpp-webapi/api/FilelistApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace webserver {
}

void FilelistApi::addList(const DirectoryListingPtr& aList) noexcept {
addSubModule(aList->getUser()->getCID(), make_shared<FilelistInfo>(this, aList));
addSubModule(aList->getUser()->getCID(), std::make_shared<FilelistInfo>(this, aList));
}

api_return FilelistApi::handleQueueList(ApiRequest& aRequest, QueueItem::Flags aFlags) {
Expand Down
6 changes: 3 additions & 3 deletions airdcpp-webapi/api/FilelistInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ namespace webserver {
return nullptr;
}

auto ret = Serializer::serializeItem(make_shared<FilelistItemInfo>(location.directory), itemHandler);
auto ret = Serializer::serializeItem(std::make_shared<FilelistItemInfo>(location.directory), itemHandler);

ret["size"] = location.totalSize;
ret["complete"] = location.directory->isComplete();
Expand All @@ -145,11 +145,11 @@ namespace webserver {
currentViewItems.clear();

for (auto& d : curDir->directories) {
currentViewItems.emplace_back(make_shared<FilelistItemInfo>(d));
currentViewItems.emplace_back(std::make_shared<FilelistItemInfo>(d));
}

for (auto& f : curDir->files) {
currentViewItems.emplace_back(make_shared<FilelistItemInfo>(f));
currentViewItems.emplace_back(std::make_shared<FilelistItemInfo>(f));
}
}

Expand Down
2 changes: 1 addition & 1 deletion airdcpp-webapi/api/HubApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace webserver {
}

void HubApi::addHub(const ClientPtr& aClient) noexcept {
addSubModule(aClient->getClientId(), make_shared<HubInfo>(this, aClient));
addSubModule(aClient->getClientId(), std::make_shared<HubInfo>(this, aClient));
}

api_return HubApi::handleGetHubs(ApiRequest& aRequest) {
Expand Down
3 changes: 2 additions & 1 deletion airdcpp-webapi/api/HubInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ namespace webserver {
}

return {
{ "id", id }
{ "id", id },
{ "encryption", Serializer::serializeEncryption(aClient->getEncryptionInfo(), aClient->isTrusted()) },
};
}

Expand Down
Loading

0 comments on commit 89921d0

Please sign in to comment.