From 3985afe5f8827e6e818101e557bf8f02700b64d8 Mon Sep 17 00:00:00 2001 From: "me@ow.nekobit.net" Date: Mon, 28 Mar 2022 16:14:49 +0000 Subject: [PATCH] Fix flags FossilOrigin-Name: baab10c67fd7300e8462c125a28ab5b606f5d11e22612565c9fc7ccf22fe3de0 --- config.def.h | 14 ++++++++++++++ src/main.c | 2 +- src/status.c | 4 ++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/config.def.h b/config.def.h index 90afda8..47ec505 100644 --- a/config.def.h +++ b/config.def.h @@ -8,6 +8,7 @@ #ifndef CONFIG_H #define CONFIG_H +#include #define FALSE 0 #define TRUE 1 @@ -32,6 +33,19 @@ static char* const config_canonical_name = "treebird"; */ static char* const config_instance_url = "https://my-instace.social/"; +/* [[ IF YOU DON'T UNDERSTAND THIS, LEAVE IT ALONE ]] + * Flag: library_flags + * + * The flags to pass into the mastodont library. If this value is zero, it is not + * set. To set multiple flags, use the `|` operator, like `FLAG_1 | FLAG_2` + * + * Note: Since Treebird is a HTTP frontend, MSTDNT_FLAG_NO_URI_SANITIZE is already + * set by default, setting it here is redundant. + * + * Example: MSTDNT_FLAG_SSL_UNVERIFIED + */ +static uint16_t config_library_flags = 0; + /* * String: url_prefix * diff --git a/src/main.c b/src/main.c index 4ebc4b6..1da4f8b 100644 --- a/src/main.c +++ b/src/main.c @@ -47,7 +47,7 @@ int main(void) { mastodont_t api; api.url = config_instance_url; - mastodont_init(&api, MSTDNT_FLAG_NO_URI_SANITIZE); + mastodont_init(&api, MSTDNT_FLAG_NO_URI_SANITIZE | config_library_flags); // Load cookies char* cookies_str = read_cookies_env(); diff --git a/src/status.c b/src/status.c index 281df7c..c41b6c3 100644 --- a/src/status.c +++ b/src/status.c @@ -86,10 +86,10 @@ int try_interact_status(mastodont_t* api, char* id) // Pretty up the type if (strcmp(post.itype, "like") == 0) { - mastodont_favourite_status(api, id, &storage); + mastodont_favourite_status(api, id, &storage, NULL); } else if (strcmp(post.itype, "repeat") == 0) { - mastodont_reblog_status(api, id, &storage); + mastodont_reblog_status(api, id, &storage, NULL); } mastodont_storage_cleanup(&storage);