mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
Keep track of which RSS entries have been seen
This is done by remembering the time of the latest entry. All entries newer than that are considered new and will be posted. Closes #485
This commit is contained in:
@@ -10,6 +10,7 @@ import static org.briarproject.api.feed.FeedConstants.KEY_BLOG_GROUP_ID;
|
||||
import static org.briarproject.api.feed.FeedConstants.KEY_FEED_ADDED;
|
||||
import static org.briarproject.api.feed.FeedConstants.KEY_FEED_AUTHOR;
|
||||
import static org.briarproject.api.feed.FeedConstants.KEY_FEED_DESC;
|
||||
import static org.briarproject.api.feed.FeedConstants.KEY_FEED_LAST_ENTRY;
|
||||
import static org.briarproject.api.feed.FeedConstants.KEY_FEED_TITLE;
|
||||
import static org.briarproject.api.feed.FeedConstants.KEY_FEED_UPDATED;
|
||||
import static org.briarproject.api.feed.FeedConstants.KEY_FEED_URL;
|
||||
@@ -19,11 +20,11 @@ public class Feed {
|
||||
final private String url;
|
||||
final private GroupId blogId;
|
||||
final private String title, description, author;
|
||||
final private long added, updated;
|
||||
final private long added, updated, lastEntryTime;
|
||||
|
||||
public Feed(String url, GroupId blogId, @Nullable String title,
|
||||
@Nullable String description, @Nullable String author,
|
||||
long added, long updated) {
|
||||
long added, long updated, long lastEntryTime) {
|
||||
|
||||
this.url = url;
|
||||
this.blogId = blogId;
|
||||
@@ -32,6 +33,14 @@ public class Feed {
|
||||
this.author = author;
|
||||
this.added = added;
|
||||
this.updated = updated;
|
||||
this.lastEntryTime = lastEntryTime;
|
||||
}
|
||||
|
||||
public Feed(String url, GroupId blogId, @Nullable String title,
|
||||
@Nullable String description, @Nullable String author,
|
||||
long added) {
|
||||
|
||||
this(url, blogId, title, description, author, added, 0L, 0L);
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
@@ -47,7 +56,8 @@ public class Feed {
|
||||
new BdfEntry(KEY_FEED_URL, url),
|
||||
new BdfEntry(KEY_BLOG_GROUP_ID, blogId.getBytes()),
|
||||
new BdfEntry(KEY_FEED_ADDED, added),
|
||||
new BdfEntry(KEY_FEED_UPDATED, updated)
|
||||
new BdfEntry(KEY_FEED_UPDATED, updated),
|
||||
new BdfEntry(KEY_FEED_LAST_ENTRY, lastEntryTime)
|
||||
);
|
||||
if (title != null) d.put(KEY_FEED_TITLE, title);
|
||||
if (description != null) d.put(KEY_FEED_DESC, description);
|
||||
@@ -63,7 +73,9 @@ public class Feed {
|
||||
String author = d.getOptionalString(KEY_FEED_AUTHOR);
|
||||
long added = d.getLong(KEY_FEED_ADDED, 0L);
|
||||
long updated = d.getLong(KEY_FEED_UPDATED, 0L);
|
||||
return new Feed(url, blogId, title, desc, author, added, updated);
|
||||
long lastEntryTime = d.getLong(KEY_FEED_LAST_ENTRY, 0L);
|
||||
return new Feed(url, blogId, title, desc, author, added, updated,
|
||||
lastEntryTime);
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
@@ -86,4 +98,8 @@ public class Feed {
|
||||
return updated;
|
||||
}
|
||||
|
||||
public long getLastEntryTime() {
|
||||
return lastEntryTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,5 +17,6 @@ public interface FeedConstants {
|
||||
String KEY_FEED_AUTHOR = "feedAuthor";
|
||||
String KEY_FEED_ADDED = "feedAdded";
|
||||
String KEY_FEED_UPDATED = "feedUpdated";
|
||||
String KEY_FEED_LAST_ENTRY = "feedLastEntryTime";
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user