|
|
|
@ -78,17 +78,12 @@ void activity_accept( struct ap_object* act, int deliver_to_account_id )
|
|
|
|
|
{
|
|
|
|
|
struct ap_object* accept = activity_create_Accept(act);
|
|
|
|
|
activity_save(accept);
|
|
|
|
|
|
|
|
|
|
struct outbox_envelope* env = outbox_envelope_new();
|
|
|
|
|
env->activity_id = accept->local_id;
|
|
|
|
|
env->account_id = deliver_to_account_id;
|
|
|
|
|
outbox_envelope_save( env );
|
|
|
|
|
outbox_envelope_free( env );
|
|
|
|
|
activity_deliver(accept);
|
|
|
|
|
|
|
|
|
|
ap_object_free(accept);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct ap_object* activity_create_EmojiReact( struct status* s, const char* react )
|
|
|
|
|
struct ap_object* activity_create_EmojiReact( struct status* s, struct account* reactor, const char* react )
|
|
|
|
|
{
|
|
|
|
|
if( !*react ) {
|
|
|
|
|
return NULL;
|
|
|
|
@ -99,7 +94,7 @@ struct ap_object* activity_create_EmojiReact( struct status* s, const char* reac
|
|
|
|
|
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 = strdup(a->account_url);
|
|
|
|
|
act->actor = strdup(reactor->account_url);
|
|
|
|
|
act->type = pleroma_EmojiReact;
|
|
|
|
|
act->content.content = safe_strdup(react);
|
|
|
|
|
act->published = time(NULL);
|
|
|
|
@ -118,19 +113,13 @@ struct ap_object* activity_create_EmojiReact( struct status* s, const char* reac
|
|
|
|
|
return act;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void activity_react( struct status* s, const char* react )
|
|
|
|
|
void activity_react( struct account* reactor, struct status* s, const char* react )
|
|
|
|
|
{
|
|
|
|
|
struct ap_object* act = activity_create_EmojiReact(s,react);
|
|
|
|
|
struct ap_object* act = activity_create_EmojiReact(s,reactor,react);
|
|
|
|
|
if( !act ) { return; }
|
|
|
|
|
|
|
|
|
|
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 );
|
|
|
|
|
|
|
|
|
|
activity_deliver(act);
|
|
|
|
|
ap_object_free(act);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -159,14 +148,9 @@ int activity_follow( struct account* follower, struct account* following )
|
|
|
|
|
if( !act ) { goto failed; }
|
|
|
|
|
|
|
|
|
|
activity_save(act);
|
|
|
|
|
activity_deliver(act);
|
|
|
|
|
res = act->local_id;
|
|
|
|
|
|
|
|
|
|
struct outbox_envelope* env = outbox_envelope_new();
|
|
|
|
|
if( !env ) { goto failed; }
|
|
|
|
|
env->activity_id = act->local_id;
|
|
|
|
|
env->account_id = following->id;
|
|
|
|
|
outbox_envelope_save( env );
|
|
|
|
|
outbox_envelope_free( env );
|
|
|
|
|
cleanup:
|
|
|
|
|
ap_object_free(act);
|
|
|
|
|
return res;
|
|
|
|
@ -198,20 +182,7 @@ void activity_undo( struct ap_object* act, int deliver_to_account_id )
|
|
|
|
|
if( !undo_act ) { goto failed; }
|
|
|
|
|
|
|
|
|
|
activity_save(undo_act);
|
|
|
|
|
/*
|
|
|
|
|
printf( "act=" );
|
|
|
|
|
ap_activity_write_to_FILE( act, stdout );
|
|
|
|
|
printf( "\nundo_act=");
|
|
|
|
|
ap_activity_write_to_FILE( undo_act, stdout );
|
|
|
|
|
printf( "\n" );
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
struct outbox_envelope* env = outbox_envelope_new();
|
|
|
|
|
if( !env ) { goto failed; }
|
|
|
|
|
env->activity_id = undo_act->local_id;
|
|
|
|
|
env->account_id = deliver_to_account_id;
|
|
|
|
|
outbox_envelope_save( env );
|
|
|
|
|
outbox_envelope_free( env );
|
|
|
|
|
activity_deliver(undo_act);
|
|
|
|
|
cleanup:
|
|
|
|
|
ap_object_free(undo_act);
|
|
|
|
|
return;
|
|
|
|
@ -256,7 +227,8 @@ int activity_like( struct status* s )
|
|
|
|
|
if( !act ) { return 0; }
|
|
|
|
|
|
|
|
|
|
activity_save(act);
|
|
|
|
|
activity_deliver( act );
|
|
|
|
|
activity_deliver(act);
|
|
|
|
|
ap_object_free(act);
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|