diff --git a/src/timeline.c b/src/timeline.c index 7931177..f98653f 100644 --- a/src/timeline.c +++ b/src/timeline.c @@ -74,8 +74,8 @@ void content_timeline(REQUEST_T req, render_base_page(&b, req, ssn, api); // Cleanup - mstdnt_storage_cleanup(storage); - mstdnt_cleanup_statuses(statuses, statuses_len); + /* mstdnt_storage_cleanup(storage); */ + /* mstdnt_cleanup_statuses(statuses, statuses_len); */ tb_free(dup); } @@ -83,9 +83,6 @@ int 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); - size_t statuses_len = 0; - struct mstdnt_status* statuses = NULL; - struct mstdnt_storage storage = { 0 }; struct mstdnt_timeline_args args = { .with_muted = MSTDNT_TRUE, @@ -106,18 +103,15 @@ int tl_home(REQUEST_T req, struct session* ssn, mastodont_t* api, int local) try_post_status(ssn, api); - mstdnt_timeline_home(api, &m_args, NULL, NULL, &args, &storage, &statuses, &statuses_len); + return mstdnt_timeline_home(api, &m_args, NULL, NULL, &args); - content_timeline(req, ssn, api, &storage, statuses, statuses_len, BASE_CAT_HOME, NULL, 1, 0); +// content_timeline(req, ssn, api, &storage, statuses, statuses_len, BASE_CAT_HOME, NULL, 1, 0); } int tl_direct(REQUEST_T req, struct session* ssn, mastodont_t* api) { struct mstdnt_args m_args = { 0 }; set_mstdnt_args(&m_args, ssn); - size_t statuses_len = 0; - struct mstdnt_status* statuses = NULL; - struct mstdnt_storage storage = { 0 }; struct mstdnt_timeline_args args = { .with_muted = 1, @@ -134,17 +128,18 @@ int tl_direct(REQUEST_T req, struct session* ssn, mastodont_t* api) try_post_status(ssn, api); - mstdnt_timeline_direct(api, &m_args, NULL, NULL, &args, &storage, &statuses, &statuses_len); + return mstdnt_timeline_direct(api, &m_args, NULL, NULL, &args); - content_timeline(req, ssn, api, &storage, statuses, statuses_len, BASE_CAT_DIRECT, "Direct", 0, 0); +// content_timeline(req, ssn, api, &storage, statuses, statuses_len, BASE_CAT_DIRECT, "Direct", 0, 0); } +// Callback: tl_public static void request_cb_tl_public(mstdnt_request_cb_data* cb_data, void* tbargs) { 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); + content_timeline(req, ssn, api, cb_data->storage, statuses->statuses, statuses->len, 0, NULL, 1, 0); mstdnt_request_cb_cleanup(cb_data); } @@ -152,9 +147,6 @@ int tl_public(REQUEST_T req, struct session* ssn, mastodont_t* api, int local, e { struct mstdnt_args m_args = { 0 }; set_mstdnt_args(&m_args, ssn); - size_t statuses_len = 0; - struct mstdnt_status* statuses = NULL; - struct mstdnt_storage storage = { 0 }; struct mstdnt_timeline_args args = { .with_muted = MSTDNT_TRUE, @@ -175,18 +167,14 @@ int tl_public(REQUEST_T req, struct session* ssn, mastodont_t* api, int local, e 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; + + return mstdnt_timeline_public(api, &m_args, request_cb_tl_public, ssn, &args); } int 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); - size_t statuses_len = 0; - struct mstdnt_status* statuses = NULL; - struct mstdnt_storage storage = { 0 }; struct mstdnt_timeline_args args = { .max_id = keystr(ssn->post.max_id), @@ -202,9 +190,9 @@ int tl_list(REQUEST_T req, struct session* ssn, mastodont_t* api, char* list_id) try_post_status(ssn, api); - mstdnt_timeline_list(api, &m_args, NULL, NULL, list_id, &args, &storage, &statuses, &statuses_len); + return mstdnt_timeline_list(api, &m_args, NULL, NULL, list_id, &args); - content_timeline(req, ssn, api, &storage, statuses, statuses_len, BASE_CAT_LISTS, "List timeline", 0, 0); + //content_timeline(req, ssn, api, BASE_CAT_LISTS, "List timeline", 0, 0); } @@ -212,10 +200,6 @@ int 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); - char* header; - size_t statuses_len = 0; - struct mstdnt_status* statuses = NULL; - struct mstdnt_storage storage = { 0 }; struct mstdnt_timeline_args args = { .max_id = keystr(ssn->post.max_id), @@ -229,12 +213,9 @@ int tl_tag(REQUEST_T req, struct session* ssn, mastodont_t* api, char* tag_id) .limit = 20, }; - mstdnt_timeline_tag(api, &m_args, NULL, NULL, tag_id, &args, &storage, &statuses, &statuses_len); + return mstdnt_timeline_tag(api, &m_args, NULL, NULL, tag_id, &args); - easprintf(&header, "Hashtag - #%s", tag_id); - - content_timeline(req, ssn, api, &storage, statuses, statuses_len, BASE_CAT_NONE, header, 0, 0); - tb_free(header); + //content_timeline(req, ssn, api, BASE_CAT_NONE, header, 0, 0); } int content_tl_home(PATH_ARGS) diff --git a/src/types.h b/src/types.h index 8ef98f5..2889626 100644 --- a/src/types.h +++ b/src/types.h @@ -30,13 +30,14 @@ struct request_args 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; \ +#define DESTRUCT_TB_ARGS(_args) \ + REQUEST_T req = ((struct request_args*)_args)->req; \ + struct session* ssn = ((struct request_args*)_args)->ssn; \ + mastodont_t* api = ((struct request_args*)_args)->api; \ + void* args = ((struct request_args*)_args)->args; \ + (void)req; \ + (void)ssn; \ + (void)api; \ (void)args; struct request_args*