diff options
| -rw-r--r-- | activitypub.c | 18 | ||||
| -rw-r--r-- | html.c | 4 | ||||
| -rw-r--r-- | mastoapi.c | 2 | ||||
| -rw-r--r-- | snac.h | 1 |
4 files changed, 19 insertions, 6 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 | ||
| @@ -1670,7 +1670,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 1670 | if (strcmp(type, "Note") == 0) { | 1670 | if (strcmp(type, "Note") == 0) { |
| 1671 | if (level == 0) { | 1671 | if (level == 0) { |
| 1672 | /* is the parent not here? */ | 1672 | /* is the parent not here? */ |
| 1673 | const char *parent = xs_dict_get(msg, "inReplyTo"); | 1673 | const char *parent = get_in_reply_to(msg); |
| 1674 | 1674 | ||
| 1675 | if (user && !xs_is_null(parent) && *parent && !timeline_here(user, parent)) { | 1675 | if (user && !xs_is_null(parent) && *parent && !timeline_here(user, parent)) { |
| 1676 | xs_html_add(post_header, | 1676 | xs_html_add(post_header, |
| @@ -2329,7 +2329,7 @@ xs_str *html_timeline(snac *user, const xs_list *list, int read_only, | |||
| 2329 | 2329 | ||
| 2330 | /* is this message a non-public reply? */ | 2330 | /* is this message a non-public reply? */ |
| 2331 | if (user != NULL && !is_msg_public(msg)) { | 2331 | if (user != NULL && !is_msg_public(msg)) { |
| 2332 | const char *irt = xs_dict_get(msg, "inReplyTo"); | 2332 | const char *irt = get_in_reply_to(msg); |
| 2333 | 2333 | ||
| 2334 | /* is it a reply to something not in the storage? */ | 2334 | /* is it a reply to something not in the storage? */ |
| 2335 | if (!xs_is_null(irt) && !object_here(irt)) { | 2335 | if (!xs_is_null(irt) && !object_here(irt)) { |
| @@ -1024,7 +1024,7 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg) | |||
| 1024 | st = xs_dict_append(st, "in_reply_to_id", xs_stock(XSTYPE_NULL)); | 1024 | st = xs_dict_append(st, "in_reply_to_id", xs_stock(XSTYPE_NULL)); |
| 1025 | st = xs_dict_append(st, "in_reply_to_account_id", xs_stock(XSTYPE_NULL)); | 1025 | st = xs_dict_append(st, "in_reply_to_account_id", xs_stock(XSTYPE_NULL)); |
| 1026 | 1026 | ||
| 1027 | tmp = xs_dict_get(msg, "inReplyTo"); | 1027 | tmp = get_in_reply_to(msg); |
| 1028 | if (!xs_is_null(tmp)) { | 1028 | if (!xs_is_null(tmp)) { |
| 1029 | xs *irto = NULL; | 1029 | xs *irto = NULL; |
| 1030 | 1030 | ||
| @@ -296,6 +296,7 @@ const char *default_avatar_base64(void); | |||
| 296 | xs_str *process_tags(snac *snac, const char *content, xs_list **tag); | 296 | xs_str *process_tags(snac *snac, const char *content, xs_list **tag); |
| 297 | 297 | ||
| 298 | const char *get_atto(const xs_dict *msg); | 298 | const char *get_atto(const xs_dict *msg); |
| 299 | const char *get_in_reply_to(const xs_dict *msg); | ||
| 299 | xs_list *get_attachments(const xs_dict *msg); | 300 | xs_list *get_attachments(const xs_dict *msg); |
| 300 | 301 | ||
| 301 | xs_dict *msg_admiration(snac *snac, const char *object, const char *type); | 302 | xs_dict *msg_admiration(snac *snac, const char *object, const char *type); |