Follow new mastodont naming convention

FossilOrigin-Name: f19ecee41392fe5ebc04f1a11a13bba2833c6f3eb2ebca1b310b5ceb3199b95b
This commit is contained in:
nekobit 2022-10-14 13:39:44 +00:00
parent 4733000997
commit 115acd3231
26 changed files with 164 additions and 164 deletions

View File

@ -38,13 +38,13 @@
struct account_args
{
mastodont_t* api;
mstdnt_t* api;
struct mstdnt_account* accts;
uint8_t flags;
};
static char* accounts_page(HV* session_hv,
mastodont_t* api,
mstdnt_t* api,
struct mstdnt_account* acct,
struct mstdnt_relationship* rel,
char* header,
@ -76,14 +76,14 @@ static char* accounts_page(HV* session_hv,
output = PERL_GET_STACK_EXIT;
mastodont_storage_cleanup(storage);
mstdnt_storage_cleanup(storage);
mstdnt_cleanup_accounts(accts, accts_len);
return output;
}
static char* account_followers_cb(HV* session_hv,
struct session* ssn,
mastodont_t* api,
mstdnt_t* api,
struct mstdnt_account* acct,
struct mstdnt_relationship* rel,
void* _args)
@ -104,14 +104,14 @@ static char* account_followers_cb(HV* session_hv,
.with_relationships = 0,
};
mastodont_get_followers(api, &m_args, acct->id, &args, &storage, &accounts, &accts_len);
mstdnt_get_followers(api, &m_args, acct->id, &args, &storage, &accounts, &accts_len);
return accounts_page(session_hv, api, acct, rel, NULL, &storage, accounts, accts_len);
}
static char* account_following_cb(HV* session_hv,
struct session* ssn,
mastodont_t* api,
mstdnt_t* api,
struct mstdnt_account* acct,
struct mstdnt_relationship* rel,
void* _args)
@ -132,14 +132,14 @@ static char* account_following_cb(HV* session_hv,
.with_relationships = 0,
};
mastodont_get_following(api, &m_args, acct->id, &args, &storage, &accounts, &accts_len);
mstdnt_get_following(api, &m_args, acct->id, &args, &storage, &accounts, &accts_len);
return accounts_page(session_hv, api, acct, rel, NULL, &storage, accounts, accts_len);
}
static char* account_statuses_cb(HV* session_hv,
struct session* ssn,
mastodont_t* api,
mstdnt_t* api,
struct mstdnt_account* acct,
struct mstdnt_relationship* rel,
void* _args)
@ -153,7 +153,7 @@ static char* account_statuses_cb(HV* session_hv,
size_t statuses_len = 0;
char* result;
mastodont_get_account_statuses(api, &m_args, acct->id, args, &storage, &statuses, &statuses_len);
mstdnt_get_account_statuses(api, &m_args, acct->id, args, &storage, &statuses, &statuses_len);
PERL_STACK_INIT;
XPUSHs(newRV_noinc((SV*)session_hv));
@ -171,7 +171,7 @@ static char* account_statuses_cb(HV* session_hv,
result = PERL_GET_STACK_EXIT;
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
mstdnt_cleanup_statuses(statuses, statuses_len);
return result;
@ -179,7 +179,7 @@ static char* account_statuses_cb(HV* session_hv,
static char* account_scrobbles_cb(HV* session_hv,
struct session* ssn,
mastodont_t* api,
mstdnt_t* api,
struct mstdnt_account* acct,
struct mstdnt_relationship* rel,
void* _args)
@ -198,7 +198,7 @@ static char* account_scrobbles_cb(HV* session_hv,
.offset = 0,
.limit = 20
};
mastodont_get_scrobbles(api, &m_args, acct->id, &args, &storage, &scrobbles, &scrobbles_len);
mstdnt_get_scrobbles(api, &m_args, acct->id, &args, &storage, &scrobbles, &scrobbles_len);
PERL_STACK_INIT;
XPUSHs(newRV_noinc((SV*)session_hv));
@ -216,15 +216,15 @@ static char* account_scrobbles_cb(HV* session_hv,
result = PERL_GET_STACK_EXIT;
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
return result;
}
void get_account_info(mastodont_t* api, struct session* ssn)
void get_account_info(mstdnt_t* api, struct session* ssn)
{
struct mstdnt_args m_args;
set_mstdnt_args(&m_args, ssn);
if (ssn->cookies.access_token.is_set && mastodont_verify_credentials(api, &m_args, &(ssn->acct), &(ssn->acct_storage)) == 0)
if (ssn->cookies.access_token.is_set && mstdnt_verify_credentials(api, &m_args, &(ssn->acct), &(ssn->acct_storage)) == 0)
{
ssn->logged_in = 1;
}
@ -245,11 +245,11 @@ void get_account_info(mastodont_t* api, struct session* ssn)
*/
static void fetch_account_page(FCGX_Request* req,
struct session* ssn,
mastodont_t* api,
mstdnt_t* api,
char* id,
void* args,
enum account_tab tab,
char* (*callback)(HV* ssn_hv, struct session* ssn, mastodont_t* api, struct mstdnt_account* acct, struct mstdnt_relationship* rel, void* args))
char* (*callback)(HV* ssn_hv, struct session* ssn, mstdnt_t* api, struct mstdnt_account* acct, struct mstdnt_relationship* rel, void* args))
{
struct mstdnt_storage storage = { 0 },
relations_storage = { 0 };
@ -261,9 +261,9 @@ static void fetch_account_page(FCGX_Request* req,
int lookup_type = config_experimental_lookup ? MSTDNT_LOOKUP_ACCT : MSTDNT_LOOKUP_ID;
mastodont_get_account(api, &m_args, lookup_type, id, &acct, &storage);
mstdnt_get_account(api, &m_args, lookup_type, id, &acct, &storage);
// Relationships may fail
mastodont_get_relationships(api, &m_args, &(acct.id), 1, &relations_storage, &relationships, &relationships_len);
mstdnt_get_relationships(api, &m_args, &(acct.id), 1, &relations_storage, &relationships, &relationships_len);
HV* session_hv = perlify_session(ssn);
@ -281,8 +281,8 @@ static void fetch_account_page(FCGX_Request* req,
/* Output */
mstdnt_cleanup_account(&acct);
mstdnt_cleanup_relationships(relationships);
mastodont_storage_cleanup(&storage);
mastodont_storage_cleanup(&relations_storage);
mstdnt_storage_cleanup(&storage);
mstdnt_storage_cleanup(&relations_storage);
Safefree(data);
}
@ -367,23 +367,23 @@ void content_account_action(PATH_ARGS)
struct mstdnt_relationship acct = { 0 };
if (strcmp(data[1], "follow") == 0)
mastodont_follow_account(api, &m_args, data[0], &storage, &acct);
mstdnt_follow_account(api, &m_args, data[0], &storage, &acct);
else if (strcmp(data[1], "unfollow") == 0)
mastodont_unfollow_account(api, &m_args, data[0], &storage, &acct);
mstdnt_unfollow_account(api, &m_args, data[0], &storage, &acct);
else if (strcmp(data[1], "mute") == 0)
mastodont_mute_account(api, &m_args, data[0], &storage, &acct);
mstdnt_mute_account(api, &m_args, data[0], &storage, &acct);
else if (strcmp(data[1], "unmute") == 0)
mastodont_unmute_account(api, &m_args, data[0], &storage, &acct);
mstdnt_unmute_account(api, &m_args, data[0], &storage, &acct);
else if (strcmp(data[1], "block") == 0)
mastodont_block_account(api, &m_args, data[0], &storage, &acct);
mstdnt_block_account(api, &m_args, data[0], &storage, &acct);
else if (strcmp(data[1], "unblock") == 0)
mastodont_unblock_account(api, &m_args, data[0], &storage, &acct);
mstdnt_unblock_account(api, &m_args, data[0], &storage, &acct);
else if (strcmp(data[1], "subscribe") == 0)
mastodont_subscribe_account(api, &m_args, data[0], &storage, &acct);
mstdnt_subscribe_account(api, &m_args, data[0], &storage, &acct);
else if (strcmp(data[1], "unsubscribe") == 0)
mastodont_unsubscribe_account(api, &m_args, data[0], &storage, &acct);
mstdnt_unsubscribe_account(api, &m_args, data[0], &storage, &acct);
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
redirect(req, REDIRECT_303, referer);
}
@ -402,7 +402,7 @@ void content_account_bookmarks(PATH_ARGS)
struct mstdnt_args m_args;
set_mstdnt_args(&m_args, ssn);
mastodont_get_bookmarks(api, &m_args, &args, &storage, &statuses, &statuses_len);
mstdnt_get_bookmarks(api, &m_args, &args, &storage, &statuses, &statuses_len);
content_timeline(req, ssn, api, &storage, statuses, statuses_len, BASE_CAT_BOOKMARKS, "Bookmarks", 0, 1);
}
@ -423,7 +423,7 @@ void content_account_blocked(PATH_ARGS)
struct mstdnt_args m_args;
set_mstdnt_args(&m_args, ssn);
mastodont_get_blocks(api, &m_args, &args, &storage, &accts, &accts_len);
mstdnt_get_blocks(api, &m_args, &args, &storage, &accts, &accts_len);
HV* session_hv = perlify_session(ssn);
char* result = accounts_page(session_hv, api, NULL, NULL, "Blocked users", &storage, accts, accts_len);
@ -455,7 +455,7 @@ void content_account_muted(PATH_ARGS)
struct mstdnt_args m_args;
set_mstdnt_args(&m_args, ssn);
mastodont_get_mutes(api, &m_args, &args, &storage, &accts, &accts_len);
mstdnt_get_mutes(api, &m_args, &args, &storage, &accts, &accts_len);
HV* session_hv = perlify_session(ssn);
char* result = accounts_page(session_hv, api, NULL, NULL, "Muted users", &storage, accts, accts_len);
@ -484,7 +484,7 @@ void content_account_favourites(PATH_ARGS)
.limit = 20,
};
mastodont_get_favourites(api, &m_args, &args, &storage, &statuses, &statuses_len);
mstdnt_get_favourites(api, &m_args, &args, &storage, &statuses, &statuses_len);
content_timeline(req, ssn, api, &storage, statuses, statuses_len, BASE_CAT_BOOKMARKS, "Favorites", 0, 1);
}

View File

@ -56,7 +56,7 @@ struct account_page
struct mstdnt_relationship* relationship;
};
void get_account_info(mastodont_t* api, struct session* ssn);
void get_account_info(mstdnt_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,
mastodont_t* api,
mstdnt_t* api,
struct mstdnt_attachment** attachments,
char*** media_ids)
{
@ -64,7 +64,7 @@ int try_upload_media(struct mstdnt_storage** storage,
.description = NULL,
};
if (mastodont_upload_media(api,
if (mstdnt_upload_media(api,
&m_args,
&args,
*storage + i,
@ -73,7 +73,7 @@ int try_upload_media(struct mstdnt_storage** storage,
for (size_t j = 0; j < i; ++j)
{
if (media_ids) free((*media_ids)[j]);
mastodont_storage_cleanup(*storage + j);
mstdnt_storage_cleanup(*storage + j);
}
if (media_ids)
@ -103,7 +103,7 @@ void cleanup_media_storages(struct session* ssn, struct mstdnt_storage* storage)
{
if (!FILES_READY(ssn)) return;
for (size_t i = 0; i < keyfile(ssn->post.files).array_size; ++i)
mastodont_storage_cleanup(storage + i);
mstdnt_storage_cleanup(storage + i);
free(storage);
}

View File

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

View File

@ -32,7 +32,7 @@
#define BODY_STYLE "style=\"background:url('%s');\""
void render_base_page(struct base_page* page, FCGX_Request* req, struct session* ssn, mastodont_t* api)
void render_base_page(struct base_page* page, FCGX_Request* req, struct session* ssn, mstdnt_t* api)
{
struct mstdnt_args m_args;
set_mstdnt_args(&m_args, ssn);
@ -57,7 +57,7 @@ void render_base_page(struct base_page* page, FCGX_Request* req, struct session*
.limit = 8,
};
mastodont_get_notifications(
mstdnt_get_notifications(
api,
&m_args,
&args,
@ -88,7 +88,7 @@ void render_base_page(struct base_page* page, FCGX_Request* req, struct session*
send_result(req, NULL, "text/html", dup, 0);
mstdnt_cleanup_notifications(notifs, notifs_len);
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
Safefree(dup);
}

View File

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

View File

@ -43,7 +43,7 @@ void content_chats(PATH_ARGS)
.limit = 20,
};
mastodont_get_chats_v2(api, &m_args, &args, &storage, &chats, &chats_len);
mstdnt_get_chats_v2(api, &m_args, &args, &storage, &chats, &chats_len);
PERL_STACK_INIT;
HV* session_hv = perlify_session(ssn);
@ -69,7 +69,7 @@ void content_chats(PATH_ARGS)
render_base_page(&b, req, ssn, api);
// Cleanup
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
mstdnt_cleanup_chats(chats, chats_len);
Safefree(dup);
}
@ -93,8 +93,8 @@ void content_chat_view(PATH_ARGS)
.limit = 20,
};
mastodont_get_chat_messages(api, &m_args, data[0], &args, &storage, &messages, &messages_len);
int chat_code = mastodont_get_chat(api, &m_args, data[0],
mstdnt_get_chat_messages(api, &m_args, data[0], &args, &storage, &messages, &messages_len);
int chat_code = mstdnt_get_chat(api, &m_args, data[0],
&storage_chat, &chat);
PERL_STACK_INIT;
@ -123,8 +123,8 @@ void content_chat_view(PATH_ARGS)
// Output
render_base_page(&b, req, ssn, api);
mastodont_storage_cleanup(&storage);
mastodont_storage_cleanup(&storage_chat);
mstdnt_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage_chat);
mstdnt_cleanup_chat(&chat);
mstdnt_cleanup_messages(messages);
Safefree(dup);

View File

@ -21,7 +21,7 @@
#include "easprintf.h"
#include "l10n.h"
void content_not_found(FCGX_Request* req, struct session* ssn, mastodont_t* api, char* path)
void content_not_found(FCGX_Request* req, struct session* ssn, mstdnt_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, mastodont_t* api, char* path);
void content_not_found(FCGX_Request* req, struct session* ssn, mstdnt_t* api, char* path);
#endif // ERROR_H

View File

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

View File

@ -18,7 +18,7 @@
#ifndef GLOBAL_CACHE_H
#define GLOBAL_CACHE_H
#include "mastodont.h"
#include <mastodont.h>
struct global_cache
{
@ -28,7 +28,7 @@ struct global_cache
extern struct global_cache g_cache;
void load_instance_info_cache(mastodont_t* api);
void load_instance_info_cache(mstdnt_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, mastodont_t* api)
void content_index(FCGX_Request* req, struct session* ssn, mstdnt_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, mastodont_t* api);
void content_index(FCGX_Request* req, struct session* ssn, mstdnt_t* api);
#endif // INDEX_H

View File

@ -45,11 +45,11 @@ void content_lists(PATH_ARGS)
.title = keystr(ssn->post.title),
.replies_policy = MSTDNT_LIST_REPLIES_POLICY_LIST,
};
mastodont_create_list(api, &m_args, &args, &create_storage, NULL);
mastodont_storage_cleanup(&create_storage);
mstdnt_create_list(api, &m_args, &args, &create_storage, NULL);
mstdnt_storage_cleanup(&create_storage);
}
mastodont_get_lists(api, &m_args, &storage, &lists, &lists_len);
mstdnt_get_lists(api, &m_args, &storage, &lists, &lists_len);
PERL_STACK_INIT;
HV* session_hv = perlify_session(ssn);
@ -74,7 +74,7 @@ void content_lists(PATH_ARGS)
render_base_page(&b, req, ssn, api);
// Cleanup
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
mstdnt_cleanup_lists(lists);
Safefree(dup);
}
@ -92,7 +92,7 @@ void list_edit(PATH_ARGS)
.replies_policy = keyint(ssn->post.replies_policy)
};
mastodont_update_list(api,
mstdnt_update_list(api,
&m_args,
id,
&args,
@ -100,7 +100,7 @@ void list_edit(PATH_ARGS)
NULL);
redirect(req, REDIRECT_303, referer);
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
}
HV* perlify_list(const struct mstdnt_list* list)

View File

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

View File

@ -75,13 +75,13 @@ void set_config_int(FCGX_Request* req,
* Loads the config and sets the values based on POST or session
*
* @param ssn The session
* @param api mastodont-c api
* @param api mstdnt-c api
* @param page Page enum, to ensure that config changes on different pages don't effect other cookies
* @return Storage if files were uploaded, must free. This might change
*/
struct mstdnt_storage* load_config(FCGX_Request* req,
struct session* ssn,
mastodont_t* api,
mstdnt_t* api,
enum config_page page);
#endif // LOCAL_CONFIG_SET_H

View File

@ -67,7 +67,7 @@ void content_login_oauth(PATH_ARGS)
.code = keystr(ssn->query.code),
};
if (mastodont_obtain_oauth_token(api,
if (mstdnt_obtain_oauth_token(api,
&m_args,
&args_token,
&oauth_storage,
@ -88,7 +88,7 @@ void content_login_oauth(PATH_ARGS)
.website = keystr(ssn->post.instance)
};
if (mastodont_register_app(api,
if (mstdnt_register_app(api,
&m_args,
&args_app,
&storage,
@ -115,8 +115,8 @@ void content_login_oauth(PATH_ARGS)
redirect(req, REDIRECT_303, config_url_prefix &&
config_url_prefix[0] != '\0' ? config_url_prefix : "/");
mastodont_storage_cleanup(&storage);
mastodont_storage_cleanup(&oauth_storage);
mstdnt_storage_cleanup(&storage);
mstdnt_storage_cleanup(&oauth_storage);
if (urlify_redirect_url) free(urlify_redirect_url);
if (decode_url) curl_free(decode_url);
}
@ -159,7 +159,7 @@ void content_login(PATH_ARGS)
m_args.url = config_instance_url;
}
if (mastodont_register_app(api, &m_args, &args_app, &storage, &app) != 0)
if (mstdnt_register_app(api, &m_args, &args_app, &storage, &app) != 0)
{
// error = construct_error(oauth_store.error, E_ERROR, 1, NULL);
}
@ -175,7 +175,7 @@ void content_login(PATH_ARGS)
.password = keystr(ssn->post.password)
};
if (mastodont_obtain_oauth_token(api,
if (mstdnt_obtain_oauth_token(api,
&m_args,
&args_token,
&oauth_store,
@ -226,7 +226,7 @@ void content_login(PATH_ARGS)
render_base_page(&b, req, ssn, api);
// Cleanup
mastodont_storage_cleanup(&storage);
mastodont_storage_cleanup(&oauth_store);
mstdnt_storage_cleanup(&storage);
mstdnt_storage_cleanup(&oauth_store);
Safefree(page);
}

View File

@ -127,7 +127,7 @@ static struct path_info paths[] = {
{ "/treebird_api/v1/attachment", api_attachment_create },
};
static void application(mastodont_t* api, REQUEST_T req)
static void application(mstdnt_t* api, REQUEST_T req)
{
// Default config
struct session ssn = {
@ -181,7 +181,7 @@ static void application(mastodont_t* api, REQUEST_T req)
if (get_str) free(get_str);
free_files(&(keyfile(ssn.post.files)));
if (ssn.logged_in) mstdnt_cleanup_account(&(ssn.acct));
mastodont_storage_cleanup(&(ssn.acct_storage));
mstdnt_storage_cleanup(&(ssn.acct_storage));
if (attachments)
cleanup_media_storages(&ssn, attachments);
}
@ -189,7 +189,7 @@ static void application(mastodont_t* api, REQUEST_T req)
#ifndef SINGLE_THREADED
static void* threaded_fcgi_start(void* arg)
{
mastodont_t* api = arg;
mstdnt_t* api = arg;
int rc;
FCGX_Request req;
FCGX_InitRequest(&req, 0, 0);
@ -211,7 +211,7 @@ static void* threaded_fcgi_start(void* arg)
return NULL;
}
#else
void cgi_start(mastodont_t* api)
void cgi_start(mstdnt_t* api)
{
while (FCGI_Accept() >= 0 && quit == 0)
{
@ -232,7 +232,7 @@ void xs_init(pTHX)
int main(int argc, char **argv, char **env)
{
// Global init
mastodont_global_curl_init();
mstdnt_global_curl_init();
#ifndef SINGLE_THREADED
FCGX_Init();
#endif
@ -251,9 +251,9 @@ int main(int argc, char **argv, char **env)
init_template_files(aTHX);
// Initiate mastodont library
mastodont_t api;
mastodont_init(&api);
// Initiate mstdnt library
mstdnt_t api;
mstdnt_init(&api);
// Fetch information about the current instance
load_instance_info_cache(&api);
@ -276,8 +276,8 @@ int main(int argc, char **argv, char **env)
#endif
free_instance_info_cache();
mastodont_global_curl_cleanup();
mastodont_cleanup(&api);
mstdnt_global_curl_cleanup();
mstdnt_cleanup(&api);
cleanup_template_files();

View File

@ -54,7 +54,7 @@ void content_notifications(PATH_ARGS)
};
if (keystr(ssn->cookies.logged_in))
mastodont_get_notifications(api, &m_args, &args, &storage, &notifs, &notifs_len);
mstdnt_get_notifications(api, &m_args, &args, &storage, &notifs, &notifs_len);
PERL_STACK_INIT;
HV* session_hv = perlify_session(ssn);
@ -78,7 +78,7 @@ void content_notifications(PATH_ARGS)
// Output
render_base_page(&b, req, ssn, api);
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
mstdnt_cleanup_notifications(notifs, notifs_len);
Safefree(dup);
}
@ -107,7 +107,7 @@ void content_notifications_compact(PATH_ARGS)
.limit = 20,
};
mastodont_get_notifications(api, &m_args, &args, &storage, &notifs, &notifs_len);
mstdnt_get_notifications(api, &m_args, &args, &storage, &notifs, &notifs_len);
}
PERL_STACK_INIT;
@ -123,7 +123,7 @@ void content_notifications_compact(PATH_ARGS)
send_result(req, NULL, NULL, page, 0);
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
mstdnt_cleanup_notifications(notifs, notifs_len);
Safefree(page);
}
@ -137,13 +137,13 @@ void content_notifications_clear(PATH_ARGS)
if (data)
{
mastodont_notification_dismiss(api, &m_args, &storage, data[0]);
mstdnt_notification_dismiss(api, &m_args, &storage, data[0]);
}
else {
mastodont_notifications_clear(api, &m_args, &storage);
mstdnt_notifications_clear(api, &m_args, &storage);
}
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
redirect(req, REDIRECT_303, referer);
}
@ -157,14 +157,14 @@ void content_notifications_read(PATH_ARGS)
if (data)
{
struct mstdnt_notifications_args args = { .id = data[0] };
mastodont_notifications_read(api, &m_args, &args, &storage, NULL);
mstdnt_notifications_read(api, &m_args, &args, &storage, NULL);
}
else {
struct mstdnt_notifications_args args = { .max_id = keystr(ssn->post.max_id) };
mastodont_notifications_read(api, &m_args, &args, &storage, NULL);
mstdnt_notifications_read(api, &m_args, &args, &storage, NULL);
}
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
redirect(req, REDIRECT_303, referer);
}

View File

@ -25,7 +25,7 @@
int parse_path(REQUEST_T req,
struct session* ssn,
mastodont_t* api,
mstdnt_t* api,
struct path_info* path_info)
{
int res = 0;
@ -103,7 +103,7 @@ breakpt:
void handle_paths(REQUEST_T req,
struct session* ssn,
mastodont_t* api,
mstdnt_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, mastodont_t* api, char** data
#define PATH_ARGS REQUEST_T req, struct session* ssn, mstdnt_t* api, char** data
struct path_info
{
@ -36,13 +36,13 @@ struct path_info
void handle_paths(
REQUEST_T req,
struct session* ssn,
mastodont_t* api,
mstdnt_t* api,
struct path_info* paths,
size_t paths_len);
int parse_path(REQUEST_T req,
struct session* ssn,
mastodont_t* api,
mstdnt_t* api,
struct path_info* path_info);
#endif // PATH_H

View File

@ -75,7 +75,7 @@ void content_search_all(PATH_ARGS)
return;
}
mastodont_search(api, &m_args, keystr(ssn->query.query), &storage, &args, &results);
mstdnt_search(api, &m_args, keystr(ssn->query.query), &storage, &args, &results);
PERL_STACK_INIT;
HV* session_hv = perlify_session(ssn);
@ -98,7 +98,7 @@ void content_search_all(PATH_ARGS)
render_base_page(&b, req, ssn, api);
mstdnt_cleanup_search_results(&results);
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
Safefree(dup);
}
@ -122,7 +122,7 @@ void content_search_statuses(PATH_ARGS)
};
struct mstdnt_search_results results = { 0 };
mastodont_search(api, &m_args, keystr(ssn->query.query), &storage, &args, &results);
mstdnt_search(api, &m_args, keystr(ssn->query.query), &storage, &args, &results);
PERL_STACK_INIT;
HV* session_hv = perlify_session(ssn);
@ -145,7 +145,7 @@ void content_search_statuses(PATH_ARGS)
render_base_page(&b, req, ssn, api);
mstdnt_cleanup_search_results(&results);
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
Safefree(dup);
}
@ -168,7 +168,7 @@ void content_search_accounts(PATH_ARGS)
};
struct mstdnt_search_results results = { 0 };
mastodont_search(api, &m_args, keystr(ssn->query.query), &storage, &args, &results);
mstdnt_search(api, &m_args, keystr(ssn->query.query), &storage, &args, &results);
PERL_STACK_INIT;
HV* session_hv = perlify_session(ssn);
@ -191,7 +191,7 @@ void content_search_accounts(PATH_ARGS)
render_base_page(&b, req, ssn, api);
mstdnt_cleanup_search_results(&results);
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
Safefree(dup);
}
@ -214,12 +214,12 @@ void content_search_hashtags(PATH_ARGS)
};
struct mstdnt_search_results results = { 0 };
mastodont_search(api, &m_args, keystr(ssn->query.query), &storage, &args, &results);
mstdnt_search(api, &m_args, keystr(ssn->query.query), &storage, &args, &results);
// TODO
mstdnt_cleanup_search_results(&results);
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
// Safefree(dup);
}

View File

@ -40,7 +40,7 @@
#define ACCOUNT_INTERACTIONS_LIMIT 11
#define NUM_STR "%u"
int try_post_status(struct session* ssn, mastodont_t* api)
int try_post_status(struct session* ssn, mstdnt_t* api)
{
if (!(keystr(ssn->post.content))) return 1;
struct mstdnt_args m_args;
@ -102,9 +102,9 @@ int try_post_status(struct session* ssn, mastodont_t* api)
};
// Finally, create (no error checking)
mastodont_create_status(api, &m_args, &args, &storage);
mstdnt_create_status(api, &m_args, &args, &storage);
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
if (att_storage)
cleanup_media_storages(ssn, att_storage);
@ -119,17 +119,17 @@ int try_post_status(struct session* ssn, mastodont_t* api)
return 0;
}
int try_react_status(struct session* ssn, mastodont_t* api, char* id, char* emoji)
int try_react_status(struct session* ssn, mstdnt_t* api, char* id, char* emoji)
{
struct mstdnt_args m_args;
set_mstdnt_args(&m_args, ssn);
struct mstdnt_storage storage = { 0 };
struct mstdnt_status status = { 0 };
mastodont_status_emoji_react(api, &m_args, id, emoji, &storage, &status);
mstdnt_status_emoji_react(api, &m_args, id, emoji, &storage, &status);
mstdnt_cleanup_status(&status);
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
return 0;
}
@ -151,7 +151,7 @@ void content_status_react(PATH_ARGS)
redirect(req, REDIRECT_303, referer);
}
int try_interact_status(struct session* ssn, mastodont_t* api, char* id)
int try_interact_status(struct session* ssn, mstdnt_t* api, char* id)
{
struct mstdnt_args m_args;
set_mstdnt_args(&m_args, ssn);
@ -162,35 +162,35 @@ int try_interact_status(struct session* ssn, mastodont_t* api, char* id)
// Pretty up the type
if (strcmp(keystr(ssn->post.itype), "like") == 0 ||
strcmp(keystr(ssn->post.itype), "likeboost") == 0)
res = mastodont_favourite_status(api, &m_args, id, &storage, NULL);
res = mstdnt_favourite_status(api, &m_args, id, &storage, NULL);
// Not else if because possibly a like-boost
if (strcmp(keystr(ssn->post.itype), "repeat") == 0 ||
strcmp(keystr(ssn->post.itype), "likeboost") == 0)
res = mastodont_reblog_status(api, &m_args, id, &storage, NULL);
res = mstdnt_reblog_status(api, &m_args, id, &storage, NULL);
else if (strcmp(keystr(ssn->post.itype), "bookmark") == 0)
res = mastodont_bookmark_status(api, &m_args, id, &storage, NULL);
res = mstdnt_bookmark_status(api, &m_args, id, &storage, NULL);
else if (strcmp(keystr(ssn->post.itype), "pin") == 0)
res = mastodont_pin_status(api, &m_args, id, &storage, NULL);
res = mstdnt_pin_status(api, &m_args, id, &storage, NULL);
else if (strcmp(keystr(ssn->post.itype), "mute") == 0)
res = mastodont_mute_conversation(api, &m_args, id, &storage, NULL);
res = mstdnt_mute_conversation(api, &m_args, id, &storage, NULL);
else if (strcmp(keystr(ssn->post.itype), "delete") == 0)
res = mastodont_delete_status(api, &m_args, id, &storage, NULL);
res = mstdnt_delete_status(api, &m_args, id, &storage, NULL);
else if (strcmp(keystr(ssn->post.itype), "unlike") == 0)
res = mastodont_unfavourite_status(api, &m_args, id, &storage, NULL);
res = mstdnt_unfavourite_status(api, &m_args, id, &storage, NULL);
else if (strcmp(keystr(ssn->post.itype), "unrepeat") == 0)
res = mastodont_unreblog_status(api, &m_args, id, &storage, NULL);
res = mstdnt_unreblog_status(api, &m_args, id, &storage, NULL);
else if (strcmp(keystr(ssn->post.itype), "unbookmark") == 0)
res = mastodont_unbookmark_status(api, &m_args, id, &storage, NULL);
res = mstdnt_unbookmark_status(api, &m_args, id, &storage, NULL);
else if (strcmp(keystr(ssn->post.itype), "unpin") == 0)
res = mastodont_unpin_status(api, &m_args, id, &storage, NULL);
res = mstdnt_unpin_status(api, &m_args, id, &storage, NULL);
else if (strcmp(keystr(ssn->post.itype), "unmute") == 0)
res = mastodont_unmute_conversation(api, &m_args, id, &storage, NULL);
res = mstdnt_unmute_conversation(api, &m_args, id, &storage, NULL);
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
return res;
}
char* get_in_reply_to(mastodont_t* api,
char* get_in_reply_to(mstdnt_t* api,
struct session* ssn,
struct mstdnt_status* status,
size_t* size)
@ -200,7 +200,7 @@ char* get_in_reply_to(mastodont_t* api,
struct mstdnt_storage storage = { 0 };
struct mstdnt_account acct = { 0 };
int res = mastodont_get_account(api,
int res = mstdnt_get_account(api,
&m_args,
1,
status->in_reply_to_account_id,
@ -212,7 +212,7 @@ char* get_in_reply_to(mastodont_t* api,
// char* html = construct_in_reply_to(status, res == 0 ? &acct : NULL, size);
if (res == 0) mstdnt_cleanup_account(&acct);
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
return html;
}
@ -259,7 +259,7 @@ void status_view_reblogs(PATH_ARGS)
size_t reblogs_len = 0;
char* status_id = data[0];
mastodont_status_reblogged_by(api,
mstdnt_status_reblogged_by(api,
&m_args,
status_id,
&storage,
@ -274,7 +274,7 @@ void status_view_reblogs(PATH_ARGS)
reblogs,
reblogs_len);
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
mstdnt_cleanup_accounts(reblogs, reblogs_len);
}
@ -287,7 +287,7 @@ void status_view_favourites(PATH_ARGS)
size_t favourites_len = 0;
char* status_id = data[0];
mastodont_status_favourited_by(api,
mstdnt_status_favourited_by(api,
&m_args,
status_id,
&storage,
@ -302,13 +302,13 @@ void status_view_favourites(PATH_ARGS)
favourites,
favourites_len);
mastodont_storage_cleanup(&storage);
mstdnt_storage_cleanup(&storage);
mstdnt_cleanup_accounts(favourites, favourites_len);
}
void content_status_interactions(FCGX_Request* req,
struct session* ssn,
mastodont_t* api,
mstdnt_t* api,
char* label,
struct mstdnt_account* accts,
size_t accts_len)
@ -351,8 +351,8 @@ void content_status(PATH_ARGS, uint8_t flags)
size_t stat_before_len = 0, stat_after_len = 0;
try_post_status(ssn, api);
mastodont_get_status(api, &m_args, data[0], &status_storage, &status);
mastodont_get_status_context(api,
mstdnt_get_status(api, &m_args, data[0], &status_storage, &status);
mstdnt_get_status_context(api,
&m_args,
data[0],
&storage,
@ -400,8 +400,8 @@ void content_status(PATH_ARGS, uint8_t flags)
mstdnt_cleanup_statuses(statuses_before, stat_before_len);
mstdnt_cleanup_statuses(statuses_after, stat_after_len);
mstdnt_cleanup_status(&status);
mastodont_storage_cleanup(&storage);
mastodont_storage_cleanup(&status_storage);
mstdnt_storage_cleanup(&storage);
mstdnt_storage_cleanup(&status_storage);
Safefree(dup);
free(picker);
}

View File

@ -47,8 +47,8 @@ struct interact_profile_args
size_t favourites_len;
};
int try_post_status(struct session* ssn, mastodont_t* api);
int try_interact_status(struct session* ssn, mastodont_t* api, char* id);
int try_post_status(struct session* ssn, mstdnt_t* api);
int try_interact_status(struct session* ssn, mstdnt_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(mastodont_t* api,
char* get_in_reply_to(mstdnt_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,
mastodont_t* api,
mstdnt_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,
mastodont_t* api,
mstdnt_t* api,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses,
size_t statuses_len,
@ -73,12 +73,12 @@ void content_timeline(REQUEST_T req,
render_base_page(&b, req, ssn, api);
// Cleanup
mastodont_storage_cleanup(storage);
mstdnt_storage_cleanup(storage);
mstdnt_cleanup_statuses(statuses, statuses_len);
Safefree(dup);
}
void tl_home(REQUEST_T req, struct session* ssn, mastodont_t* api, int local)
void tl_home(REQUEST_T req, struct session* ssn, mstdnt_t* api, int local)
{
struct mstdnt_args m_args = { 0 };
set_mstdnt_args(&m_args, ssn);
@ -104,12 +104,12 @@ void tl_home(REQUEST_T req, struct session* ssn, mastodont_t* api, int local)
try_post_status(ssn, api);
mastodont_timeline_home(api, &m_args, &args, &storage, &statuses, &statuses_len);
mstdnt_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, mastodont_t* api)
void tl_direct(REQUEST_T req, struct session* ssn, mstdnt_t* api)
{
struct mstdnt_args m_args = { 0 };
set_mstdnt_args(&m_args, ssn);
@ -132,12 +132,12 @@ void tl_direct(REQUEST_T req, struct session* ssn, mastodont_t* api)
try_post_status(ssn, api);
mastodont_timeline_direct(api, &m_args, &args, &storage, &statuses, &statuses_len);
mstdnt_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, mastodont_t* api, int local, enum base_category cat)
void tl_public(REQUEST_T req, struct session* ssn, mstdnt_t* api, int local, enum base_category cat)
{
struct mstdnt_args m_args = { 0 };
set_mstdnt_args(&m_args, ssn);
@ -162,12 +162,12 @@ void tl_public(REQUEST_T req, struct session* ssn, mastodont_t* api, int local,
try_post_status(ssn, api);
mastodont_timeline_public(api, &m_args, &args, &storage, &statuses, &statuses_len);
mstdnt_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, mastodont_t* api, char* list_id)
void tl_list(REQUEST_T req, struct session* ssn, mstdnt_t* api, char* list_id)
{
struct mstdnt_args m_args;
set_mstdnt_args(&m_args, ssn);
@ -189,13 +189,13 @@ void tl_list(REQUEST_T req, struct session* ssn, mastodont_t* api, char* list_id
try_post_status(ssn, api);
mastodont_timeline_list(api, &m_args, list_id, &args, &storage, &statuses, &statuses_len);
mstdnt_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, mastodont_t* api, char* tag_id)
void tl_tag(REQUEST_T req, struct session* ssn, mstdnt_t* api, char* tag_id)
{
struct mstdnt_args m_args;
set_mstdnt_args(&m_args, ssn);
@ -216,7 +216,7 @@ void tl_tag(REQUEST_T req, struct session* ssn, mastodont_t* api, char* tag_id)
.limit = 20,
};
mastodont_timeline_tag(api, &m_args, tag_id, &args, &storage, &statuses, &statuses_len);
mstdnt_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, mastodont_t* api, int local);
void tl_home(REQUEST_T req, struct session* ssn, mstdnt_t* api, int local);
/** Wrapper for content_tl_direct */
void tl_direct(REQUEST_T req, struct session* ssn, mastodont_t* api);
void tl_direct(REQUEST_T req, struct session* ssn, mstdnt_t* api);
/** Wrapper for content_tl_federated */
void tl_public(REQUEST_T req, struct session* ssn, mastodont_t* api, int local, enum base_category cat);
void tl_public(REQUEST_T req, struct session* ssn, mstdnt_t* api, int local, enum base_category cat);
/** Wrapper for content_tl_list */
void tl_list(REQUEST_T req, struct session* ssn, mastodont_t* api, char* list_id);
void tl_list(REQUEST_T req, struct session* ssn, mstdnt_t* api, char* list_id);
/** Wrapper for content_tl_tag */
void tl_tag(REQUEST_T req, struct session* ssn, mastodont_t* api, char* tag);
void tl_tag(REQUEST_T req, struct session* ssn, mstdnt_t* api, char* tag);
/* ------------------------------------------------ */
@ -80,7 +80,7 @@ void content_tl_tag(PATH_ARGS);
*/
void content_timeline(REQUEST_T req,
struct session* ssn,
mastodont_t* api,
mstdnt_t* api,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses,
size_t statuses_len,