mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 05:15:04 +00:00
In msg_note(), also add the in_reply_to author as a tag.Mention.
This commit is contained in:
parent
ade45f979e
commit
9145cca97a
1 changed files with 21 additions and 6 deletions
|
@ -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 ((v = xs_dict_get(p_msg, "attributedTo")) && xs_list_in(to, v) == -1)
|
||||
to = xs_list_append(to, 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();
|
||||
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue