diff options
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/activitypub.c b/activitypub.c index 0b2fc6a..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 | ||
| @@ -724,7 +736,7 @@ xs_str *process_tags(snac *snac, const char *content, xs_list **tag) | |||
| 724 | /* use this same server */ | 736 | /* use this same server */ |
| 725 | def_srv = xs_dup(xs_dict_get(srv_config, "host")); | 737 | def_srv = xs_dup(xs_dict_get(srv_config, "host")); |
| 726 | 738 | ||
| 727 | split = xs_regex_split(content, "(@[A-Za-z0-9_]+(@[A-Za-z0-9\\.-]+)?|&#[0-9]+;|#[^[:punct:][:space:]]+)"); | 739 | split = xs_regex_split(content, "(@[A-Za-z0-9_]+(@[A-Za-z0-9\\.-]+)?|&#[0-9]+;|#(_|[^[:punct:][:space:]])+)"); |
| 728 | 740 | ||
| 729 | p = split; | 741 | p = split; |
| 730 | while (xs_list_iter(&p, &v)) { | 742 | while (xs_list_iter(&p, &v)) { |
| @@ -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 | ||