Convert account over json layout loader, start implementing account reverse index (needed for account uri to account id lookup), more work on ap_activity, convert owner over to json layout loader
parent
6706606cf8
commit
65756c5795
@ -1 +1 @@
|
||||
Subproject commit 8853784e4d4cc3954c0bf12ad46ede4b1eabb56a
|
||||
Subproject commit 9baefa441da46e353691c0e12ac0b008afd4802d
|
@ -0,0 +1,36 @@
|
||||
#include "activity.h"
|
||||
|
||||
#include "json/json.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
static struct json_enum ap_signature_type_enum[] = {
|
||||
{ "RsaSignature2017", 1 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
static struct json_object_field ap_signature_layout[] = {
|
||||
{ "type", offsetof( struct ap_signature, type ), true, &json_field_enum, ap_signature_type_enum },
|
||||
{ "creator", offsetof( struct ap_signature, creator ), true, &json_field_string },
|
||||
{ "created", offsetof( struct ap_signature, created ), true, &json_field_string }, // TODO: date parser
|
||||
{ "signatureValue", offsetof( struct ap_signature, value ), true, &json_field_string },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
static struct json_enum ap_activity_type_enum[] = {
|
||||
{ "Undo", 1 },
|
||||
{ "Follow", 2 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
struct json_object_field ap_activity_layout[] = {
|
||||
{ "id", offsetof( struct ap_activity, id ), true, &json_field_string },
|
||||
{ "type", offsetof( struct ap_activity, type ), true, &json_field_enum, ap_activity_type_enum },
|
||||
{ "actor", offsetof( struct ap_activity, actor ), true, &json_field_string },
|
||||
{ "to", offsetof( struct ap_activity, to ), true, &json_field_array_of, &json_field_string },
|
||||
{ "cc", offsetof( struct ap_activity, cc ), false, &json_field_array_of, &json_field_string },
|
||||
{ "bcc", offsetof( struct ap_activity, bcc ), false, &json_field_array_of, &json_field_string },
|
||||
{ "object", offsetof( struct ap_activity, object ), false, &json_field_string },
|
||||
{ "signature", offsetof( struct ap_activity, signature ), true, &json_field_object_composite, ap_signature_layout },
|
||||
{ NULL },
|
||||
};
|
@ -1,20 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
struct ap_signature;
|
||||
#include "json/layout.h"
|
||||
|
||||
enum ap_signature_type
|
||||
{
|
||||
apst_rsa_signature_2017 = 1,
|
||||
};
|
||||
|
||||
struct ap_signature
|
||||
{
|
||||
int type;
|
||||
char* creator;
|
||||
char* created;
|
||||
char* value;
|
||||
};
|
||||
|
||||
enum ap_activity_type
|
||||
{
|
||||
apat_undo = 1,
|
||||
apat_follow = 2,
|
||||
};
|
||||
|
||||
struct ap_activity
|
||||
{
|
||||
char* id;
|
||||
char* type;
|
||||
int type;
|
||||
char* actor;
|
||||
struct {
|
||||
char** items;
|
||||
int count;
|
||||
} to;
|
||||
} to, cc, bcc;
|
||||
char* object;
|
||||
struct ap_signature* signature;
|
||||
struct ap_signature signature;
|
||||
};
|
||||
|
||||
struct json_field_type;
|
||||
extern struct json_field_type json_field_object_activity;
|
||||
struct json_object_field;
|
||||
extern struct json_object_field ap_activity_layout[];
|
||||
|
||||
|
Loading…
Reference in new issue