diff options
| author | default <nobody@localhost> | 2025-01-28 10:04:23 +0100 |
|---|---|---|
| committer | default <nobody@localhost> | 2025-01-28 10:04:23 +0100 |
| commit | 06ba1174ca7084a3d691aa8c2b552b708d04b8db (patch) | |
| tree | ff6339aef8e543f3aec34a0b259f34c581ee0262 /data.c | |
| parent | bf07718f02081c88b48ea18c0bd38e49e971d398 (diff) | |
Some tweaks to the already seen mark code.
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -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); + } } |