From 7cf1d844b05a275a51472fc93de3ce33aa750f0b Mon Sep 17 00:00:00 2001 From: Thomas Piccirello Date: Mon, 15 May 2017 14:30:44 -0400 Subject: [PATCH] Return status indicating if at least one torrent was successfully added --- src/webui/webapplication.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index bcaad2081..5d2b28c96 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -400,13 +400,19 @@ void WebApplication::action_command_download() params.savePath = savepath; params.category = category; + bool partialSuccess = false; foreach (QString url, list) { url = url.trimmed(); if (!url.isEmpty()) { Net::DownloadManager::instance()->setCookiesFromUrl(cookies, QUrl::fromEncoded(url.toUtf8())); - BitTorrent::Session::instance()->addTorrent(url, params); + partialSuccess |= BitTorrent::Session::instance()->addTorrent(url, params); } } + + if (partialSuccess) + print(QByteArray("Ok."), Http::CONTENT_TYPE_TXT); + else + print(QByteArray("Fails."), Http::CONTENT_TYPE_TXT); } void WebApplication::action_command_upload()