Cleanup CURL library before existing, implement Update federation

master
teknomunk 1 year ago
parent ddc026cb06
commit 1a18b603f5

@ -142,6 +142,7 @@ int main( int argc, char* argv[] )
}
exit:
curl_global_cleanup();
app_args_release(args);
return code;

@ -201,18 +201,34 @@ void account_unfollow( struct account* a, struct account* to_unfollow )
void account_update( struct account* a )
{
int id = fs_list_get("data/activities/HEAD") + 1;
fs_list_set("data/activities/HEAD", id );
struct ap_object* act;
act = malloc(sizeof(*act));
memset(act,0,sizeof(*act));
act->local_id = id;
act->id = aformat( "https://%s/activity/%d", g_server_name, id );
act->type = apat_update;
act->actor = strdup(a->account_url);
act->object.tag = apaot_activity;
act->object.ptr = account_activity_pub(a);
ap_activity_write_to_FILE( act, stdout );
char* str = aformat("https://%s/owner/followers", g_server_name );
array_append( &act->to, sizeof(str), &str );
struct outbox_envelope_list oel;
memset(&oel,0,sizeof(oel));
account_deliver_activity_to_followers( a, act, &oel );
printf( "Delivering to %d inboxes\n", oel.count );
outbox_envelope_list_save(&oel);
outbox_envelope_list_free_composite(&oel);
ap_activity_save(act);
ap_object_free(act);
}

Loading…
Cancel
Save