Move state modification code from controller to model, add pleroma api endpoint, add stub for emoji reactions, add messages for block/unfollow events
parent
134d9afc5a
commit
f4b019eff0
@ -0,0 +1,47 @@
|
||||
#include "pleroma_api.h"
|
||||
|
||||
#include "http_server/http_request.h"
|
||||
|
||||
#include "model/status.h"
|
||||
|
||||
#include "src/controller/api/client_apps.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
bool http_request_route_id( struct http_request* req, int* id );
|
||||
|
||||
static bool route_status( struct http_request* req, struct status* s )
|
||||
{
|
||||
if( http_request_route( req, "reactions/" ) ) {
|
||||
char* react = http_request_route_get_dir_or_file( req );
|
||||
status_add_react( s, react );
|
||||
free(react);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool route_pleroma_api( struct http_request* req )
|
||||
{
|
||||
if( http_request_route( req, "/statuses" ) ) {
|
||||
printf( "route: statuses\n" );
|
||||
if( http_request_route( req, "/" ) ) {
|
||||
int id = -1;
|
||||
|
||||
if( http_request_route_id( req, &id ) ) {
|
||||
struct status* s = status_from_id(id);
|
||||
if( !s ) {
|
||||
printf( "Status %d not found\n", id );
|
||||
return false;
|
||||
}
|
||||
bool result = route_status( req, s );
|
||||
status_free(s);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
struct http_request;
|
||||
bool route_pleroma_api( struct http_request* req );
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 3cacd9fa083d94088c87e826be5f123c8056b880
|
||||
Subproject commit c5b4f6e732131995377c1a40b9fba1f86845e519
|
Loading…
Reference in new issue