From e7621408225d9d05dbc25d7a977cde0b803757a9 Mon Sep 17 00:00:00 2001 From: "me@ow.nekobit.net" Date: Tue, 19 Apr 2022 14:33:13 +0000 Subject: [PATCH] Fix visibility FossilOrigin-Name: 72af980137a4bb8e62fa2264acf2da95ecdaf7d1abd649e794646d454cb96934 --- include/mastodont_notification.h | 4 ++-- include/mastodont_status.h | 2 +- include/mastodont_visibility_types.h | 16 ++++++++-------- src/status.c | 1 + 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/mastodont_notification.h b/include/mastodont_notification.h index b55d513..e6cce92 100644 --- a/include/mastodont_notification.h +++ b/include/mastodont_notification.h @@ -38,9 +38,9 @@ struct mstdnt_get_notifications_args mstdnt_notification_t exclude_types; char* account_id; /* Bitmask */ - mstdnt_visibility_t exclude_visibilities; + mstdnt_visibility_t* exclude_visibilities; /* Bitmask */ - mstdnt_visibility_t include_types; + mstdnt_visibility_t* include_types; mstdnt_bool with_muted; char* max_id; char* min_id; diff --git a/include/mastodont_status.h b/include/mastodont_status.h index 9728520..997c4a0 100644 --- a/include/mastodont_status.h +++ b/include/mastodont_status.h @@ -38,7 +38,7 @@ struct mstdnt_status char* created_at; struct mstdnt_account account; char* content; - mstdnt_visibility_t visibility; + char* visibility; mstdnt_bool sensitive; char* spoiler_text; struct mstdnt_attachment* media_attachments; diff --git a/include/mastodont_visibility_types.h b/include/mastodont_visibility_types.h index a5989d4..6d6aa59 100644 --- a/include/mastodont_visibility_types.h +++ b/include/mastodont_visibility_types.h @@ -17,14 +17,14 @@ #define MASTODONT_VISIBILITY_TYPES_H #include -#define MSTDNT_VISIBILITY_NOOP 0 -#define MSTDNT_VISIBILITY_PUBLIC (1<<0) -#define MSTDNT_VISIBILITY_UNLISTED (1<<1) -#define MSTDNT_VISIBILITY_PRIVATE (1<<2) -#define MSTDNT_VISIBILITY_DIRECT (1<<3) -#define MSTDNT_VISIBILITY_LIST (1<<4) -#define MSTDNT_VISIBILITY_LOCAL (1<<5) +/* These used to uint8_t's, but because lists are custom strings, + it was better to make these regular strings */ +#define MSTDNT_VISIBILITY_PUBLIC "public" +#define MSTDNT_VISIBILITY_UNLISTED "unlisted" +#define MSTDNT_VISIBILITY_PRIVATE "private" +#define MSTDNT_VISIBILITY_DIRECT "direct" +#define MSTDNT_VISIBILITY_LOCAL "local" -typedef uint8_t mstdnt_visibility_t; +typedef char* mstdnt_visibility_t; #endif /* MASTODONT_VISIBILITY_TYPES_H */ diff --git a/src/status.c b/src/status.c index b7ab573..ba612c8 100644 --- a/src/status.c +++ b/src/status.c @@ -66,6 +66,7 @@ int mstdnt_status_from_json(struct mstdnt_status* status, cJSON* js) { "language", &(status->language), _mstdnt_val_string_call }, { "url", &(status->url), _mstdnt_val_string_call }, { "text", &(status->text), _mstdnt_val_string_call }, + { "visibility", &(status->visibility), _mstdnt_val_string_call }, { "in_reply_to_account_id", &(status->in_reply_to_account_id), _mstdnt_val_string_call }, { "sensitive", &(status->sensitive), _mstdnt_val_bool_call }, { "favourited", &(status->favourited), _mstdnt_val_bool_call },