diff options
| author | 2024-02-10 09:08:09 +0100 | |
|---|---|---|
| committer | 2024-02-10 09:08:09 +0100 | |
| commit | 0930ce726fa5750eed4f1f53627428dab0944f1a (patch) | |
| tree | 108b4d8b29f20b418c289777e81fbde5a2821477 /activitypub.c | |
| parent | mastoapi: Skip non-public posts from timelines by tag. (diff) | |
| download | penes-snac2-0930ce726fa5750eed4f1f53627428dab0944f1a.tar.gz penes-snac2-0930ce726fa5750eed4f1f53627428dab0944f1a.tar.xz penes-snac2-0930ce726fa5750eed4f1f53627428dab0944f1a.zip | |
New function is_msg_from_private_user().
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/activitypub.c b/activitypub.c index df4877b..9893470 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -593,6 +593,30 @@ int is_msg_public(const xs_dict *msg) | |||
| 593 | } | 593 | } |
| 594 | 594 | ||
| 595 | 595 | ||
| 596 | int is_msg_from_private_user(const xs_dict *msg) | ||
| 597 | /* checks if a message is from a local, private user */ | ||
| 598 | { | ||
| 599 | int ret = 0; | ||
| 600 | |||
| 601 | /* is this message from a local user? */ | ||
| 602 | if (xs_startswith(xs_dict_get(msg, "id"), srv_baseurl)) { | ||
| 603 | const char *atto = get_atto(msg); | ||
| 604 | xs *l = xs_split(atto, "/"); | ||
| 605 | const char *uid = xs_list_get(l, -1); | ||
| 606 | snac user; | ||
| 607 | |||
| 608 | if (uid && user_open(&user, uid)) { | ||
| 609 | if (xs_type(xs_dict_get(user.config, "private")) == XSTYPE_TRUE) | ||
| 610 | ret = 1; | ||
| 611 | |||
| 612 | user_free(&user); | ||
| 613 | } | ||
| 614 | } | ||
| 615 | |||
| 616 | return ret; | ||
| 617 | } | ||
| 618 | |||
| 619 | |||
| 596 | int is_msg_for_me(snac *snac, const xs_dict *c_msg) | 620 | int is_msg_for_me(snac *snac, const xs_dict *c_msg) |
| 597 | /* checks if this message is for me */ | 621 | /* checks if this message is for me */ |
| 598 | { | 622 | { |