summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-06-15 04:19:09 +0200
committerGravatar default2023-06-15 04:19:09 +0200
commit297b82c9c627aabd9f17700d2b7958ba728543fb (patch)
tree7fb73ff4819e08d2c3fbeadc0e5c6b6b2a4c3c55
parentMaintain a link to the author object in the following/ subdirectory. (diff)
downloadsnac2-297b82c9c627aabd9f17700d2b7958ba728543fb.tar.gz
snac2-297b82c9c627aabd9f17700d2b7958ba728543fb.tar.xz
snac2-297b82c9c627aabd9f17700d2b7958ba728543fb.zip
following_list() creates links to the actors if they don't exist.
-rw-r--r--data.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/data.c b/data.c
index 0a7898b..922b803 100644
--- a/data.c
+++ b/data.c
@@ -1256,13 +1256,23 @@ xs_list *following_list(snac *snac)
1256 xs *o = xs_json_loads(j); 1256 xs *o = xs_json_loads(j);
1257 1257
1258 if (o != NULL) { 1258 if (o != NULL) {
1259 char *type = xs_dict_get(o, "type"); 1259 const char *type = xs_dict_get(o, "type");
1260 1260
1261 if (!xs_is_null(type) && strcmp(type, "Accept") == 0) { 1261 if (!xs_is_null(type) && strcmp(type, "Accept") == 0) {
1262 char *actor = xs_dict_get(o, "actor"); 1262 const char *actor = xs_dict_get(o, "actor");
1263 1263
1264 if (!xs_is_null(actor)) 1264 if (!xs_is_null(actor)) {
1265 list = xs_list_append(list, actor); 1265 list = xs_list_append(list, actor);
1266
1267 /* check if there is a link to the actor object */
1268 xs *v2 = xs_replace(v, ".json", "");
1269
1270 if (mtime(v2) == 0.0) {
1271 /* no; add a link to it */
1272 xs *actor_fn = _object_fn(actor);
1273 link(actor_fn, v2);
1274 }
1275 }
1266 } 1276 }
1267 } 1277 }
1268 } 1278 }