From 1da31bc2e1cb6a7ef4dad70fce77feaa32a18c20 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Fri, 28 Mar 2025 09:01:22 +0300 Subject: [PATCH] RSS: Mark matched article as "read" if refers to duplicate torrent PR #22477. --- src/base/rss/rss_autodownloader.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/base/rss/rss_autodownloader.cpp b/src/base/rss/rss_autodownloader.cpp index 864c777e6..c40218457 100644 --- a/src/base/rss/rss_autodownloader.cpp +++ b/src/base/rss/rss_autodownloader.cpp @@ -375,10 +375,24 @@ void AutoDownloader::handleTorrentAdded(const QString &source) } } -void AutoDownloader::handleAddTorrentFailed(const QString &source, [[maybe_unused]] const BitTorrent::AddTorrentError &error) +void AutoDownloader::handleAddTorrentFailed(const QString &source, const BitTorrent::AddTorrentError &error) { - m_waitingJobs.remove(source); - // TODO: Re-schedule job here. + const auto job = m_waitingJobs.take(source); + if (!job) + return; + + if (error.kind == BitTorrent::AddTorrentError::DuplicateTorrent) + { + if (Feed *feed = Session::instance()->feedByURL(job->feedURL)) + { + if (Article *article = feed->articleByGUID(job->articleData.value(Article::KeyId).toString())) + article->markAsRead(); + } + } + else + { + // TODO: Re-schedule job here. + } } void AutoDownloader::handleNewArticle(const Article *article)