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.

99 lines
2.5 KiB
C

#pragma once
#include <stdio.h>
#include <stdbool.h>
struct crypto_keys;
struct status;
struct ap_activity;
enum {
owner_account_id = 0,
home_timeline_id = 1,
public_timeline_id = 2,
};
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;
char* shared_inbox;
struct {
char* url;
char* static_url;
} avatar;
struct {
char** items;
int count;
} aliases;
int followers_count;
int following_count;
int status_count;
int follow_activity;
bool follow_confirmed;
char* note;
bool bot;
bool locked;
bool notify_for_posts;
};
void account_reindex();
void account_index_webfinger( struct account* a );
struct account* account_from_id( int id );
struct account* account_from_uri( const char* uri );
struct account* account_from_uri_or_fetch( const char* uri );
struct account* account_from_webfinger( const char* handle );
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 );
bool account_sync_from_activity_pub( unsigned int id );
bool account_sync_from_activity( struct account* a, struct ap_activity* act );
struct ap_account;
struct ap_account* account_activity_pub_data( struct account* a );
struct outbox_envelope;
struct outbox_envelope_list;
void account_deliver_activity( struct account* a, struct ap_activity* act, struct outbox_envelope_list* oel );
void account_deliver_activity_to_followers( struct account* a, struct ap_activity* act, struct outbox_envelope_list* oel );
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 );
void account_follow( struct account* a, struct account* to_follow );
void account_unfollow( struct account* a, struct account* to_unfollow );
void account_list_followers( struct account* a, int offset, int limit, void* id_array );
void account_list_following( struct account* a, int offset, int limit, void* id_array );
void account_move( struct account* a, const char* new_uri );
void account_announce( struct account* a, struct status* s );
bool account_does_follow( struct account* a, int account_id );