summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2022-09-26 09:25:35 +0200
committerdefault <nobody@localhost>2022-09-26 09:25:35 +0200
commitc37a99b97cb6f3214b87d4a1c1e16a8b30d4ef52 (patch)
treecf689c7719805155d3f1eb06d60d64e8041951a4 /activitypub.c
parente0e86d269abf596b4af3296152ccfe86de1139bd (diff)
New function is_msg_public().
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/activitypub.c b/activitypub.c
index 8c3f10f..923028c 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -379,7 +379,7 @@ void process_queue(snac *snac)
}
-d_char *recipent_list(snac *snac, char *msg, int expand_public)
+d_char *recipient_list(snac *snac, char *msg, int expand_public)
/* returns the list of recipients for a message */
{
d_char *list = xs_list_new();
@@ -414,6 +414,23 @@ d_char *recipent_list(snac *snac, char *msg, int expand_public)
}
+int is_msg_public(snac *snac, char *msg)
+/* checks if a message is public */
+{
+ int ret = 0;
+ xs *rcpts = recipient_list(snac, msg, 0);
+ char *p, *v;
+
+ p = rcpts;
+ while (!ret && xs_list_iter(&p, &v)) {
+ if (strcmp(v, public_address) == 0)
+ ret = 1;
+ }
+
+ return ret;
+}
+
+
/** HTTP handlers */
int activitypub_get_handler(d_char *req, char *q_path,