diff options
| -rw-r--r-- | activitypub.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/activitypub.c b/activitypub.c index ce66dae..bb091ff 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -584,6 +584,9 @@ d_char *msg_note(snac *snac, char *content, char *rcpts, char *in_reply_to, char | |||
| 584 | /* extract the tags */ | 584 | /* extract the tags */ |
| 585 | process_tags(fc2, &fc1, &tag); | 585 | process_tags(fc2, &fc1, &tag); |
| 586 | 586 | ||
| 587 | if (tag == NULL) | ||
| 588 | tag = xs_list_new(); | ||
| 589 | |||
| 587 | if (in_reply_to != NULL) { | 590 | if (in_reply_to != NULL) { |
| 588 | xs *p_msg = NULL; | 591 | xs *p_msg = NULL; |
| 589 | 592 | ||
| @@ -592,11 +595,26 @@ d_char *msg_note(snac *snac, char *content, char *rcpts, char *in_reply_to, char | |||
| 592 | 595 | ||
| 593 | if ((p_msg = timeline_find(snac, in_reply_to)) != NULL) { | 596 | if ((p_msg = timeline_find(snac, in_reply_to)) != NULL) { |
| 594 | /* add this author as recipient */ | 597 | /* add this author as recipient */ |
| 595 | char *v; | 598 | char *a, *v; |
| 599 | |||
| 600 | if ((a = xs_dict_get(p_msg, "attributedTo")) && xs_list_in(to, a) == -1) | ||
| 601 | to = xs_list_append(to, a); | ||
| 602 | |||
| 603 | /* add this author to the tag list as a mention */ | ||
| 604 | xs *t_href; | ||
| 605 | xs *t_name; | ||
| 606 | |||
| 607 | if (!xs_is_null(a) && valid_status(webfinger_request(a, &t_href, &t_name))) { | ||
| 608 | xs *t = xs_dict_new(); | ||
| 596 | 609 | ||
| 597 | if ((v = xs_dict_get(p_msg, "attributedTo")) && xs_list_in(to, v) == -1) | 610 | t = xs_dict_append(t, "type", "Mention"); |
| 598 | to = xs_list_append(to, v); | 611 | t = xs_dict_append(t, "href", t_href); |
| 612 | t = xs_dict_append(t, "name", t_name); | ||
| 599 | 613 | ||
| 614 | tag = xs_list_append(tag, t); | ||
| 615 | } | ||
| 616 | |||
| 617 | /* get the context, if there is one */ | ||
| 600 | if ((v = xs_dict_get(p_msg, "context"))) | 618 | if ((v = xs_dict_get(p_msg, "context"))) |
| 601 | ctxt = xs_dup(v); | 619 | ctxt = xs_dup(v); |
| 602 | 620 | ||
| @@ -635,9 +653,6 @@ d_char *msg_note(snac *snac, char *content, char *rcpts, char *in_reply_to, char | |||
| 635 | } | 653 | } |
| 636 | } | 654 | } |
| 637 | 655 | ||
| 638 | if (tag == NULL) | ||
| 639 | tag = xs_list_new(); | ||
| 640 | |||
| 641 | if (ctxt == NULL) | 656 | if (ctxt == NULL) |
| 642 | ctxt = xs_fmt("%s#ctxt", id); | 657 | ctxt = xs_fmt("%s#ctxt", id); |
| 643 | 658 | ||