snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 74aef6994a9ae6655706ac65514e117cf8073f72
parent 1c8878c3dac3bba7ed2d758a1dc7b012f5c6a355
Author: default <nobody@localhost>
Date:   Mon, 26 Sep 2022 09:08:03 +0200

Link to local if the child id is from this actor.

Diffstat:
Mactivitypub.c | 10+++++-----
Mdata.c | 2+-
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/activitypub.c b/activitypub.c @@ -71,7 +71,7 @@ int actor_request(snac *snac, char *actor, d_char **data) } -void timeline_request(snac *snac, char *id) +void timeline_request(snac *snac, char *id, char *referrer) /* ensures that an entry and its ancestors are in the timeline */ { if (!xs_is_null(id)) { @@ -88,10 +88,10 @@ void timeline_request(snac *snac, char *id) char *in_reply_to = xs_dict_get(object, "inReplyTo"); /* recurse! */ - timeline_request(snac, in_reply_to); + timeline_request(snac, in_reply_to, referrer); /* finally store */ - timeline_add(snac, id, object, in_reply_to, NULL); + timeline_add(snac, id, object, in_reply_to, referrer); } } } @@ -280,7 +280,7 @@ void process_message(snac *snac, char *msg, char *req) char *id = xs_dict_get(object, "id"); char *in_reply_to = xs_dict_get(object, "inReplyTo"); - timeline_request(snac, in_reply_to); + timeline_request(snac, in_reply_to, NULL); if (timeline_add(snac, id, msg, in_reply_to, NULL)) snac_log(snac, xs_fmt("new 'Note' %s %s", actor, id)); @@ -307,7 +307,7 @@ void process_message(snac *snac, char *msg, char *req) if (xs_type(object) == XSTYPE_DICT) object = xs_dict_get(object, "id"); - timeline_request(snac, object); + timeline_request(snac, object, actor); timeline_admire(snac, object, actor, 0); snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object)); diff --git a/data.c b/data.c @@ -469,7 +469,7 @@ void _timeline_write(snac *snac, char *id, char *msg, char *parent, char *referr /* try to do the same with the local */ xs *olfn = xs_replace(pfn, "/timeline/", "/local/"); - if (unlink(olfn) != -1) { + if (unlink(olfn) != -1 || xs_startswith(id, snac->actor)) { xs *nlfn = xs_replace(nfn, "/timeline/", "/local/"); link(nfn, nlfn);