FossilOrigin-Name: 76a93e098733f2bf1eae90faf66ebafbc07506d14c2ec9fd5c97d538f7dfa2fa
This commit is contained in:
nekobit 2022-11-01 02:44:23 +00:00
parent 9407408044
commit 8591309af1
5 changed files with 25 additions and 11 deletions

View file

@ -106,6 +106,4 @@ void load_config(FCGX_Request* req,
set_config_int(LOAD_CFG_SIM("notifembed", notif_embed), CONFIG_GENERAL);
set_config_int(LOAD_CFG_SIM("interact_img", interact_img), CONFIG_GENERAL);
set_config_int(LOAD_CFG_SIM("lang", lang), CONFIG_GENERAL);
return storage;
}

View file

@ -58,6 +58,6 @@ void session_cleanup(struct session* ssn)
free_files(&(keyfile(ssn->post.files)));
if (ssn->logged_in) mstdnt_cleanup_account(&(ssn->acct));
mstdnt_storage_cleanup(&(ssn->acct_storage));
if (attachments)
cleanup_media_storages(ssn, attachments);
/* if (attachments) */
/* cleanup_media_storages(ssn, attachments); */
}

View file

@ -139,10 +139,13 @@ int tl_direct(REQUEST_T req, struct session* ssn, mastodont_t* api)
content_timeline(req, ssn, api, &storage, statuses, statuses_len, BASE_CAT_DIRECT, "Direct", 0, 0);
}
static void request_cb_tl_public(mstdnt_request_cb_data_t data, void* args)
static void request_cb_tl_public(mstdnt_request_cb_data* cb_data, void* tbargs)
{
struct request_args* cb_args = args;
struct mstdnt_statuses* statuses = MSTDNT_CB_DATA(cb_data);
DESTRUCT_TB_ARGS(tbargs);
content_timeline(req, ssn, api, &storage, statuses, statuses_len, cat, NULL, 1, 0);
mstdnt_request_cb_cleanup(cb_data);
}
int tl_public(REQUEST_T req, struct session* ssn, mastodont_t* api, int local, enum base_category cat)
@ -170,9 +173,9 @@ int tl_public(REQUEST_T req, struct session* ssn, mastodont_t* api, int local, e
try_post_status(ssn, api);
struct request_args cb_args =
request_args_create(req, ssn);
mstdnt_timeline_public(api, &m_args, request_cb_tl_public, ssn, &args, &storage, &statuses, &statuses_len);
struct request_args* cb_args =
request_args_create(req, ssn, api, NULL);
mstdnt_timeline_public(api, &m_args, request_cb_tl_public, ssn, &args);
return 1;
}

View file

@ -20,13 +20,14 @@
#include <fcgiapp.h>
struct request_args*
request_args_create(REQUEST_T req, struct session* ssn)
request_args_create(REQUEST_T req, struct session* ssn, mastodont_t* api, void* _args)
{
struct request_args* args = malloc(sizeof(struct request_args));
if (!args)
perror("request_args_create: malloc");
args->req = req;
args->ssn = ssn;
args->args = _args;
return args;
}

View file

@ -18,6 +18,7 @@
#ifndef TB_TYPES_H
#define TB_TYPES_H
#include <mastodont.h>
#include "types.h"
#include "session.h"
@ -25,10 +26,21 @@ struct request_args
{
REQUEST_T req;
struct session* ssn;
mastodont_t* api;
void* args;
};
#define DESTRUCT_TB_ARGS(_args) REQUEST_T req = _args->req; \
struct session* ssn = _args->ssn; \
mastodont_t* api = _args->api; \
void* args = _args->args; \
(void)req; \
(void)ssn; \
(void)api; \
(void)args;
struct request_args*
request_args_create(REQUEST_T req, struct session* ssn);
request_args_create(REQUEST_T req, struct session* ssn, mastodont_t* api, void* args);
void request_args_cleanup(struct request_args* req);