diff options
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 | { |