mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-21 08:09:35 +08:00
Merge pull request #677 from Gelmir/rss_old_redl
Respect article limit during feed updates
This commit is contained in:
commit
d52d64cbaf
@ -125,6 +125,7 @@ void RssFeed::addArticle(const RssArticlePtr& article)
|
||||
// Insertion sort
|
||||
RssArticleList::Iterator lowerBound = qLowerBound(m_articlesByDate.begin(), m_articlesByDate.end(), article, rssArticleDateRecentThan);
|
||||
m_articlesByDate.insert(lowerBound, article);
|
||||
const int lbIndex = m_articlesByDate.indexOf(article);
|
||||
// Restrict size
|
||||
const int max_articles = RssSettings().getRSSMaxArticlesPerFeed();
|
||||
if (m_articlesByDate.size() > max_articles) {
|
||||
@ -134,6 +135,12 @@ void RssFeed::addArticle(const RssArticlePtr& article)
|
||||
if (!oldestArticle->isRead())
|
||||
--m_unreadCount;
|
||||
}
|
||||
|
||||
// Check if article was inserted at the end of the list and will break max_articles limit
|
||||
if (RssSettings().isRssDownloadingEnabled()) {
|
||||
if (lbIndex < max_articles && !article->isRead())
|
||||
downloadArticleTorrentIfMatching(m_manager->downloadRules(), article);
|
||||
}
|
||||
}
|
||||
|
||||
QList<QNetworkCookie> RssFeed::feedCookies() const
|
||||
@ -367,10 +374,6 @@ void RssFeed::handleNewArticle(const QString& feedUrl, const QVariantHash& artic
|
||||
Q_ASSERT(article);
|
||||
addArticle(article);
|
||||
|
||||
// Download torrent if necessary.
|
||||
if (RssSettings().isRssDownloadingEnabled())
|
||||
downloadArticleTorrentIfMatching(m_manager->downloadRules(), article);
|
||||
|
||||
m_manager->forwardFeedInfosChanged(m_url, displayName(), m_unreadCount);
|
||||
// FIXME: We should forward the information here but this would seriously decrease
|
||||
// performance with current design.
|
||||
|
Loading…
Reference in New Issue
Block a user