diff options
| author | 2022-09-26 09:25:35 +0200 | |
|---|---|---|
| committer | 2022-09-26 09:25:35 +0200 | |
| commit | c37a99b97cb6f3214b87d4a1c1e16a8b30d4ef52 (patch) | |
| tree | cf689c7719805155d3f1eb06d60d64e8041951a4 /activitypub.c | |
| parent | Renamed to recipient_list(). (diff) | |
| download | snac2-c37a99b97cb6f3214b87d4a1c1e16a8b30d4ef52.tar.gz snac2-c37a99b97cb6f3214b87d4a1c1e16a8b30d4ef52.tar.xz snac2-c37a99b97cb6f3214b87d4a1c1e16a8b30d4ef52.zip | |
New function is_msg_public().
Diffstat (limited to 'activitypub.c')
| -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, |