From 0930ce726fa5750eed4f1f53627428dab0944f1a Mon Sep 17 00:00:00 2001 From: default Date: Sat, 10 Feb 2024 09:08:09 +0100 Subject: New function is_msg_from_private_user(). --- mastoapi.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'mastoapi.c') diff --git a/mastoapi.c b/mastoapi.c index 000bdea..e2b7bba 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -1500,24 +1500,9 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, if (strcmp(type, "Note") != 0 && strcmp(type, "Question") != 0) continue; - /* discard private users */ - { - const char *atto = get_atto(msg); - xs *l = xs_split(atto, "/"); - const char *uid = xs_list_get(l, -1); - snac p_user; - int skip = 1; - - if (uid && user_open(&p_user, uid)) { - if (xs_type(xs_dict_get(p_user.config, "private")) != XSTYPE_TRUE) - skip = 0; - - user_free(&p_user); - } - - if (skip) - continue; - } + /* discard messages from private users */ + if (is_msg_from_private_user(msg)) + continue; /* convert the Note into a Mastodon status */ xs *st = mastoapi_status(user, msg); @@ -1564,6 +1549,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, if (!is_msg_public(msg)) continue; + /* discard messages from private users */ + if (is_msg_from_private_user(msg)) + continue; + /* convert the Note into a Mastodon status */ xs *st = mastoapi_status(NULL, msg); -- cgit v1.2.3