diff options
| author | 2025-01-28 10:04:23 +0100 | |
|---|---|---|
| committer | 2025-01-28 10:04:23 +0100 | |
| commit | 06ba1174ca7084a3d691aa8c2b552b708d04b8db (patch) | |
| tree | ff6339aef8e543f3aec34a0b259f34c581ee0262 /data.c | |
| parent | Added some default styling to CSS class snac-no-more-unseen-posts. (diff) | |
| download | penes-snac2-06ba1174ca7084a3d691aa8c2b552b708d04b8db.tar.gz penes-snac2-06ba1174ca7084a3d691aa8c2b552b708d04b8db.tar.xz penes-snac2-06ba1174ca7084a3d691aa8c2b552b708d04b8db.zip | |
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) | |||
| 1532 | /* adds an "already seen" mark to the private timeline */ | 1532 | /* adds an "already seen" mark to the private timeline */ |
| 1533 | { | 1533 | { |
| 1534 | xs *fn = xs_fmt("%s/private.idx", user->basedir); | 1534 | xs *fn = xs_fmt("%s/private.idx", user->basedir); |
| 1535 | index_add_md5(fn, MD5_ALREADY_SEEN_MARK); | 1535 | char last_entry[MD5_HEX_SIZE] = ""; |
| 1536 | FILE *f; | ||
| 1537 | |||
| 1538 | /* get the last entry in the index */ | ||
| 1539 | if ((f = fopen(fn, "r")) != NULL) { | ||
| 1540 | index_desc_first(f, last_entry, 0); | ||
| 1541 | fclose(f); | ||
| 1542 | } | ||
| 1543 | |||
| 1544 | /* is the last entry *not* a mark? */ | ||
| 1545 | if (strcmp(last_entry, MD5_ALREADY_SEEN_MARK) != 0) { | ||
| 1546 | /* add it */ | ||
| 1547 | index_add_md5(fn, MD5_ALREADY_SEEN_MARK); | ||
| 1548 | |||
| 1549 | /* mark as new */ | ||
| 1550 | timeline_touch(user); | ||
| 1551 | } | ||
| 1536 | } | 1552 | } |
| 1537 | 1553 | ||
| 1538 | 1554 | ||