diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-27 14:17:50 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-27 14:17:50 +0300 |
commit | 79bfdef91b4745517f9a51ea82d203b50776a0b3 (patch) | |
tree | 2b7e69317d1cbaa0bc9dffa90ca9f2e78216a15f | |
parent | b924ad8d8180306f18434882ab922f8c54da4f98 (diff) |
Feeds: Disregard old entries
The history of visited URLs has a maximum age limit, and this is
used for unread status.
-rw-r--r-- | src/feeds.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/feeds.c b/src/feeds.c index dcd97b43..6b102fef 100644 --- a/src/feeds.c +++ b/src/feeds.c | |||
@@ -300,8 +300,16 @@ static iBool isHeadingEntry_FeedEntry_(const iFeedEntry *d) { | |||
300 | static iBool updateEntries_Feeds_(iFeeds *d, iPtrArray *incoming) { | 300 | static iBool updateEntries_Feeds_(iFeeds *d, iPtrArray *incoming) { |
301 | iBool gotNew = iFalse; | 301 | iBool gotNew = iFalse; |
302 | lock_Mutex(d->mtx); | 302 | lock_Mutex(d->mtx); |
303 | iTime now; | ||
304 | initCurrent_Time(&now); | ||
303 | iForEach(PtrArray, i, incoming) { | 305 | iForEach(PtrArray, i, incoming) { |
304 | iFeedEntry *entry = i.ptr; | 306 | iFeedEntry *entry = i.ptr; |
307 | /* Disregard old entries. */ | ||
308 | if (secondsSince_Time(&now, &entry->posted) >= maxAge_Visited) { | ||
309 | /* We don't remember this far back, so the unread status of the entry would | ||
310 | be incorrect. */ | ||
311 | continue; | ||
312 | } | ||
305 | size_t pos; | 313 | size_t pos; |
306 | if (locate_SortedArray(&d->entries, &entry, &pos)) { | 314 | if (locate_SortedArray(&d->entries, &entry, &pos)) { |
307 | iFeedEntry *existing = *(iFeedEntry **) at_SortedArray(&d->entries, pos); | 315 | iFeedEntry *existing = *(iFeedEntry **) at_SortedArray(&d->entries, pos); |