diff options
| -rw-r--r-- | activitypub.c | 19 |
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 | ||
| 382 | d_char *recipent_list(snac *snac, char *msg, int expand_public) | 382 | d_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 | ||
| 417 | int 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 | ||
| 419 | int activitypub_get_handler(d_char *req, char *q_path, | 436 | int activitypub_get_handler(d_char *req, char *q_path, |