aboutsummaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2025-01-28 10:04:23 +0100
committerdefault <nobody@localhost>2025-01-28 10:04:23 +0100
commit06ba1174ca7084a3d691aa8c2b552b708d04b8db (patch)
treeff6339aef8e543f3aec34a0b259f34c581ee0262 /data.c
parentbf07718f02081c88b48ea18c0bd38e49e971d398 (diff)
Some tweaks to the already seen mark code.
Diffstat (limited to 'data.c')
-rw-r--r--data.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/data.c b/data.c
index 480a35b..7139cdf 100644
--- a/data.c
+++ b/data.c
@@ -1532,7 +1532,23 @@ void timeline_add_mark(snac *user)
/* adds an "already seen" mark to the private timeline */
{
xs *fn = xs_fmt("%s/private.idx", user->basedir);
- index_add_md5(fn, MD5_ALREADY_SEEN_MARK);
+ char last_entry[MD5_HEX_SIZE] = "";
+ FILE *f;
+
+ /* get the last entry in the index */
+ if ((f = fopen(fn, "r")) != NULL) {
+ index_desc_first(f, last_entry, 0);
+ fclose(f);
+ }
+
+ /* is the last entry *not* a mark? */
+ if (strcmp(last_entry, MD5_ALREADY_SEEN_MARK) != 0) {
+ /* add it */
+ index_add_md5(fn, MD5_ALREADY_SEEN_MARK);
+
+ /* mark as new */
+ timeline_touch(user);
+ }
}