From 0908b2979a75f6aeca1fb7c0b4c5a6e2d89bd675 Mon Sep 17 00:00:00 2001 From: nekobit Date: Tue, 1 Nov 2022 14:09:31 +0000 Subject: [PATCH] Timeline updates FossilOrigin-Name: 0fbfad08b9afe9e0286a9d8a5f053eb396cc5bdd21b03ad3d034e5c5e6dc730a --- src/status.c | 2 +- src/timeline.c | 47 ++++++++++++++++++++--------------------------- 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/src/status.c b/src/status.c index 8abd144..efdd9c3 100644 --- a/src/status.c +++ b/src/status.c @@ -146,7 +146,7 @@ int mstdnt_statuses_json_callback(cJSON* json, void** _args) { struct mstdnt_statuses* statuses = malloc(sizeof(struct mstdnt_statuses)); *_args = statuses; - return mstdnt_statuses_json(&(statuses->statuses), &(statuses->size), json); + return mstdnt_statuses_json(&(statuses->statuses), &(statuses->len), json); } int mstdnt_get_account_statuses(mastodont_t* data, diff --git a/src/timeline.c b/src/timeline.c index 25e7253..4ea3386 100644 --- a/src/timeline.c +++ b/src/timeline.c @@ -44,7 +44,6 @@ int mstdnt_timeline_list(mastodont_t* data, }; struct mstdnt_request_args req_args = { - .storage = storage, .url = url, .params_query = params, .params_query_len = _mstdnt_arr_len(params), @@ -86,7 +85,6 @@ int mstdnt_timeline_tag(mastodont_t* data, }; struct mstdnt_request_args req_args = { - .storage = storage, .url = url, .params_query = params, .params_query_len = _mstdnt_arr_len(params), @@ -119,10 +117,7 @@ int mstdnt_timeline_public(mastodont_t* data, struct mstdnt_args* m_args, mstdnt_request_cb_t cb_request, void* cb_args, - struct mstdnt_timeline_args* args, - struct mstdnt_storage* storage, - struct mstdnt_status* statuses[], - size_t* size) + struct mstdnt_timeline_args* args) { struct _mstdnt_query_param params[] = { { _MSTDNT_QUERY_BOOL, "local", { .b = args->local } }, @@ -139,7 +134,6 @@ int mstdnt_timeline_public(mastodont_t* data, }; struct mstdnt_request_args req_args = { - .storage = storage, .url = "api/v1/timelines/public", .params_query = params, .params_query_len = _mstdnt_arr_len(params), @@ -159,10 +153,7 @@ int mstdnt_timeline_direct(mastodont_t* data, struct mstdnt_args* m_args, mstdnt_request_cb_t cb_request, void* cb_args, - struct mstdnt_timeline_args* args, - struct mstdnt_storage* storage, - struct mstdnt_status* statuses[], - size_t* size) + struct mstdnt_timeline_args* args) { struct _mstdnt_query_param params[] = { { _MSTDNT_QUERY_STRING, "max_id", { .s = args->max_id } }, @@ -174,14 +165,15 @@ int mstdnt_timeline_direct(mastodont_t* data, }; struct mstdnt_request_args req_args = { - storage, - "api/v1/timelines/direct", - params, _mstdnt_arr_len(params), - NULL, 0, - CURLOPT_HTTPGET, - NULL, - NULL, - mstdnt_statuses_json_callback, + .url = "api/v1/timelines/direct", + .params_query = params, + .params_query_len = _mstdnt_arr_len(params), + .params_post = NULL, + .params_post_len = 0, + .request_type = CURLOPT_HTTPGET, + .request_type_custom = NULL, + .args = NULL, + .callback = mstdnt_statuses_json_callback, }; return mstdnt_request(data, m_args, cb_request, cb_args, &req_args); @@ -209,14 +201,15 @@ int mstdnt_timeline_home(mastodont_t* data, }; struct mstdnt_request_args req_args = { - storage, - "api/v1/timelines/home", - params, _mstdnt_arr_len(params), - NULL, 0, - CURLOPT_HTTPGET, - NULL, - NULL, - mstdnt_statuses_json_callback, + .url = "api/v1/timelines/home", + .params_query = params, + .params_query_len = _mstdnt_arr_len(params), + .params_post = NULL, + .params_post_len = 0, + .request_type = CURLOPT_HTTPGET, + .request_type_custom = NULL, + .args = NULL, + .callback = mstdnt_statuses_json_callback, }; return mstdnt_request(data, m_args, cb_request, cb_args, &req_args);