diff options
| author | 2024-11-19 06:46:14 +0100 | |
|---|---|---|
| committer | 2024-11-19 06:46:14 +0100 | |
| commit | 085caa7747a3bbebbd2ec09b3264dc6fcc5a7624 (patch) | |
| tree | 60342848dd7852e8a6448f164a50f57be8a8b5f6 /activitypub.c | |
| parent | Updated TODO. (diff) | |
| download | snac2-085caa7747a3bbebbd2ec09b3264dc6fcc5a7624.tar.gz snac2-085caa7747a3bbebbd2ec09b3264dc6fcc5a7624.tar.xz snac2-085caa7747a3bbebbd2ec09b3264dc6fcc5a7624.zip | |
New function get_in_reply_to().
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/activitypub.c b/activitypub.c index 031b9ac..473675d 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -183,6 +183,18 @@ const char *get_atto(const xs_dict *msg) | |||
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | 185 | ||
| 186 | const char *get_in_reply_to(const xs_dict *msg) | ||
| 187 | /* gets the inReplyTo id */ | ||
| 188 | { | ||
| 189 | const xs_val *in_reply_to = xs_dict_get(msg, "inReplyTo"); | ||
| 190 | |||
| 191 | if (xs_type(in_reply_to) == XSTYPE_DICT) | ||
| 192 | in_reply_to = xs_dict_get(in_reply_to, "id"); | ||
| 193 | |||
| 194 | return in_reply_to; | ||
| 195 | } | ||
| 196 | |||
| 197 | |||
| 186 | xs_list *get_attachments(const xs_dict *msg) | 198 | xs_list *get_attachments(const xs_dict *msg) |
| 187 | /* unify the garbage fire that are the attachments */ | 199 | /* unify the garbage fire that are the attachments */ |
| 188 | { | 200 | { |
| @@ -373,7 +385,7 @@ int timeline_request(snac *snac, const char **id, xs_str **wrk, int level) | |||
| 373 | } | 385 | } |
| 374 | 386 | ||
| 375 | /* does it have an ancestor? */ | 387 | /* does it have an ancestor? */ |
| 376 | const char *in_reply_to = xs_dict_get(object, "inReplyTo"); | 388 | const char *in_reply_to = get_in_reply_to(object); |
| 377 | 389 | ||
| 378 | /* store */ | 390 | /* store */ |
| 379 | timeline_add(snac, nid, object); | 391 | timeline_add(snac, nid, object); |
| @@ -671,7 +683,7 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg) | |||
| 671 | return 3; | 683 | return 3; |
| 672 | 684 | ||
| 673 | /* is this message a reply to another? */ | 685 | /* is this message a reply to another? */ |
| 674 | const char *irt = xs_dict_get(msg, "inReplyTo"); | 686 | const char *irt = get_in_reply_to(msg); |
| 675 | if (!xs_is_null(irt)) { | 687 | if (!xs_is_null(irt)) { |
| 676 | xs *r_msg = NULL; | 688 | xs *r_msg = NULL; |
| 677 | 689 | ||
| @@ -1957,7 +1969,7 @@ int process_input_message(snac *snac, const xs_dict *msg, const xs_dict *req) | |||
| 1957 | 1969 | ||
| 1958 | if (xs_match(utype, "Note|Article")) { /** **/ | 1970 | if (xs_match(utype, "Note|Article")) { /** **/ |
| 1959 | const char *id = xs_dict_get(object, "id"); | 1971 | const char *id = xs_dict_get(object, "id"); |
| 1960 | const char *in_reply_to = xs_dict_get(object, "inReplyTo"); | 1972 | const char *in_reply_to = get_in_reply_to(object); |
| 1961 | const char *atto = get_atto(object); | 1973 | const char *atto = get_atto(object); |
| 1962 | xs *wrk = NULL; | 1974 | xs *wrk = NULL; |
| 1963 | 1975 | ||