|
|
|
@ -232,6 +232,42 @@ static bool route_update( struct ap_activity* act )
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool route_move( struct ap_activity* act )
|
|
|
|
|
{
|
|
|
|
|
bool result = false;
|
|
|
|
|
struct account* a = NULL;
|
|
|
|
|
|
|
|
|
|
if( act->object.tag != apaot_ref ) { goto discard; }
|
|
|
|
|
|
|
|
|
|
// TODO: make this work
|
|
|
|
|
printf( "TODO: move %s to %s\n", act->object.ref, act->target );
|
|
|
|
|
|
|
|
|
|
// Make sure this belongs to a local account
|
|
|
|
|
a = account_from_uri( act->object.ref );
|
|
|
|
|
if( !a ) { goto discard; }
|
|
|
|
|
|
|
|
|
|
// Verify the target is an existing alias
|
|
|
|
|
bool is_alias = false;
|
|
|
|
|
for( int i = 0; i < a->aliases.count; ++i ) {
|
|
|
|
|
if( 0 == strcmp( a->aliases.items[i], act->target ) ) {
|
|
|
|
|
goto is_alias;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
goto failed;
|
|
|
|
|
is_alias:
|
|
|
|
|
|
|
|
|
|
account_move( a, act->target );
|
|
|
|
|
|
|
|
|
|
discard:
|
|
|
|
|
result = true;
|
|
|
|
|
cleanup:
|
|
|
|
|
account_free(a);
|
|
|
|
|
return result;
|
|
|
|
|
failed:
|
|
|
|
|
result = false;
|
|
|
|
|
goto cleanup;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool route_create( struct ap_activity* act )
|
|
|
|
|
{
|
|
|
|
|
struct status* s = NULL;
|
|
|
|
@ -344,6 +380,7 @@ bool route_activity( struct ap_activity* act )
|
|
|
|
|
case apat_add: return route_add(act);
|
|
|
|
|
case apat_emoji_react: return route_emoji_react(act);
|
|
|
|
|
case apat_update: return route_update(act);
|
|
|
|
|
case apat_move: return route_move(act);
|
|
|
|
|
default:
|
|
|
|
|
printf( "Unhandled activity type: %d\n", act->type );
|
|
|
|
|
}
|
|
|
|
@ -386,7 +423,7 @@ static bool process_one()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Validate signature
|
|
|
|
|
env->validated = http_signature_validate( env, "post /inbox" );
|
|
|
|
|
env->validated = http_signature_validate( env, "post /inbox", act->actor );
|
|
|
|
|
|
|
|
|
|
if( !env->validated ) { goto failed; }
|
|
|
|
|
|
|
|
|
|