summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2024-02-10 09:08:09 +0100
committerdefault <nobody@localhost>2024-02-10 09:08:09 +0100
commit0930ce726fa5750eed4f1f53627428dab0944f1a (patch)
tree108b4d8b29f20b418c289777e81fbde5a2821477 /mastoapi.c
parent151c5aa6ec4fb0f3b0e0d8ca62f9dc5ad27b14e0 (diff)
New function is_msg_from_private_user().
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c25
1 files changed, 7 insertions, 18 deletions
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);