From 9f44fa862347d6cd7c84f8fdf5ca76a8897bc6c2 Mon Sep 17 00:00:00 2001 From: nekobit Date: Sat, 15 Oct 2022 21:34:09 +0000 Subject: [PATCH] Change FossilOrigin-Name: 5a89b703b94bb8ce089d448ef9c0044b97b73ef3c411b499d4aadf96ac786130 --- src/account.c | 18 +++++++++--------- src/account.h | 2 +- src/attachments.c | 2 +- src/attachments.h | 2 +- src/base_page.c | 2 +- src/base_page.h | 2 +- src/error.c | 2 +- src/error.h | 2 +- src/global_cache.c | 4 ++-- src/global_cache.h | 2 +- src/index.c | 2 +- src/index.h | 2 +- src/local_config_set.c | 2 +- src/local_config_set.h | 2 +- src/main.c | 8 ++++---- src/path.c | 4 ++-- src/path.h | 6 +++--- src/status.c | 10 +++++----- src/status.h | 8 ++++---- src/timeline.c | 32 ++++++++++++++++---------------- src/timeline.h | 12 ++++++------ 21 files changed, 63 insertions(+), 63 deletions(-) diff --git a/src/account.c b/src/account.c index 991b867..551626f 100644 --- a/src/account.c +++ b/src/account.c @@ -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 }; diff --git a/src/account.h b/src/account.h index 78e53f5..97876b4 100644 --- a/src/account.h +++ b/src/account.h @@ -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); diff --git a/src/attachments.c b/src/attachments.c index 3401d24..4eae6c6 100644 --- a/src/attachments.c +++ b/src/attachments.c @@ -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) { diff --git a/src/attachments.h b/src/attachments.h index 04af4b1..131b3da 100644 --- a/src/attachments.h +++ b/src/attachments.h @@ -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); diff --git a/src/base_page.c b/src/base_page.c index aab45fe..30f0476 100644 --- a/src/base_page.c +++ b/src/base_page.c @@ -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); diff --git a/src/base_page.h b/src/base_page.h index bc197af..b71f5f5 100644 --- a/src/base_page.h +++ b/src/base_page.h @@ -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! diff --git a/src/error.c b/src/error.c index c8b1c10..679e14e 100644 --- a/src/error.c +++ b/src/error.c @@ -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", diff --git a/src/error.h b/src/error.h index 0b9d0bc..cde3547 100644 --- a/src/error.h +++ b/src/error.h @@ -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 diff --git a/src/global_cache.c b/src/global_cache.c index 692f477..3a45526 100644 --- a/src/global_cache.c +++ b/src/global_cache.c @@ -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() diff --git a/src/global_cache.h b/src/global_cache.h index 82a0de8..ff9d3b0 100644 --- a/src/global_cache.h +++ b/src/global_cache.h @@ -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 */ diff --git a/src/index.c b/src/index.c index aae73d6..6dc5722 100644 --- a/src/index.c +++ b/src/index.c @@ -19,7 +19,7 @@ #include #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); diff --git a/src/index.h b/src/index.h index f0164c4..8ed4c61 100644 --- a/src/index.h +++ b/src/index.h @@ -21,6 +21,6 @@ #include #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 diff --git a/src/local_config_set.c b/src/local_config_set.c index 06d7382..595f6d0 100644 --- a/src/local_config_set.c +++ b/src/local_config_set.c @@ -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; diff --git a/src/local_config_set.h b/src/local_config_set.h index 5ad65aa..63fc447 100644 --- a/src/local_config_set.h +++ b/src/local_config_set.h @@ -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 diff --git a/src/main.c b/src/main.c index 003b619..42945db 100644 --- a/src/main.c +++ b/src/main.c @@ -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); diff --git a/src/path.c b/src/path.c index 2a0a751..2956e2f 100644 --- a/src/path.c +++ b/src/path.c @@ -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) { diff --git a/src/path.h b/src/path.h index f98fb3c..407e0ab 100644 --- a/src/path.h +++ b/src/path.h @@ -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 diff --git a/src/status.c b/src/status.c index 61c713b..fa18c47 100644 --- a/src/status.c +++ b/src/status.c @@ -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) diff --git a/src/status.h b/src/status.h index 6af1833..f90648c 100644 --- a/src/status.h +++ b/src/status.h @@ -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); diff --git a/src/timeline.c b/src/timeline.c index db080c1..6a5978f 100644 --- a/src/timeline.c +++ b/src/timeline.c @@ -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); diff --git a/src/timeline.h b/src/timeline.h index 152c2d4..a4e58f4 100644 --- a/src/timeline.h +++ b/src/timeline.h @@ -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,