Skip to content

Commit

Permalink
Merge commit 'b1dd8cbf7189b702ec35fb08694e7b4844a3194b'
Browse files Browse the repository at this point in the history
  • Loading branch information
maksis committed Jan 19, 2016
2 parents 26ec300 + b1dd8cb commit fde5e39
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 21 deletions.
2 changes: 1 addition & 1 deletion airdcpp-webapi/api/HubInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ namespace webserver {
});
}

void HubInfo::onUserUpdated(const OnlineUserPtr& aUser, PropertyIdSet aUpdatedProperties) noexcept {
void HubInfo::onUserUpdated(const OnlineUserPtr& aUser, const PropertyIdSet& aUpdatedProperties) noexcept {
if (!aUser->isHidden()) {
view.onItemUpdated(aUser, aUpdatedProperties);
}
Expand Down
2 changes: 1 addition & 1 deletion airdcpp-webapi/api/HubInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace webserver {

OnlineUserList getUsers() noexcept;
void onUserUpdated(const OnlineUserPtr& ou) noexcept;
void onUserUpdated(const OnlineUserPtr& ou, PropertyIdSet aUpdatedProperties) noexcept;
void onUserUpdated(const OnlineUserPtr& ou, const PropertyIdSet& aUpdatedProperties) noexcept;
void onFlagsUpdated(const UserPtr& aUser) noexcept;

json previousCounts;
Expand Down
10 changes: 2 additions & 8 deletions airdcpp-webapi/api/QueueApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,19 +272,13 @@ namespace webserver {
QueueManager::getInstance()->setBundlePriority(b, Deserializer::deserializePriority(reqJson, false));
}

// Target
//auto target = reqJson.find("target");
//if (target != reqJson.end()) {
// QueueManager::getInstance()->moveBundle(b, *target, true);
//}

return websocketpp::http::status_code::ok;
}



// TEMP ITEMS
api_return QueueApi::handleAddTempItem(ApiRequest& aRequest) {
/*api_return QueueApi::handleAddTempItem(ApiRequest& aRequest) {
const auto& reqJson = aRequest.getRequestBody();
try {
Expand Down Expand Up @@ -324,7 +318,7 @@ namespace webserver {
}
return websocketpp::http::status_code::ok;
}
}*/


// FILES (COMMON)
Expand Down
4 changes: 2 additions & 2 deletions airdcpp-webapi/api/QueueApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ namespace webserver {

api_return handleGetBundle(ApiRequest& aRequest);

api_return handleAddFilelist(ApiRequest& aRequest);
api_return handleAddTempItem(ApiRequest& aRequest);
//api_return handleAddFilelist(ApiRequest& aRequest);
//api_return handleAddTempItem(ApiRequest& aRequest);
api_return handleAddDirectoryBundle(ApiRequest& aRequest);
api_return handleAddFileBundle(ApiRequest& aRequest);

Expand Down
13 changes: 7 additions & 6 deletions airdcpp-webapi/api/ViewFileApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,24 @@ namespace webserver {
const auto& j = aRequest.getRequestBody();
auto tth = Deserializer::deserializeTTH(j);

if (ViewFileManager::getInstance()->getFile(tth)) {
aRequest.setResponseErrorStr("File with the same TTH is open already");
return websocketpp::http::status_code::bad_request;
}

auto name = JsonUtil::getField<string>("name", j, false);
auto size = JsonUtil::getField<int64_t>("size", j);
auto user = Deserializer::deserializeHintedUser(j);
auto isText = JsonUtil::getOptionalFieldDefault<bool>("text", j, false);

bool added = false;
try {
QueueManager::getInstance()->addOpenedItem(name, size, tth, user, true, isText);
added = ViewFileManager::getInstance()->addFileThrow(name, size, tth, user, isText);
} catch (const Exception& e) {
aRequest.setResponseErrorStr(e.getError());
return websocketpp::http::status_code::internal_server_error;
}

if (!added) {
aRequest.setResponseErrorStr("File with the same TTH is open already");
return websocketpp::http::status_code::bad_request;
}

return websocketpp::http::status_code::ok;
}

Expand Down
4 changes: 2 additions & 2 deletions airdcpp-webapi/api/common/ListViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ namespace webserver {
auto start = GET_TICK();

WLock l(cs);
std::sort(matchingItems.begin(), matchingItems.end(),
std::stable_sort(matchingItems.begin(), matchingItems.end(),
std::bind(&ListViewController::itemSort,
std::placeholders::_1,
std::placeholders::_2,
Expand Down Expand Up @@ -716,7 +716,7 @@ namespace webserver {
WLock l(cs);
allItems.emplace(aItem);
if (matches) {
auto iter = matchingItems.insert(std::lower_bound(
auto iter = matchingItems.insert(std::upper_bound(
matchingItems.begin(),
matchingItems.end(),
aItem,
Expand Down
2 changes: 1 addition & 1 deletion airdcpp-webapi/web-server/WebServerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace webserver {
void setEndpointLogSettings(T& aEndpoint, std::ostream& aStream) {
// Access
aEndpoint.set_access_channels(websocketpp::log::alevel::all);
//aEndpoint.clear_access_channels(websocketpp::log::alevel::frame_payload | websocketpp::log::alevel::message_payload);
aEndpoint.clear_access_channels(websocketpp::log::alevel::frame_payload | websocketpp::log::alevel::frame_header);
aEndpoint.get_alog().set_ostream(&aStream);

// Errors
Expand Down

0 comments on commit fde5e39

Please sign in to comment.