Add mentions to status model and pass thru mastodon api

master
teknomunk 1 year ago
parent e75061335c
commit d86eedfede

@ -31,7 +31,6 @@ static struct json_object_field status_layout[] = {
// DO NOT INCLUDE field content
JSON_FIELD_STRING( source, false ),
JSON_FIELD_BOOL( sensitive, true ),
JSON_FIELD_BOOL( pinned, false ),
JSON_FIELD_DATETIME( published, false ),
@ -45,6 +44,9 @@ static struct json_object_field status_layout[] = {
JSON_FIELD_ARRAY_OF_INTS( likes, false ),
JSON_FIELD_ARRAY_OF_INTS( replies, false ),
JSON_FIELD_ARRAY_OF_INTS( reposts, false ),
JSON_FIELD_ARRAY_OF_INTS( mentions, false ),
JSON_FIELD_BOOL( sensitive, true ),
JSON_FIELD_END
};

@ -49,6 +49,11 @@ struct status
int* items;
int count;
} reposts;
struct {
int* items;
int count;
} mentions;
};
struct status* status_from_id( unsigned int id );

@ -21,7 +21,7 @@
{
"blurhash": "eRH.A}xs0Kxv00xYR,R+t5R+9Gt6xaNG%%2-;xaM{NGRjD%%Rjs:xaxu",
"description": null,
"id": "1248813041",
"id": "%d{s->id}.media[%d{i}]",
"pleroma": {
"mime_type": "image/png"
},
@ -32,14 +32,16 @@
"url": "%s{s->media.items[i]}"
}%s{ i < s->media.count - 1 ? "," : "" }
%( } )],
"mentions": [%(/*
{
"id": "0",
"username": "teknomunk",
"acct": "teknomunk@apogee.polaris-1.work",
"url": "https://apogee.polaris-1.work/owner"
"mentions": [%( for( int i = 0; i < s->mentions.count; ++i ) { )
%( struct account* mention = account_from_id( s->mentions.items[i] ); )
%s{ i != 0 ? "," : "" }{
"id": "%d{mention->id}",
"username": "%s{mention->handle}",
"acct": "%s{mention->handle}@%s{mention->server}",
"url": "%s{mention->account_url}"
}
*/)],
%( account_free(mention); )
%( } )],
"muted": false,
"pinned": false,
"pleroma": {

Loading…
Cancel
Save