summaryrefslogtreecommitdiff
path: root/activitypub.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 /activitypub.c
parent151c5aa6ec4fb0f3b0e0d8ca62f9dc5ad27b14e0 (diff)
New function is_msg_from_private_user().
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c24
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)
}
+int is_msg_from_private_user(const xs_dict *msg)
+/* checks if a message is from a local, private user */
+{
+ int ret = 0;
+
+ /* is this message from a local user? */
+ if (xs_startswith(xs_dict_get(msg, "id"), srv_baseurl)) {
+ const char *atto = get_atto(msg);
+ xs *l = xs_split(atto, "/");
+ const char *uid = xs_list_get(l, -1);
+ snac user;
+
+ if (uid && user_open(&user, uid)) {
+ if (xs_type(xs_dict_get(user.config, "private")) == XSTYPE_TRUE)
+ ret = 1;
+
+ user_free(&user);
+ }
+ }
+
+ return ret;
+}
+
+
int is_msg_for_me(snac *snac, const xs_dict *c_msg)
/* checks if this message is for me */
{