diff options
| author | 2023-03-07 09:40:55 +0100 | |
|---|---|---|
| committer | 2023-03-07 09:40:55 +0100 | |
| commit | 23177e93954951a85af85d579db269372c9eae93 (patch) | |
| tree | e2c3fbaf32d56cb2247f989c43303baa4cb2ada1 | |
| parent | Some improvements to is_msg_for_me(). (diff) | |
| download | snac2-23177e93954951a85af85d579db269372c9eae93.tar.gz snac2-23177e93954951a85af85d579db269372c9eae93.tar.xz snac2-23177e93954951a85af85d579db269372c9eae93.zip | |
is_msg_for_me() also accepts msgs where a followed is cc'ed.
| -rw-r--r-- | activitypub.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/activitypub.c b/activitypub.c index 4e8abf1..dc0afcd 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -304,12 +304,16 @@ int is_msg_for_me(snac *snac, xs_dict *c_msg) | |||
| 304 | xs_str *v; | 304 | xs_str *v; |
| 305 | 305 | ||
| 306 | while(xs_list_iter(&p, &v)) { | 306 | while(xs_list_iter(&p, &v)) { |
| 307 | /* explicitly for me? we're done */ | 307 | /* explicitly for me? accept */ |
| 308 | if (strcmp(v, snac->actor) == 0) | 308 | if (strcmp(v, snac->actor) == 0) |
| 309 | return 2; | 309 | return 2; |
| 310 | |||
| 311 | /* for someone we follow? (probably cc'ed) accept */ | ||
| 312 | if (following_check(snac, v)) | ||
| 313 | return 5; | ||
| 310 | } | 314 | } |
| 311 | 315 | ||
| 312 | /* accept if it's from someone we follow */ | 316 | /* accept if it's by someone we follow */ |
| 313 | char *atto = xs_dict_get(msg, "attributedTo"); | 317 | char *atto = xs_dict_get(msg, "attributedTo"); |
| 314 | 318 | ||
| 315 | if (!xs_is_null(atto) && following_check(snac, atto)) | 319 | if (!xs_is_null(atto) && following_check(snac, atto)) |
| @@ -320,7 +324,7 @@ int is_msg_for_me(snac *snac, xs_dict *c_msg) | |||
| 320 | if (!xs_is_null(irt)) { | 324 | if (!xs_is_null(irt)) { |
| 321 | xs *r_msg = NULL; | 325 | xs *r_msg = NULL; |
| 322 | 326 | ||
| 323 | /* try to get it */ | 327 | /* try to get the replied message */ |
| 324 | if (valid_status(object_get(irt, &r_msg))) { | 328 | if (valid_status(object_get(irt, &r_msg))) { |
| 325 | atto = xs_dict_get(r_msg, "attributedTo"); | 329 | atto = xs_dict_get(r_msg, "attributedTo"); |
| 326 | 330 | ||