summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2022-09-26 09:25:35 +0200
committerGravatar default2022-09-26 09:25:35 +0200
commitc37a99b97cb6f3214b87d4a1c1e16a8b30d4ef52 (patch)
treecf689c7719805155d3f1eb06d60d64e8041951a4
parentRenamed to recipient_list(). (diff)
downloadsnac2-c37a99b97cb6f3214b87d4a1c1e16a8b30d4ef52.tar.gz
snac2-c37a99b97cb6f3214b87d4a1c1e16a8b30d4ef52.tar.xz
snac2-c37a99b97cb6f3214b87d4a1c1e16a8b30d4ef52.zip
New function is_msg_public().
-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)
379} 379}
380 380
381 381
382d_char *recipent_list(snac *snac, char *msg, int expand_public) 382d_char *recipient_list(snac *snac, char *msg, int expand_public)
383/* returns the list of recipients for a message */ 383/* returns the list of recipients for a message */
384{ 384{
385 d_char *list = xs_list_new(); 385 d_char *list = xs_list_new();
@@ -414,6 +414,23 @@ d_char *recipent_list(snac *snac, char *msg, int expand_public)
414} 414}
415 415
416 416
417int is_msg_public(snac *snac, char *msg)
418/* checks if a message is public */
419{
420 int ret = 0;
421 xs *rcpts = recipient_list(snac, msg, 0);
422 char *p, *v;
423
424 p = rcpts;
425 while (!ret && xs_list_iter(&p, &v)) {
426 if (strcmp(v, public_address) == 0)
427 ret = 1;
428 }
429
430 return ret;
431}
432
433
417/** HTTP handlers */ 434/** HTTP handlers */
418 435
419int activitypub_get_handler(d_char *req, char *q_path, 436int activitypub_get_handler(d_char *req, char *q_path,