diff options
| author | 2023-03-02 09:15:40 +0100 | |
|---|---|---|
| committer | 2023-03-02 09:15:40 +0100 | |
| commit | 29b12498dd511b00586446b98f11ccb1d44088eb (patch) | |
| tree | 3b7178a7770a4d99712b6b69f9848d7b71d51085 /activitypub.c | |
| parent | Renamed inboxes/ to inbox/. (diff) | |
| download | snac2-29b12498dd511b00586446b98f11ccb1d44088eb.tar.gz snac2-29b12498dd511b00586446b98f11ccb1d44088eb.tar.xz snac2-29b12498dd511b00586446b98f11ccb1d44088eb.zip | |
Simplified is_msg_public().
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/activitypub.c b/activitypub.c index 498ba1f..79c20d7 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -279,46 +279,13 @@ d_char *recipient_list(snac *snac, char *msg, int expand_public) | |||
| 279 | } | 279 | } |
| 280 | 280 | ||
| 281 | 281 | ||
| 282 | #if 0 | 282 | int is_msg_public(snac *snac, xs_dict *msg) |
| 283 | d_char *inbox_list(snac *snac, char *msg) | ||
| 284 | /* returns the list of inboxes that are recipients of this message */ | ||
| 285 | { | ||
| 286 | xs *rcpts = recipient_list(snac, msg, 1); | ||
| 287 | xs_set inboxes; | ||
| 288 | char *p, *v; | ||
| 289 | |||
| 290 | xs_set_init(&inboxes); | ||
| 291 | |||
| 292 | p = rcpts; | ||
| 293 | while (xs_list_iter(&p, &v)) { | ||
| 294 | xs *inbox; | ||
| 295 | |||
| 296 | if ((inbox = get_actor_inbox(snac, v)) != NULL) { | ||
| 297 | /* add the inbox if it's not already there */ | ||
| 298 | xs_set_add(&inboxes, inbox); | ||
| 299 | } | ||
| 300 | else | ||
| 301 | snac_log(snac, xs_fmt("cannot find inbox for %s", v)); | ||
| 302 | } | ||
| 303 | |||
| 304 | return xs_set_result(&inboxes); | ||
| 305 | } | ||
| 306 | #endif | ||
| 307 | |||
| 308 | int is_msg_public(snac *snac, char *msg) | ||
| 309 | /* checks if a message is public */ | 283 | /* checks if a message is public */ |
| 310 | { | 284 | { |
| 311 | int ret = 0; | 285 | int ret = 0; |
| 312 | xs *rcpts = recipient_list(snac, msg, 0); | 286 | xs *rcpts = recipient_list(snac, msg, 0); |
| 313 | char *p, *v; | ||
| 314 | |||
| 315 | p = rcpts; | ||
| 316 | while (!ret && xs_list_iter(&p, &v)) { | ||
| 317 | if (strcmp(v, public_address) == 0) | ||
| 318 | ret = 1; | ||
| 319 | } | ||
| 320 | 287 | ||
| 321 | return ret; | 288 | return xs_list_in(rcpts, public_address) != -1; |
| 322 | } | 289 | } |
| 323 | 290 | ||
| 324 | 291 | ||