You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
2.1 KiB
C
129 lines
2.1 KiB
C
#pragma once
|
|
|
|
#include "json/layout.h"
|
|
|
|
#include "activity/context.h"
|
|
#include "activity/tag.h"
|
|
|
|
#include <time.h>
|
|
|
|
enum ap_signature_type
|
|
{
|
|
apst_rsa_signature_2017 = 1,
|
|
};
|
|
|
|
struct ap_signature
|
|
{
|
|
int type;
|
|
char* creator;
|
|
time_t created;
|
|
char* value;
|
|
};
|
|
|
|
enum ap_activity_type
|
|
{
|
|
apat_undo = 1,
|
|
apat_follow = 2,
|
|
apat_delete = 3,
|
|
apat_accept = 4,
|
|
apat_create = 5,
|
|
apat_tentative_accept = 6,
|
|
apat_add = 7,
|
|
apat_arrive = 8,
|
|
apat_ignore = 9,
|
|
apat_join = 10,
|
|
apat_leave = 11,
|
|
apat_like = 12,
|
|
apat_offer = 13,
|
|
apat_invite = 14,
|
|
apat_reject = 15,
|
|
apat_tentative_reject = 16,
|
|
apat_remove = 17,
|
|
apat_update = 18,
|
|
apat_view = 19,
|
|
apat_listen = 20,
|
|
apat_read = 21,
|
|
apat_move = 22,
|
|
apat_travel = 23,
|
|
apat_announce = 24,
|
|
apat_block = 25,
|
|
apat_flag = 26,
|
|
apat_dislike = 27,
|
|
apat_question = 28,
|
|
};
|
|
enum ap_activity_object_type {
|
|
apaot_ref = 1,
|
|
apaot_activity = 2,
|
|
};
|
|
|
|
struct ap_activity
|
|
{
|
|
struct ap_activity_context ap_context;
|
|
|
|
char* id;
|
|
char* actor;
|
|
int local_id;
|
|
int type;
|
|
|
|
char* context;
|
|
int context_id;
|
|
|
|
bool direct_message;
|
|
|
|
char* attributed_to;
|
|
|
|
char* content;
|
|
char* conversation;
|
|
time_t published;
|
|
char* source;
|
|
char* summary;
|
|
|
|
bool sensitive;
|
|
|
|
struct {
|
|
struct tag** items;
|
|
int count;
|
|
} tags;
|
|
|
|
struct {
|
|
char** items;
|
|
int count;
|
|
} attachments;
|
|
|
|
struct {
|
|
char** items;
|
|
int count;
|
|
} to, cc, bcc;
|
|
|
|
struct {
|
|
int tag;
|
|
union {
|
|
char* ref;
|
|
struct ap_activity* ptr;
|
|
};
|
|
} object;
|
|
|
|
char* state;
|
|
|
|
int has_signature;
|
|
struct ap_signature signature;
|
|
};
|
|
|
|
struct json_object_field;
|
|
extern struct json_field_type ap_activity_type;
|
|
extern struct json_object_field ap_activity_layout[];
|
|
|
|
struct ap_activity* ap_activity_new();
|
|
struct ap_activity* ap_activity_dup( struct ap_activity* act );
|
|
struct ap_activity* ap_activity_from_FILE( FILE* f );
|
|
struct ap_activity* ap_activity_from_local_id( int id );
|
|
void ap_activity_free( struct ap_activity* act );
|
|
void ap_activity_free_composite( struct ap_activity* act );
|
|
|
|
void ap_activity_write_to_FILE( struct ap_activity* act, FILE* f );
|
|
void ap_activity_save( struct ap_activity* act );
|
|
|
|
struct ap_activity* ap_activity_create_accept( struct ap_activity* act );
|
|
|
|
|