Skip to content

Commit

Permalink
Squashed 'airdcpp-webapi/' changes from 304979f..4804276
Browse files Browse the repository at this point in the history
4804276 API: refactor view tasks, most likely fixes #65
365f37f API: serialize encryption information for relevant entities, don't display CCPM connections in transfers, serialize connect state flags for OnlineUsers
225424c API: add transfer permission, show better initial status for transfers
2036ecc API: add transfer view
c2e46af Merge branch 'master' of https://github.com/airdcpp/airgit
6f8a29a Hopefully fix crash stopping the web server
fad4816 Compiling fixes for Boost 1.60

git-subtree-dir: airdcpp-webapi
git-subtree-split: 4804276e4a36813cf46e5f82e4b70b81aff0e146
  • Loading branch information
maksis committed Jan 30, 2016
1 parent 98c5487 commit fed67d2
Show file tree
Hide file tree
Showing 26 changed files with 834 additions and 156 deletions.
2 changes: 1 addition & 1 deletion 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 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 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 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", aClient->getEncryptionInfo() },
};
}

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

void PrivateChatApi::addChat(const PrivateChatPtr& aChat) noexcept {
addSubModule(aChat->getUser()->getCID(), make_shared<PrivateChatInfo>(this, aChat));
addSubModule(aChat->getUser()->getCID(), std::make_shared<PrivateChatInfo>(this, aChat));
}

void PrivateChatApi::on(MessageManagerListener::ChatCreated, const PrivateChatPtr& aChat, bool aReceivedMessage) noexcept {
Expand Down
3 changes: 2 additions & 1 deletion api/PrivateChatInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ namespace webserver {
return{
{ "id", formatCCPMState(aChat->getCCPMState()) },
{ "str", PrivateChat::ccpmStateToString(aChat->getCCPMState()) },
{ "supported", aChat->getSupportsCCPM() }
{ "supported", aChat->getSupportsCCPM() },
{ "encryption", aChat->getUc() ? aChat->getUc()->getEncryptionInfo() : Util::emptyString },
};
}

Expand Down
35 changes: 0 additions & 35 deletions api/QueueUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,41 +74,6 @@ namespace webserver {
}
}

/*json QueueUtils::serializeQueueItem(const QueueItemPtr& aQI) noexcept {
json j;
return{
{ "user", aQI-> },
{ "file_count", aSource.files },
{ "bytes_left", aSource.size }
};
return j;
}
json QueueUtils::serializeQueueItemBase(const QueueItemBase& aItem) noexcept {
return{
{ "target", aItem.getTarget() },
{ "size", aItem.getSize() },
{ "time_added", aItem.getTimeAdded() },
{ "priority", aItem.getPriority() },
{ "using_autopriority", aItem.getAutoPriority() }
};
}*/

/*json QueueUtils::serializeBundleSource(const Bundle::BundleSource& aSource) noexcept {
return{
{ "user", serializeUser(aSource.getUser()) },
{ "file_count", aSource.files },
{ "bytes_left", aSource.size }
};
}
json QueueUtils::serializeQueueItemSource(const QueueItem::Source& aSource) noexcept {
return{
{ "user", serializeUser(aSource.getUser()) }
};
}*/

json QueueUtils::serializePriority(const QueueItemBase& aItem) noexcept {
return{
{ "id", aItem.getPriority() },
Expand Down
2 changes: 1 addition & 1 deletion api/SearchApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ namespace webserver {
}

SearchResultInfoPtr parent = nullptr;
auto result = make_shared<SearchResultInfo>(aResult, move(*relevancyInfo));
auto result = std::make_shared<SearchResultInfo>(aResult, move(*relevancyInfo));

{
WLock l(cs);
Expand Down
2 changes: 1 addition & 1 deletion api/ShareProfileApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ namespace webserver {
api_return ShareProfileApi::handleAddProfile(ApiRequest& aRequest) {
const auto& reqJson = aRequest.getRequestBody();

auto profile = make_shared<ShareProfile>();
auto profile = std::make_shared<ShareProfile>();
parseProfile(profile, reqJson);

ShareManager::getInstance()->addProfile(profile);
Expand Down
2 changes: 1 addition & 1 deletion api/ShareRootApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace webserver {
JsonUtil::throwError("path", JsonUtil::ERROR_INVALID, e.what());
}

auto info = make_shared<ShareDirectoryInfo>(path);
auto info = std::make_shared<ShareDirectoryInfo>(path);

parseRoot(info, reqJson, true);

Expand Down
Loading

0 comments on commit fed67d2

Please sign in to comment.