@ -254,7 +254,8 @@ struct ap_object* account_ap_outbox( struct account* a )
outbox - > type = apot_ordered_collection ;
outbox - > published = time ( NULL ) ;
outbox - > id = aformat ( " https://%s/outbox " , g_server_name ) ;
outbox - > first = aformat ( " https://%s/outbox/page-0 " , g_server_name ) ;
outbox - > first . tag = apaot_ref ;
outbox - > first . ref = aformat ( " https://%s/outbox/page-0 " , g_server_name ) ;
char buffer [ 512 ] ;
outbox - > total_items = ffdb_trie_count ( format ( buffer , 512 , " data/accounts/%d/timeline " , a - > id ) ) ;
@ -265,7 +266,7 @@ struct ap_object* account_ap_outbox_page( struct account* a, int page )
enum { items_per_page = 10 } ;
char buffer [ 512 ] ;
int total_items = ffdb_trie_count ( format ( buffer , 512 , " data/accounts/%d/timeline " , a - > id ) ) ;
int page_count = ( total_items + items_per_page - 1 ) - items_per_page ;
int page_count = ( total_items + items_per_page - 1 ) / items_per_page ;
if ( page > = page_count ) { return NULL ; }
@ -285,6 +286,8 @@ struct ap_object* account_ap_outbox_page( struct account* a, int page )
int activity_id = 0 ;
if ( 1 = = sscanf ( values . items [ i ] , " %d " , & id ) ) {
struct status * s = status_from_id ( id ) ;
if ( ! s ) { goto include_tombstone ; }
activity_id = s - > activity_id ;
if ( s - > activity_id = = 0 ) {
goto include_tombstone ;
@ -335,12 +338,12 @@ struct ap_object* account_ap_outbox_page( struct account* a, int page )
return outbox ;
}
struct ap_ activity * account_activity_pub ( struct account * a )
struct ap_ object * account_activity_pub ( struct account * a )
{
return account_ap_actor ( a ) ;
}
bool account_sync_from_activity ( struct account * a , struct ap_ activity * act )
bool account_sync_from_activity ( struct account * a , struct ap_ object * act )
{
for ( int i = 0 ; i < a - > aliases . count ; + + i ) {
free ( a - > aliases . items [ i ] ) ;
@ -623,8 +626,8 @@ void account_follow( struct account* a, struct account* to_follow )
}
void account_create ( struct account * a , struct status * s )
{
struct ap_ activity * note = ap_activity_create_note ( s ) ;
struct ap_ activity * create = ap_activity_create_Create ( note ) ;
struct ap_ object * note = ap_activity_create_note ( s ) ;
struct ap_ object * create = ap_activity_create_Create ( note ) ;
ap_activity_save ( create ) ;
// Link status to activity
@ -649,7 +652,7 @@ void account_create( struct account* a, struct status* s )
}
void account_announce ( struct account * a , struct status * original_post , struct status * local_repost )
{
struct ap_ activity * act = ap_activity_new ( ) ;
struct ap_ object * act = ap_activity_new ( ) ;
int id = fs_list_get ( " data/activities/HEAD " ) + 1 ;
fs_list_set ( " data/activities/HEAD " , id ) ;
@ -697,7 +700,7 @@ cleanup:
ap_object_free ( act ) ;
}
void account_deliver_activity ( struct account * a , struct ap_ activity * act , struct outbox_envelope_list * oel )
void account_deliver_activity ( struct account * a , struct ap_ object * act , struct outbox_envelope_list * oel )
{
printf ( " Delivering activity %s to account %s \n " , act - > id , a - > account_url ) ;
@ -721,7 +724,7 @@ void account_deliver_activity( struct account* a, struct ap_activity* act, struc
env - > account_id = a - > id ;
array_append ( oel , sizeof ( env ) , & env ) ;
}
void account_deliver_activity_to_followers ( struct account * a , struct ap_ activity * act , struct outbox_envelope_list * oel )
void account_deliver_activity_to_followers ( struct account * a , struct ap_ object * act , struct outbox_envelope_list * oel )
{
printf ( " Delivering activity %s to followers of account %s \n " , act - > id , a - > account_url ) ;
struct {
@ -768,7 +771,7 @@ void account_unfollow( struct account* a, struct account* to_unfollow )
}
// Lookup the Activity used to federate following this account
struct ap_ activity * act = ap_activity_from_local_id ( atoi ( res ) ) ;
struct ap_ object * act = ap_activity_from_local_id ( atoi ( res ) ) ;
free ( res ) ;
// Federate Undo Activity