diff --git a/Makefile b/Makefile index d2f648c..7f26ce6 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CC ?= cc -CFLAGS = -g -ansi -Wall -Werror=implicit-function-declaration -I ./include/ `pkg-config --cflags libcjson` +CFLAGS = -g -ansi -Wall -Werror=implicit-function-declaration -Wno-unused-variable -I ./include/ `pkg-config --cflags libcjson` SRC = $(wildcard src/*.c) OBJ = $(patsubst %.c,%.o,$(SRC)) TARGET = libmastodont.a # shared diff --git a/include/mastodont_error.h b/include/mastodont_error.h index c186714..8e1bec7 100644 --- a/include/mastodont_error.h +++ b/include/mastodont_error.h @@ -21,4 +21,4 @@ int mstdnt_check_error(struct mstdnt_fetch_results* result, struct mstdnt_storage* storage); -#endif // MASTODONT_ERROR_H +#endif /* MASTODONT_ERROR_H */ diff --git a/include/mastodont_status.h b/include/mastodont_status.h index 57a6a83..5146192 100644 --- a/include/mastodont_status.h +++ b/include/mastodont_status.h @@ -75,6 +75,21 @@ struct mstdnt_status mstdnt_bool pinned; }; +struct mstdnt_account_statuses_args +{ + mstdnt_bool pinned; + mstdnt_bool only_media; + mstdnt_bool with_muted; + mstdnt_bool exclude_reblogs; + mstdnt_bool exclude_replies; + char* tagged; + char* max_id; + char* min_id; + char* since_id; + int offset; + int limit; +}; + void mstdnt_cleanup_statuses(struct mstdnt_status* statuses, size_t s); void mstdnt_cleanup_status(struct mstdnt_status* status); @@ -109,7 +124,7 @@ int mstdnt_status_context_from_json(struct mstdnt_fetch_results* results, int mastodont_get_account_statuses(mastodont_t* data, char* id, - struct mstdnt_args* args, + struct mstdnt_account_statuses_args* args, struct mstdnt_storage* storage, struct mstdnt_status* statuses[], size_t* size); diff --git a/src/application.c b/src/application.c index 640b932..d87307d 100644 --- a/src/application.c +++ b/src/application.c @@ -91,7 +91,7 @@ static int mstdnt_token_result_callback(struct mstdnt_fetch_results* results, struct mstdnt_storage* storage, void* args) { - mstdnt_token_result(results, storage, args); + return mstdnt_token_result(results, storage, args); } int mastodont_register_app(mastodont_t* data, diff --git a/src/pleroma.c b/src/pleroma.c index 7700190..1a169ba 100644 --- a/src/pleroma.c +++ b/src/pleroma.c @@ -43,6 +43,8 @@ int mstdnt_status_pleroma_from_json(struct mstdnt_status_pleroma* pleroma, cJSON { _mstdnt_key_val_ref(v, refs, _mstdnt_arr_len(refs)); } + + return 0; } void _mstdnt_val_status_pleroma_call(cJSON* v, void* _type) diff --git a/src/relationship.c b/src/relationship.c index e41e0d6..ea0ccac 100644 --- a/src/relationship.c +++ b/src/relationship.c @@ -103,6 +103,8 @@ int mstdnt_relationships_result(struct mstdnt_fetch_results* results, { mstdnt_relationship_json((*relationships) + i++, rel_j_list->child); } + + return 0; } int mstdnt_relationship_result(struct mstdnt_fetch_results* results, diff --git a/src/status.c b/src/status.c index 082fb1c..01712b7 100644 --- a/src/status.c +++ b/src/status.c @@ -156,10 +156,9 @@ int _mstdnt_statuses_result_callback(struct mstdnt_fetch_results* results, return mstdnt_statuses_from_result(storage, results, args->statuses, args->size); } -/* TODO Still need to handle get params */ int mastodont_get_account_statuses(mastodont_t* data, char* id, - struct mstdnt_args* args, + struct mstdnt_account_statuses_args* args, struct mstdnt_storage* storage, struct mstdnt_status* statuses[], size_t* size) @@ -168,11 +167,41 @@ int mastodont_get_account_statuses(mastodont_t* data, struct _mstdnt_statuses_cb_args cb_args = { statuses, size }; snprintf(url, MSTDNT_URLSIZE, "api/v1/accounts/%s/statuses", id); + union param_value u_pinned, u_tagged, u_only_media, + u_with_muted, u_exclude_reblogs, u_exclude_replies, + u_exclude_visibilities, u_max_id, u_min_id, + u_since_id, u_offset, u_limit; + u_pinned.i = args->pinned; + u_only_media.i = args->only_media; + u_with_muted.i = args->with_muted; + u_exclude_reblogs.i = args->exclude_reblogs; + u_exclude_replies.i = args->exclude_replies; + u_tagged.s = args->tagged; + u_max_id.s = args->max_id; + u_min_id.s = args->min_id; + u_since_id.s = args->since_id; + u_offset.i = args->offset; + u_limit.i = args->limit; + + struct _mstdnt_query_param params[] = { + { _MSTDNT_QUERY_INT, "pinned", u_pinned }, + { _MSTDNT_QUERY_STRING, "tagged", u_tagged }, + { _MSTDNT_QUERY_INT, "only_media", u_only_media }, + { _MSTDNT_QUERY_INT, "with_muted", u_with_muted }, + { _MSTDNT_QUERY_INT, "exclude_reblogs", u_exclude_reblogs }, + { _MSTDNT_QUERY_INT, "exclude_replies", u_exclude_replies }, + { _MSTDNT_QUERY_STRING, "max_id", u_max_id }, + { _MSTDNT_QUERY_STRING, "since_id", u_since_id }, + { _MSTDNT_QUERY_STRING, "min_id", u_min_id }, + { _MSTDNT_QUERY_INT, "limit", u_limit }, + { _MSTDNT_QUERY_INT, "offset", u_offset }, + }; + struct mastodont_request_args req_args = { storage, url, NULL, 0, - NULL, 0, /* TODO */ + params, _mstdnt_arr_len(params), CURLOPT_HTTPGET, &cb_args, _mstdnt_statuses_result_callback @@ -388,6 +417,8 @@ int mstdnt_status_context_from_json(struct mstdnt_fetch_results* results, } } } + + return 0; } int _mstdnt_status_context_from_result_callback(struct mstdnt_fetch_results* results,