diff options
author | default <nobody@localhost> | 2022-11-22 20:31:22 +0100 |
---|---|---|
committer | default <nobody@localhost> | 2022-11-22 20:31:22 +0100 |
commit | 9145cca97a3c1bd12ca4111ef70e542d20f9d96b (patch) | |
tree | b8d01c20ef60fceaf0749bbd70de1b9114f71fc4 /activitypub.c | |
parent | ade45f979eed9f73c3a0a3b88db659a7c3efdff1 (diff) |
In msg_note(), also add the in_reply_to author as a tag.Mention.
Diffstat (limited to 'activitypub.c')
-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 /* extract the tags */ process_tags(fc2, &fc1, &tag); + if (tag == NULL) + tag = xs_list_new(); + if (in_reply_to != NULL) { xs *p_msg = NULL; @@ -592,11 +595,26 @@ d_char *msg_note(snac *snac, char *content, char *rcpts, char *in_reply_to, char if ((p_msg = timeline_find(snac, in_reply_to)) != NULL) { /* add this author as recipient */ - char *v; + char *a, *v; + + if ((a = xs_dict_get(p_msg, "attributedTo")) && xs_list_in(to, a) == -1) + to = xs_list_append(to, a); + + /* add this author to the tag list as a mention */ + xs *t_href; + xs *t_name; + + if (!xs_is_null(a) && valid_status(webfinger_request(a, &t_href, &t_name))) { + xs *t = xs_dict_new(); - if ((v = xs_dict_get(p_msg, "attributedTo")) && xs_list_in(to, v) == -1) - to = xs_list_append(to, v); + t = xs_dict_append(t, "type", "Mention"); + t = xs_dict_append(t, "href", t_href); + t = xs_dict_append(t, "name", t_name); + tag = xs_list_append(tag, t); + } + + /* get the context, if there is one */ if ((v = xs_dict_get(p_msg, "context"))) ctxt = xs_dup(v); @@ -635,9 +653,6 @@ d_char *msg_note(snac *snac, char *content, char *rcpts, char *in_reply_to, char } } - if (tag == NULL) - tag = xs_list_new(); - if (ctxt == NULL) ctxt = xs_fmt("%s#ctxt", id); |