FossilOrigin-Name: 5a89b703b94bb8ce089d448ef9c0044b97b73ef3c411b499d4aadf96ac786130
This commit is contained in:
nekobit 2022-10-15 21:34:09 +00:00
parent e36f9e05ca
commit 9f44fa8623
21 changed files with 63 additions and 63 deletions

View File

@ -38,13 +38,13 @@
struct account_args
{
mstdnt_t* api;
mastodont_t* api;
struct mstdnt_account* accts;
uint8_t flags;
};
static char* accounts_page(HV* session_hv,
mstdnt_t* api,
mastodont_t* api,
struct mstdnt_account* acct,
struct mstdnt_relationship* rel,
char* header,
@ -83,7 +83,7 @@ static char* accounts_page(HV* session_hv,
static char* account_followers_cb(HV* session_hv,
struct session* ssn,
mstdnt_t* api,
mastodont_t* api,
struct mstdnt_account* acct,
struct mstdnt_relationship* rel,
void* _args)
@ -111,7 +111,7 @@ static char* account_followers_cb(HV* session_hv,
static char* account_following_cb(HV* session_hv,
struct session* ssn,
mstdnt_t* api,
mastodont_t* api,
struct mstdnt_account* acct,
struct mstdnt_relationship* rel,
void* _args)
@ -139,7 +139,7 @@ static char* account_following_cb(HV* session_hv,
static char* account_statuses_cb(HV* session_hv,
struct session* ssn,
mstdnt_t* api,
mastodont_t* api,
struct mstdnt_account* acct,
struct mstdnt_relationship* rel,
void* _args)
@ -179,7 +179,7 @@ static char* account_statuses_cb(HV* session_hv,
static char* account_scrobbles_cb(HV* session_hv,
struct session* ssn,
mstdnt_t* api,
mastodont_t* api,
struct mstdnt_account* acct,
struct mstdnt_relationship* rel,
void* _args)
@ -220,7 +220,7 @@ static char* account_scrobbles_cb(HV* session_hv,
return result;
}
void get_account_info(mstdnt_t* api, struct session* ssn)
void get_account_info(mastodont_t* api, struct session* ssn)
{
struct mstdnt_args m_args;
set_mstdnt_args(&m_args, ssn);
@ -245,11 +245,11 @@ void get_account_info(mstdnt_t* api, struct session* ssn)
*/
static void fetch_account_page(FCGX_Request* req,
struct session* ssn,
mstdnt_t* api,
mastodont_t* api,
char* id,
void* args,
enum account_tab tab,
char* (*callback)(HV* ssn_hv, struct session* ssn, mstdnt_t* api, struct mstdnt_account* acct, struct mstdnt_relationship* rel, void* args))
char* (*callback)(HV* ssn_hv, struct session* ssn, mastodont_t* api, struct mstdnt_account* acct, struct mstdnt_relationship* rel, void* args))
{
struct mstdnt_storage storage = { 0 },
relations_storage = { 0 };

View File

@ -56,7 +56,7 @@ struct account_page
struct mstdnt_relationship* relationship;
};
void get_account_info(mstdnt_t* api, struct session* ssn);
void get_account_info(mastodont_t* api, struct session* ssn);
void content_account_followers(PATH_ARGS);
void content_account_following(PATH_ARGS);

View File

@ -34,7 +34,7 @@ struct attachments_args
int try_upload_media(struct mstdnt_storage** storage,
struct session* ssn,
mstdnt_t* api,
mastodont_t* api,
struct mstdnt_attachment** attachments,
char*** media_ids)
{

View File

@ -29,7 +29,7 @@
int try_upload_media(struct mstdnt_storage** storage,
struct session* ssn,
mstdnt_t* api,
mastodont_t* api,
struct mstdnt_attachment** attachments,
char*** media_ids);
void cleanup_media_storages(struct session* ssn, struct mstdnt_storage* storage);

View File

@ -35,7 +35,7 @@
#define BODY_STYLE "style=\"background:url('%s');\""
void render_base_page(struct base_page* page, FCGX_Request* req, struct session* ssn, mstdnt_t* api)
void render_base_page(struct base_page* page, FCGX_Request* req, struct session* ssn, mastodont_t* api)
{
struct mstdnt_args m_args;
set_mstdnt_args(&m_args, ssn);

View File

@ -52,7 +52,7 @@ struct base_page
HV* session;
};
void render_base_page(struct base_page* page, FCGX_Request* req, struct session* ssn, mstdnt_t* api);
void render_base_page(struct base_page* page, FCGX_Request* req, struct session* ssn, mastodont_t* api);
/**
* Outputs HTML in format for CGI. This can only be called once!

View File

@ -21,7 +21,7 @@
#include "easprintf.h"
#include "l10n.h"
void content_not_found(FCGX_Request* req, struct session* ssn, mstdnt_t* api, char* path)
void content_not_found(FCGX_Request* req, struct session* ssn, mastodont_t* api, char* path)
{
struct base_page b = {
.content = "Content not found",

View File

@ -23,6 +23,6 @@
#include "session.h"
#include "path.h"
void content_not_found(FCGX_Request* req, struct session* ssn, mstdnt_t* api, char* path);
void content_not_found(FCGX_Request* req, struct session* ssn, mastodont_t* api, char* path);
#endif // ERROR_H

View File

@ -21,7 +21,7 @@
struct global_cache g_cache = { {} };
void load_instance_info_cache(mstdnt_t* api)
void load_instance_info_cache(mastodont_t* api)
{
struct mstdnt_args m_args = {
.url = config_instance_url,
@ -29,7 +29,7 @@ void load_instance_info_cache(mstdnt_t* api)
.flags = config_library_flags,
};
mstdnt_instance_panel(api, &m_args, &(g_cache.panel_html));
mstdnt_terms_of_service(api, &m_args, &(g_cache.tos_html));
mastodont_terms_of_service(api, &m_args, &(g_cache.tos_html));
}
void free_instance_info_cache()

View File

@ -28,7 +28,7 @@ struct global_cache
extern struct global_cache g_cache;
void load_instance_info_cache(mstdnt_t* api);
void load_instance_info_cache(mastodont_t* api);
void free_instance_info_cache();
#endif /* GLOBAL_CACHE_H */

View File

@ -19,7 +19,7 @@
#include <stdlib.h>
#include "timeline.h"
void content_index(FCGX_Request* req, struct session* ssn, mstdnt_t* api)
void content_index(FCGX_Request* req, struct session* ssn, mastodont_t* api)
{
// Check logins
content_tl_home(req, ssn, api, NULL);

View File

@ -21,6 +21,6 @@
#include <mastodont.h>
#include "session.h"
void content_index(FCGX_Request* req, struct session* ssn, mstdnt_t* api);
void content_index(FCGX_Request* req, struct session* ssn, mastodont_t* api);
#endif // INDEX_H

View File

@ -77,7 +77,7 @@ void set_config_int(FCGX_Request* req,
struct mstdnt_storage* load_config(FCGX_Request* req,
struct session* ssn,
mstdnt_t* api,
mastodont_t* api,
enum config_page page)
{
struct mstdnt_attachment* attachments = NULL;

View File

@ -81,7 +81,7 @@ void set_config_int(FCGX_Request* req,
*/
struct mstdnt_storage* load_config(FCGX_Request* req,
struct session* ssn,
mstdnt_t* api,
mastodont_t* api,
enum config_page page);
#endif // LOCAL_CONFIG_SET_H

View File

@ -125,7 +125,7 @@ static struct path_info paths[] = {
{ "/treebird_api/v1/attachment", api_attachment_create },
};
static void application(mstdnt_t* api, REQUEST_T req)
static void application(mastodont_t* api, REQUEST_T req)
{
// Default config
struct session ssn = {
@ -187,7 +187,7 @@ static void application(mstdnt_t* api, REQUEST_T req)
#ifndef SINGLE_THREADED
static void* threaded_fcgi_start(void* arg)
{
mstdnt_t* api = arg;
mastodont_t* api = arg;
int rc;
FCGX_Request req;
FCGX_InitRequest(&req, 0, 0);
@ -209,7 +209,7 @@ static void* threaded_fcgi_start(void* arg)
return NULL;
}
#else
void cgi_start(mstdnt_t* api)
void cgi_start(mastodont_t* api)
{
while (FCGI_Accept() >= 0 && quit == 0)
{
@ -260,7 +260,7 @@ int main(int argc, char **argv, char **env)
mstdnt_set_hooks(&hooks);
// Initiate mstdnt library
mstdnt_t api;
mastodont_t api;
mstdnt_init(&api);
// Fetch information about the current instance
load_instance_info_cache(&api);

View File

@ -25,7 +25,7 @@
int parse_path(REQUEST_T req,
struct session* ssn,
mstdnt_t* api,
mastodont_t* api,
struct path_info* path_info)
{
int res = 0;
@ -103,7 +103,7 @@ breakpt:
void handle_paths(REQUEST_T req,
struct session* ssn,
mstdnt_t* api,
mastodont_t* api,
struct path_info* paths,
size_t paths_len)
{

View File

@ -25,7 +25,7 @@
#include "cgi.h"
#include "request.h"
#define PATH_ARGS REQUEST_T req, struct session* ssn, mstdnt_t* api, char** data
#define PATH_ARGS REQUEST_T req, struct session* ssn, mastodont_t* api, char** data
struct path_info
{
@ -36,13 +36,13 @@ struct path_info
void handle_paths(
REQUEST_T req,
struct session* ssn,
mstdnt_t* api,
mastodont_t* api,
struct path_info* paths,
size_t paths_len);
int parse_path(REQUEST_T req,
struct session* ssn,
mstdnt_t* api,
mastodont_t* api,
struct path_info* path_info);
#endif // PATH_H

View File

@ -40,7 +40,7 @@
#define ACCOUNT_INTERACTIONS_LIMIT 11
#define NUM_STR "%u"
int try_post_status(struct session* ssn, mstdnt_t* api)
int try_post_status(struct session* ssn, mastodont_t* api)
{
if (!(keystr(ssn->post.content))) return 1;
struct mstdnt_args m_args;
@ -119,7 +119,7 @@ int try_post_status(struct session* ssn, mstdnt_t* api)
return 0;
}
int try_react_status(struct session* ssn, mstdnt_t* api, char* id, char* emoji)
int try_react_status(struct session* ssn, mastodont_t* api, char* id, char* emoji)
{
struct mstdnt_args m_args;
set_mstdnt_args(&m_args, ssn);
@ -151,7 +151,7 @@ void content_status_react(PATH_ARGS)
redirect(req, REDIRECT_303, referer);
}
int try_interact_status(struct session* ssn, mstdnt_t* api, char* id)
int try_interact_status(struct session* ssn, mastodont_t* api, char* id)
{
struct mstdnt_args m_args;
set_mstdnt_args(&m_args, ssn);
@ -190,7 +190,7 @@ int try_interact_status(struct session* ssn, mstdnt_t* api, char* id)
return res;
}
char* get_in_reply_to(mstdnt_t* api,
char* get_in_reply_to(mastodont_t* api,
struct session* ssn,
struct mstdnt_status* status,
size_t* size)
@ -308,7 +308,7 @@ void status_view_favourites(PATH_ARGS)
void content_status_interactions(FCGX_Request* req,
struct session* ssn,
mstdnt_t* api,
mastodont_t* api,
char* label,
struct mstdnt_account* accts,
size_t accts_len)

View File

@ -47,8 +47,8 @@ struct interact_profile_args
size_t favourites_len;
};
int try_post_status(struct session* ssn, mstdnt_t* api);
int try_interact_status(struct session* ssn, mstdnt_t* api, char* id);
int try_post_status(struct session* ssn, mastodont_t* api);
int try_interact_status(struct session* ssn, mastodont_t* api, char* id);
void content_status_create(PATH_ARGS);
void content_status_react(PATH_ARGS);
@ -56,7 +56,7 @@ void content_status_react(PATH_ARGS);
// Reply to
/** Deprecated: May be used in the future for Mastodon only */
char* get_in_reply_to(mstdnt_t* api,
char* get_in_reply_to(mastodont_t* api,
struct session* ssn,
struct mstdnt_status* status,
size_t* size);
@ -66,7 +66,7 @@ void status_view_favourites(PATH_ARGS);
void content_status_interactions(FCGX_Request* req,
struct session* ssn,
mstdnt_t* api,
mastodont_t* api,
char* label,
struct mstdnt_account* accts,
size_t accts_len);

View File

@ -32,7 +32,7 @@
void content_timeline(REQUEST_T req,
struct session* ssn,
mstdnt_t* api,
mastodont_t* api,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses,
size_t statuses_len,
@ -78,7 +78,7 @@ void content_timeline(REQUEST_T req,
Safefree(dup);
}
void tl_home(REQUEST_T req, struct session* ssn, mstdnt_t* api, int local)
void tl_home(REQUEST_T req, struct session* ssn, mastodont_t* api, int local)
{
struct mstdnt_args m_args = { 0 };
set_mstdnt_args(&m_args, ssn);
@ -86,7 +86,7 @@ void tl_home(REQUEST_T req, struct session* ssn, mstdnt_t* api, int local)
struct mstdnt_status* statuses = NULL;
struct mstdnt_storage storage = { 0 };
struct mstdnt_timeline_args args = {
struct mastodont_timeline_args args = {
.with_muted = MSTDNT_TRUE,
.local = local,
// Converts to `enum mstdnt_reply_visibility' nicely
@ -104,12 +104,12 @@ void tl_home(REQUEST_T req, struct session* ssn, mstdnt_t* api, int local)
try_post_status(ssn, api);
mstdnt_timeline_home(api, &m_args, &args, &storage, &statuses, &statuses_len);
mastodont_timeline_home(api, &m_args, &args, &storage, &statuses, &statuses_len);
content_timeline(req, ssn, api, &storage, statuses, statuses_len, BASE_CAT_HOME, NULL, 1, 0);
}
void tl_direct(REQUEST_T req, struct session* ssn, mstdnt_t* api)
void tl_direct(REQUEST_T req, struct session* ssn, mastodont_t* api)
{
struct mstdnt_args m_args = { 0 };
set_mstdnt_args(&m_args, ssn);
@ -117,7 +117,7 @@ void tl_direct(REQUEST_T req, struct session* ssn, mstdnt_t* api)
struct mstdnt_status* statuses = NULL;
struct mstdnt_storage storage = { 0 };
struct mstdnt_timeline_args args = {
struct mastodont_timeline_args args = {
.with_muted = 1,
.max_id = keystr(ssn->post.max_id),
// Converts to `enum mstdnt_reply_visibility' nicely
@ -132,12 +132,12 @@ void tl_direct(REQUEST_T req, struct session* ssn, mstdnt_t* api)
try_post_status(ssn, api);
mstdnt_timeline_direct(api, &m_args, &args, &storage, &statuses, &statuses_len);
mastodont_timeline_direct(api, &m_args, &args, &storage, &statuses, &statuses_len);
content_timeline(req, ssn, api, &storage, statuses, statuses_len, BASE_CAT_DIRECT, "Direct", 0, 0);
}
void tl_public(REQUEST_T req, struct session* ssn, mstdnt_t* api, int local, enum base_category cat)
void tl_public(REQUEST_T req, struct session* ssn, mastodont_t* api, int local, enum base_category cat)
{
struct mstdnt_args m_args = { 0 };
set_mstdnt_args(&m_args, ssn);
@ -145,7 +145,7 @@ void tl_public(REQUEST_T req, struct session* ssn, mstdnt_t* api, int local, enu
struct mstdnt_status* statuses = NULL;
struct mstdnt_storage storage = { 0 };
struct mstdnt_timeline_args args = {
struct mastodont_timeline_args args = {
.with_muted = MSTDNT_TRUE,
.local = local ? MSTDNT_TRUE : MSTDNT_FALSE,
.remote = 0,
@ -162,12 +162,12 @@ void tl_public(REQUEST_T req, struct session* ssn, mstdnt_t* api, int local, enu
try_post_status(ssn, api);
mstdnt_timeline_public(api, &m_args, &args, &storage, &statuses, &statuses_len);
mastodont_timeline_public(api, &m_args, &args, &storage, &statuses, &statuses_len);
content_timeline(req, ssn, api, &storage, statuses, statuses_len, cat, NULL, 1, 0);
}
void tl_list(REQUEST_T req, struct session* ssn, mstdnt_t* api, char* list_id)
void tl_list(REQUEST_T req, struct session* ssn, mastodont_t* api, char* list_id)
{
struct mstdnt_args m_args;
set_mstdnt_args(&m_args, ssn);
@ -175,7 +175,7 @@ void tl_list(REQUEST_T req, struct session* ssn, mstdnt_t* api, char* list_id)
struct mstdnt_status* statuses = NULL;
struct mstdnt_storage storage = { 0 };
struct mstdnt_timeline_args args = {
struct mastodont_timeline_args args = {
.max_id = keystr(ssn->post.max_id),
.since_id = NULL,
// Converts to `enum mstdnt_reply_visibility' nicely
@ -189,13 +189,13 @@ void tl_list(REQUEST_T req, struct session* ssn, mstdnt_t* api, char* list_id)
try_post_status(ssn, api);
mstdnt_timeline_list(api, &m_args, list_id, &args, &storage, &statuses, &statuses_len);
mastodont_timeline_list(api, &m_args, list_id, &args, &storage, &statuses, &statuses_len);
content_timeline(req, ssn, api, &storage, statuses, statuses_len, BASE_CAT_LISTS, "List timeline", 0, 0);
}
void tl_tag(REQUEST_T req, struct session* ssn, mstdnt_t* api, char* tag_id)
void tl_tag(REQUEST_T req, struct session* ssn, mastodont_t* api, char* tag_id)
{
struct mstdnt_args m_args;
set_mstdnt_args(&m_args, ssn);
@ -204,7 +204,7 @@ void tl_tag(REQUEST_T req, struct session* ssn, mstdnt_t* api, char* tag_id)
struct mstdnt_status* statuses = NULL;
struct mstdnt_storage storage = { 0 };
struct mstdnt_timeline_args args = {
struct mastodont_timeline_args args = {
.max_id = keystr(ssn->post.max_id),
.since_id = NULL,
// Converts to `enum mstdnt_reply_visibility' nicely
@ -216,7 +216,7 @@ void tl_tag(REQUEST_T req, struct session* ssn, mstdnt_t* api, char* tag_id)
.limit = 20,
};
mstdnt_timeline_tag(api, &m_args, tag_id, &args, &storage, &statuses, &statuses_len);
mastodont_timeline_tag(api, &m_args, tag_id, &args, &storage, &statuses, &statuses_len);
easprintf(&header, "Hashtag - #%s", tag_id);

View File

@ -27,19 +27,19 @@
#include "request.h"
/** Wrapper for content_tl_federated */
void tl_home(REQUEST_T req, struct session* ssn, mstdnt_t* api, int local);
void tl_home(REQUEST_T req, struct session* ssn, mastodont_t* api, int local);
/** Wrapper for content_tl_direct */
void tl_direct(REQUEST_T req, struct session* ssn, mstdnt_t* api);
void tl_direct(REQUEST_T req, struct session* ssn, mastodont_t* api);
/** Wrapper for content_tl_federated */
void tl_public(REQUEST_T req, struct session* ssn, mstdnt_t* api, int local, enum base_category cat);
void tl_public(REQUEST_T req, struct session* ssn, mastodont_t* api, int local, enum base_category cat);
/** Wrapper for content_tl_list */
void tl_list(REQUEST_T req, struct session* ssn, mstdnt_t* api, char* list_id);
void tl_list(REQUEST_T req, struct session* ssn, mastodont_t* api, char* list_id);
/** Wrapper for content_tl_tag */
void tl_tag(REQUEST_T req, struct session* ssn, mstdnt_t* api, char* tag);
void tl_tag(REQUEST_T req, struct session* ssn, mastodont_t* api, char* tag);
/* ------------------------------------------------ */
@ -80,7 +80,7 @@ void content_tl_tag(PATH_ARGS);
*/
void content_timeline(REQUEST_T req,
struct session* ssn,
mstdnt_t* api,
mastodont_t* api,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses,
size_t statuses_len,