|
|
|
@ -49,23 +49,21 @@ struct ap_object* activity_from_local_id( int id )
|
|
|
|
|
return act;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static struct ap_object* new_local_activity()
|
|
|
|
|
struct ap_object* activity_new_local_activity()
|
|
|
|
|
{
|
|
|
|
|
struct ap_object* act = ap_object_new();
|
|
|
|
|
|
|
|
|
|
ap_object_add_context( act, "https://www.w3.org/ns/activitystreams");
|
|
|
|
|
char buffer[512];
|
|
|
|
|
ap_object_add_context( act, format( buffer, 512, "https://%s/schemas/litepub-0.1.jsonld", g_server->domain ) );
|
|
|
|
|
|
|
|
|
|
return act;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct ap_object* activity_create_Accept( struct ap_object* act )
|
|
|
|
|
{
|
|
|
|
|
struct ap_object* accept;
|
|
|
|
|
accept = malloc(sizeof(*accept));
|
|
|
|
|
memset(accept,0,sizeof(*accept));
|
|
|
|
|
struct ap_object* accept = activity_new_local_activity();
|
|
|
|
|
activity_allocate_local_id(accept);
|
|
|
|
|
ap_object_add_context( accept, "https://www.w3.org/ns/activitystreams");
|
|
|
|
|
ap_object_add_context( accept, "https://apogee.polaris-1.work/schemas/litepub-0.1.jsonld");
|
|
|
|
|
|
|
|
|
|
asprintf( &accept->id,"https://%s/activity/%d", g_server->domain, accept->local_id );
|
|
|
|
|
accept->type = ap_Accept;
|
|
|
|
@ -99,7 +97,7 @@ struct ap_object* activity_create_EmojiReact( struct status* s, const char* reac
|
|
|
|
|
|
|
|
|
|
struct account* a = account_from_id( s->account_id );
|
|
|
|
|
|
|
|
|
|
struct ap_object* act = new_local_activity();
|
|
|
|
|
struct ap_object* act = activity_new_local_activity();
|
|
|
|
|
activity_allocate_local_id(act);
|
|
|
|
|
act->id = aformat( "https://%s/activity/%d", g_server->domain, act->local_id );
|
|
|
|
|
act->actor = aformat( "https://%s/owner/actor", g_server->domain );
|
|
|
|
@ -139,10 +137,8 @@ void activity_react( struct status* s, const char* react )
|
|
|
|
|
|
|
|
|
|
struct ap_object* activity_create_Follow( struct account* follower, struct account* following )
|
|
|
|
|
{
|
|
|
|
|
struct ap_object* act = ap_object_new();
|
|
|
|
|
struct ap_object* act = activity_new_local_activity();
|
|
|
|
|
activity_allocate_local_id(act);
|
|
|
|
|
ap_object_add_context( act, "https://www.w3.org/ns/activitystreams");
|
|
|
|
|
ap_object_add_context( act, "https://apogee.polaris-1.work/schemas/litepub-0.1.jsonld");
|
|
|
|
|
act->id = aformat( "https://%s/activity/%d", g_server->domain, act->local_id );
|
|
|
|
|
act->actor = strdup( follower->account_url );
|
|
|
|
|
act->type = ap_Follow;
|
|
|
|
@ -182,10 +178,8 @@ failed:
|
|
|
|
|
|
|
|
|
|
struct ap_object* activity_create_Undo( struct ap_object* act_to_undo )
|
|
|
|
|
{
|
|
|
|
|
struct ap_object* act = ap_object_new();
|
|
|
|
|
struct ap_object* act = activity_new_local_activity();
|
|
|
|
|
activity_allocate_local_id(act);
|
|
|
|
|
ap_object_add_context( act, "https://www.w3.org/ns/activitystreams");
|
|
|
|
|
ap_object_add_context( act, "https://apogee.polaris-1.work/schemas/litepub-0.1.jsonld");
|
|
|
|
|
act->id = aformat( "https://%s/activity/%d", g_server->domain, act->local_id );
|
|
|
|
|
act->actor = strdup( act_to_undo->actor );
|
|
|
|
|
act->type = ap_Undo;
|
|
|
|
@ -228,7 +222,7 @@ failed:
|
|
|
|
|
|
|
|
|
|
struct ap_object* activity_create_Like( struct status* s )
|
|
|
|
|
{
|
|
|
|
|
struct ap_object* act = new_local_activity();
|
|
|
|
|
struct ap_object* act = activity_new_local_activity();
|
|
|
|
|
activity_allocate_local_id(act);
|
|
|
|
|
act->id = aformat( "https://%s/activity/%d", g_server->domain, act->local_id );
|
|
|
|
|
act->actor = aformat( "https://%s/owner/actor", g_server->domain );
|
|
|
|
@ -269,7 +263,7 @@ int activity_like( struct status* s )
|
|
|
|
|
|
|
|
|
|
struct ap_object* activity_create_Note( struct status* s )
|
|
|
|
|
{
|
|
|
|
|
struct ap_object* act = new_local_activity();
|
|
|
|
|
struct ap_object* act = activity_new_local_activity();
|
|
|
|
|
act->id = aformat( "https://%s/note/%d", g_server->domain, s->id );
|
|
|
|
|
act->type = ap_Note;
|
|
|
|
|
act->published = s->published;
|
|
|
|
@ -288,6 +282,10 @@ struct ap_object* activity_create_Note( struct status* s )
|
|
|
|
|
status_free(s_quote_post);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set the replies
|
|
|
|
|
act->replies.tag = apaot_ref;
|
|
|
|
|
act->replies.ref = aformat( "https://%s/note/%d/replies", g_server->domain, s->id );
|
|
|
|
|
|
|
|
|
|
/* set account related parameters */ {
|
|
|
|
|
struct account* a = account_from_id( s->account_id );
|
|
|
|
|
act->actor = strdup( a->account_url );
|
|
|
|
@ -353,10 +351,9 @@ struct ap_object* activity_create_Note( struct status* s )
|
|
|
|
|
|
|
|
|
|
struct ap_object* activity_create_Create( struct ap_object* object )
|
|
|
|
|
{
|
|
|
|
|
struct ap_object* act = ap_object_new();
|
|
|
|
|
struct ap_object* act = activity_new_local_activity();
|
|
|
|
|
activity_allocate_local_id(act);
|
|
|
|
|
ap_object_add_context( act, "https://www.w3.org/ns/activitystreams");
|
|
|
|
|
ap_object_add_context( act, "https://apogee.polaris-1.work/schemas/litepub-0.1.jsonld");
|
|
|
|
|
|
|
|
|
|
act->type = ap_Create;
|
|
|
|
|
act->id = aformat( "https://%s/activity/%d", g_server->domain, act->local_id );
|
|
|
|
|
act->object.tag = apaot_activity;
|
|
|
|
|