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.

52 lines
1.1 KiB
C

#pragma once
#include <stdio.h>
#include <stdbool.h>
struct crypto_keys;
enum account_type
{
at_owner = 1,
at_bot = 2,
at_remote_activity_pub = 3,
at_rss_feed = 4,
};
struct account
{
unsigned int id;
char* handle;
char* server;
char* display_name;
int account_type;
char* account_url;
char* inbox;
struct {
char* url;
char* static_url;
} avatar;
bool bot;
bool locked;
};
struct account* account_from_id( unsigned int id );
struct account* account_from_uri( const char* uri );
struct account* account_fetch_from_uri( const char* uri );
struct account* account_new();
void account_free( struct account* a );
void account_save( struct account* a );
void account_sync_from_acitvity_pub( unsigned int id );
struct crypto_keys* account_get_public_key( struct account* a, const char* key_name );
struct crypto_keys* account_get_private_key( struct account* a );
void account_add_follower( struct account* a, struct account* follower );
void account_remove_follower( struct account* a, struct account* follower );
// TODO: move to controller/view and rename api_account_write_as_json
void account_write_as_json( struct account* a, FILE* f );