@ -186,31 +186,52 @@ static struct account* lookup_actor_account( struct ap_activity* act )
static bool route_like ( struct ap_activity * act )
{
struct status * s = NULL ;
struct account * liker = NULL ;
bool result = false ;
int error ;
struct status * s = lookup_object_status ( act , & error ) ;
struct account * liker = lookup_actor_account ( act ) ;
s = lookup_object_status ( act , & error ) ;
liker = lookup_actor_account ( act ) ;
if ( ! s ) {
if ( error = = error_lookup_failed ) {
return true ;
}
return false ;
if ( error = = error_lookup_failed ) { goto discard ; }
goto failed ;
} ;
status_add_like ( s , liker ) ;
return true ;
discard :
result = true ;
goto cleanup ;
cleanup :
account_free ( liker ) ;
status_free ( s ) ;
return result ;
failed :
result = false ;
goto cleanup ;
}
static bool route_emoji_react ( struct ap_activity * act )
{
struct status * s = NULL ;
struct account * reactor = NULL ;
bool result = false ;
int error ;
struct status * s = lookup_object_status ( act , & error ) ;
struct account * reactor = lookup_actor_account ( act ) ;
if ( ! s | | ! reactor ) { return false ; }
s = lookup_object_status ( act , & error ) ;
reactor = lookup_actor_account ( act ) ;
if ( ! s | | ! reactor ) { goto failed ; }
status_add_react ( s , act - > content . content , reactor ) ;
return true ;
discard :
result = true ;
goto cleanup ;
cleanup :
status_free ( s ) ;
account_free ( reactor ) ;
return result ;
failed :
result = false ;
goto cleanup ;
}
static bool route_update_Person ( struct ap_activity * act )
@ -488,7 +509,7 @@ static bool process_one()
if ( ! env ) {
printf ( " Failed to parse envelope+activity for data/inbox/%d.json \n " , id ) ;
return false ;
goto failed ;
}
// Load activity
@ -509,8 +530,8 @@ static bool process_one()
printf ( " Processing %d \n " , id ) ;
step_tail = route_activity ( act ) ;
finished :
printf ( " step_tail=%c \n " , step_tail ? ' T ' : ' F ' ) ;
cleanup :
printf ( " \n step_tail=%c \n " , step_tail ? ' T ' : ' F ' ) ;
if ( step_tail ) {
fs_list_set ( " data/inbox/TAIL " , id ) ;
result = true ;
@ -522,11 +543,11 @@ finished:
return result ;
failed :
result = false ;
goto finished ;
goto cleanup ;
discard :
step_tail = true ;
result = true ;
goto finished ;
goto cleanup ;
}
bool cleanup_box ( const char * box )