diff options
author | default <nobody@localhost> | 2022-09-28 04:48:23 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2022-09-28 04:48:23 +0200 |
commit | 32661d2be7bb718522c123e401ef35fa0307c1c0 (patch) | |
tree | 9b99dbdad9ba918090847131014dc524f264504e /activitypub.c | |
parent | 94ef803701d7a7596a5347a8b9af6c586b795c92 (diff) |
The outbox returns now some entries.
Diffstat (limited to 'activitypub.c')
-rw-r--r-- | activitypub.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/activitypub.c b/activitypub.c index 5ab7a96..8a38257 100644 --- a/activitypub.c +++ b/activitypub.c @@ -761,10 +761,24 @@ int activitypub_get_handler(d_char *req, char *q_path, else if (strcmp(p_path, "outbox") == 0) { xs *id = xs_fmt("%s/outbox", snac.actor); + xs *elems = local_list(&snac, 40); + xs *list = xs_list_new(); msg = msg_collection(&snac, id); + char *p, *v; + + p = elems; + while (xs_list_iter(&p, &v)) { + xs *i = timeline_get(&snac, v); + char *type = xs_dict_get(i, "type"); + char *id = xs_dict_get(i, "id"); + + if (type && id && strcmp(type, "Note") == 0 && xs_startswith(id, snac.actor)) + list = xs_list_append(list, i); + } /* replace the 'orderedItems' with the latest posts */ - /* ... */ + msg = xs_dict_set(msg, "orderedItems", list); + msg = xs_dict_set(msg, "totalItems", xs_number_new(xs_list_len(list))); } else if (strcmp(p_path, "followers") == 0 || strcmp(p_path, "following") == 0) { |