summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2022-09-26 09:08:03 +0200
committerGravatar default2022-09-26 09:08:03 +0200
commit74aef6994a9ae6655706ac65514e117cf8073f72 (patch)
treee460a068e64300421527cb0d095d3bd8f083a44a
parentAlso store local referrers in the local timeline. (diff)
downloadsnac2-74aef6994a9ae6655706ac65514e117cf8073f72.tar.gz
snac2-74aef6994a9ae6655706ac65514e117cf8073f72.tar.xz
snac2-74aef6994a9ae6655706ac65514e117cf8073f72.zip
Link to local if the child id is from this actor.
-rw-r--r--activitypub.c10
-rw-r--r--data.c2
2 files changed, 6 insertions, 6 deletions
diff --git a/activitypub.c b/activitypub.c
index ca24103..9fa5ba8 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -71,7 +71,7 @@ int actor_request(snac *snac, char *actor, d_char **data)
71} 71}
72 72
73 73
74void timeline_request(snac *snac, char *id) 74void timeline_request(snac *snac, char *id, char *referrer)
75/* ensures that an entry and its ancestors are in the timeline */ 75/* ensures that an entry and its ancestors are in the timeline */
76{ 76{
77 if (!xs_is_null(id)) { 77 if (!xs_is_null(id)) {
@@ -88,10 +88,10 @@ void timeline_request(snac *snac, char *id)
88 char *in_reply_to = xs_dict_get(object, "inReplyTo"); 88 char *in_reply_to = xs_dict_get(object, "inReplyTo");
89 89
90 /* recurse! */ 90 /* recurse! */
91 timeline_request(snac, in_reply_to); 91 timeline_request(snac, in_reply_to, referrer);
92 92
93 /* finally store */ 93 /* finally store */
94 timeline_add(snac, id, object, in_reply_to, NULL); 94 timeline_add(snac, id, object, in_reply_to, referrer);
95 } 95 }
96 } 96 }
97 } 97 }
@@ -280,7 +280,7 @@ void process_message(snac *snac, char *msg, char *req)
280 char *id = xs_dict_get(object, "id"); 280 char *id = xs_dict_get(object, "id");
281 char *in_reply_to = xs_dict_get(object, "inReplyTo"); 281 char *in_reply_to = xs_dict_get(object, "inReplyTo");
282 282
283 timeline_request(snac, in_reply_to); 283 timeline_request(snac, in_reply_to, NULL);
284 284
285 if (timeline_add(snac, id, msg, in_reply_to, NULL)) 285 if (timeline_add(snac, id, msg, in_reply_to, NULL))
286 snac_log(snac, xs_fmt("new 'Note' %s %s", actor, id)); 286 snac_log(snac, xs_fmt("new 'Note' %s %s", actor, id));
@@ -307,7 +307,7 @@ void process_message(snac *snac, char *msg, char *req)
307 if (xs_type(object) == XSTYPE_DICT) 307 if (xs_type(object) == XSTYPE_DICT)
308 object = xs_dict_get(object, "id"); 308 object = xs_dict_get(object, "id");
309 309
310 timeline_request(snac, object); 310 timeline_request(snac, object, actor);
311 311
312 timeline_admire(snac, object, actor, 0); 312 timeline_admire(snac, object, actor, 0);
313 snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object)); 313 snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object));
diff --git a/data.c b/data.c
index 2d8db33..3df09dd 100644
--- a/data.c
+++ b/data.c
@@ -469,7 +469,7 @@ void _timeline_write(snac *snac, char *id, char *msg, char *parent, char *referr
469 /* try to do the same with the local */ 469 /* try to do the same with the local */
470 xs *olfn = xs_replace(pfn, "/timeline/", "/local/"); 470 xs *olfn = xs_replace(pfn, "/timeline/", "/local/");
471 471
472 if (unlink(olfn) != -1) { 472 if (unlink(olfn) != -1 || xs_startswith(id, snac->actor)) {
473 xs *nlfn = xs_replace(nfn, "/timeline/", "/local/"); 473 xs *nlfn = xs_replace(nfn, "/timeline/", "/local/");
474 474
475 link(nfn, nlfn); 475 link(nfn, nlfn);