|
|
|
@ -10,6 +10,7 @@
|
|
|
|
|
#include "model/account.h"
|
|
|
|
|
#include "model/status.h"
|
|
|
|
|
#include "model/ap/outbox_envelope.h"
|
|
|
|
|
#include "model/ap/activity/rsa_signature_2017.h"
|
|
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
@ -177,19 +178,59 @@ struct ap_activity* ap_activity_create_emoji_react( struct status* s, const char
|
|
|
|
|
void ap_activity_react( struct status* s, const char* react )
|
|
|
|
|
{
|
|
|
|
|
struct ap_activity* act = ap_activity_create_emoji_react(s,react);
|
|
|
|
|
ap_activity_save(act);
|
|
|
|
|
|
|
|
|
|
struct outbox_envelope* env = outbox_envelope_new();
|
|
|
|
|
env->activity_id = act->local_id;
|
|
|
|
|
env->account_id = s->account_id;
|
|
|
|
|
outbox_envelope_save( env );
|
|
|
|
|
outbox_envelope_free( env );
|
|
|
|
|
|
|
|
|
|
ap_activity_free(act);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct ap_activity* ap_activity_create_follow( struct account* follower, struct account* following )
|
|
|
|
|
{
|
|
|
|
|
int id = fs_list_get("data/activities/HEAD") + 1;
|
|
|
|
|
//fs_list_set( "data/activities/HEAD", id );
|
|
|
|
|
|
|
|
|
|
struct ap_activity* act = ap_activity_new();
|
|
|
|
|
act->local_id = id;
|
|
|
|
|
act->id = aformat( "https://%s/activity/%d", g_server_name, id );
|
|
|
|
|
act->actor = strdup( follower->account_url );
|
|
|
|
|
act->type = apat_follow;
|
|
|
|
|
act->published = time(NULL);
|
|
|
|
|
act->object.tag = apaot_ref;
|
|
|
|
|
act->state = strdup("pending");
|
|
|
|
|
act->object.ref = strdup( following->account_url );
|
|
|
|
|
|
|
|
|
|
char* to = strdup(following->account_url);
|
|
|
|
|
array_append( &act->to, sizeof(to), &to );
|
|
|
|
|
|
|
|
|
|
return act;
|
|
|
|
|
}
|
|
|
|
|
void ap_activity_follow( struct account* follower, struct account* following )
|
|
|
|
|
{
|
|
|
|
|
struct ap_activity* act = ap_activity_create_follow( follower, following );
|
|
|
|
|
/*
|
|
|
|
|
ap_activity_write_to_FILE( act, stdout );
|
|
|
|
|
printf("\nRDF:\n");
|
|
|
|
|
ap_activity_write_normalized_rdf(act, stdout);
|
|
|
|
|
*/
|
|
|
|
|
//*/
|
|
|
|
|
|
|
|
|
|
ap_activity_save(act);
|
|
|
|
|
|
|
|
|
|
struct outbox_envelope* env = outbox_envelope_new();
|
|
|
|
|
env->activity_id = act->local_id;
|
|
|
|
|
env->account_id = s->account_id;
|
|
|
|
|
env->account_id = following->id;
|
|
|
|
|
outbox_envelope_save( env );
|
|
|
|
|
outbox_envelope_free( env );
|
|
|
|
|
|
|
|
|
|
ap_activity_free(act);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ap_activity_undo( struct activity* act )
|
|
|
|
|
{
|
|
|
|
|
// TODO: implement
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|