From 6e91a108bd327b21adfc4d0d6ac4fc17efed09b8 Mon Sep 17 00:00:00 2001 From: Gabriele Date: Fri, 3 Apr 2015 17:51:26 +0200 Subject: [PATCH] WebUI: Check if torrent queueing is enabled before changing torrent priorities --- src/webui/webapplication.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index 50e833f06..1cf9aaf37 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -573,6 +573,12 @@ void WebApplication::action_command_increasePrio() { CHECK_URI(0); CHECK_PARAMETERS("hashes"); + + if (!Preferences::instance()->isQueueingSystemEnabled()) { + status(403, "Torrent queueing must be enabled"); + return; + } + QStringList hashes = request().posts["hashes"].split("|"); std::priority_queue, @@ -606,6 +612,12 @@ void WebApplication::action_command_decreasePrio() { CHECK_URI(0); CHECK_PARAMETERS("hashes"); + + if (!Preferences::instance()->isQueueingSystemEnabled()) { + status(403, "Torrent queueing must be enabled"); + return; + } + QStringList hashes = request().posts["hashes"].split("|"); std::priority_queue, @@ -640,6 +652,12 @@ void WebApplication::action_command_topPrio() { CHECK_URI(0); CHECK_PARAMETERS("hashes"); + + if (!Preferences::instance()->isQueueingSystemEnabled()) { + status(403, "Torrent queueing must be enabled"); + return; + } + foreach (const QString &hash, request().posts["hashes"].split("|")) { QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash); if (h.is_valid()) h.queue_position_top(); @@ -650,6 +668,12 @@ void WebApplication::action_command_bottomPrio() { CHECK_URI(0); CHECK_PARAMETERS("hashes"); + + if (!Preferences::instance()->isQueueingSystemEnabled()) { + status(403, "Torrent queueing must be enabled"); + return; + } + foreach (const QString &hash, request().posts["hashes"].split("|")) { QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash); if (h.is_valid()) h.queue_position_bottom();