|
|
|
@ -59,12 +59,46 @@ static bool route_undo_Announce( struct ap_object* act )
|
|
|
|
|
}
|
|
|
|
|
static bool route_undo_Like( struct ap_object* act )
|
|
|
|
|
{
|
|
|
|
|
bool result = false;
|
|
|
|
|
struct status* s = NULL;
|
|
|
|
|
struct account* a = NULL;
|
|
|
|
|
|
|
|
|
|
s = status_from_uri( act->object.ptr->id );
|
|
|
|
|
if( !s ) { return true; } // Satus not local, discard
|
|
|
|
|
if( !s ) { goto discard; } // Satus not local, discard
|
|
|
|
|
|
|
|
|
|
a = account_from_uri( act->actor );
|
|
|
|
|
if( !a )
|
|
|
|
|
|
|
|
|
|
status_remove_like( s, a );
|
|
|
|
|
goto cleanup;
|
|
|
|
|
cleanup:
|
|
|
|
|
status_free(s);
|
|
|
|
|
return false;
|
|
|
|
|
account_free(a);
|
|
|
|
|
return result;
|
|
|
|
|
discard:
|
|
|
|
|
result = true;
|
|
|
|
|
goto cleanup;
|
|
|
|
|
}
|
|
|
|
|
static bool route_undo_EmojiReact( struct ap_object* act )
|
|
|
|
|
{
|
|
|
|
|
bool result = false;
|
|
|
|
|
struct status* s = NULL;
|
|
|
|
|
struct account* a = NULL;
|
|
|
|
|
s = status_from_uri( act->object.ptr->id );
|
|
|
|
|
if( !s ) { goto discard; }
|
|
|
|
|
|
|
|
|
|
a = account_from_uri( act->object.ptr->actor );
|
|
|
|
|
if( !a ) { goto discard; }
|
|
|
|
|
|
|
|
|
|
status_remove_react( s, act->object.ptr->content.content, a );
|
|
|
|
|
goto discard;
|
|
|
|
|
cleanup:
|
|
|
|
|
account_free(a);
|
|
|
|
|
status_free(s);
|
|
|
|
|
return result;
|
|
|
|
|
discard:
|
|
|
|
|
result = true;
|
|
|
|
|
goto cleanup;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool route_undo_activity( struct ap_object* act )
|
|
|
|
@ -81,7 +115,8 @@ static bool route_undo_activity( struct ap_object* act )
|
|
|
|
|
switch( act->object.ptr->type ) {
|
|
|
|
|
case ap_Follow: return route_undo_follow( act );
|
|
|
|
|
case ap_Announce: return route_undo_Announce( act );
|
|
|
|
|
case ap_Like: return route_undo_Like( act );
|
|
|
|
|
case ap_Like: return route_undo_Like( act );
|
|
|
|
|
case pleroma_EmojiReact: return route_undo_EmojiReact(act);
|
|
|
|
|
default:
|
|
|
|
|
printf( "Unhandled object activity type %d in undo\n", act->object.ptr->type );
|
|
|
|
|
return false;
|
|
|
|
|