treebird/src/account.h
me@ow.nekobit.net 53aa15e831 Load account stubs
FossilOrigin-Name: ec18c50cdcf12538dbc46e714318466a64f606c2931cd2fdbace47b14087b578
2022-05-05 15:05:05 +00:00

86 lines
2.9 KiB
C

/*
* Treebird - Lightweight frontend for Pleroma
* Copyright (C) 2022 Nekobit
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef ACCOUNT_H
#define ACCOUNT_H
#include <stddef.h>
#include <mastodont.h>
#include "session.h"
#include "l10n.h"
#define ACCOUNT_NOP 0
#define ACCOUNT_ACTION_BTNS (1<<0)
#define ACCOUNT_SUMMARY (1<<1)
enum account_tab
{
ACCT_TAB_STATUSES,
ACCT_TAB_SCROBBLES,
ACCT_TAB_PINNED,
ACCT_TAB_MEDIA
};
struct account_page
{
enum l10n_locale locale;
struct mstdnt_account* account;
char* header_image;
char* profile_image;
char* acct;
char* display_name;
size_t statuses_count;
size_t following_count;
size_t followers_count;
char* id;
char* note;
enum account_tab tab;
mstdnt_relationship_flag_t flags;
struct mstdnt_relationship* relationship;
};
char* construct_account(mastodont_t* api,
struct mstdnt_account* account,
uint8_t flags,
int* size);
char* construct_accounts(mastodont_t* api,
struct mstdnt_account* accounts,
size_t size,
uint8_t flags,
size_t* ret_size);
size_t construct_account_page(char** result, struct account_page* page, char* content);
char* load_account_page(mastodont_t* api,
struct mstdnt_account* acct,
struct mstdnt_relationship* relationship,
enum account_tab tab,
char* content,
size_t* res_size);
char* load_account_info(struct mstdnt_account* acct,
size_t* size);
void content_account_statuses(struct session* ssn, mastodont_t* api, char** data);
void content_account_scrobbles(struct session* ssn, mastodont_t* api, char** data);
void content_account_pinned(struct session* ssn, mastodont_t* api, char** data);
void content_account_media(struct session* ssn, mastodont_t* api, char** data);
void content_account_action(struct session* ssn, mastodont_t* api, char** data);
void content_account_favourites(struct session* ssn, mastodont_t* api, char** data);
void content_account_bookmarks(struct session* ssn, mastodont_t* api, char** data);
#endif // ACCOUNT_H