commit 9145cca
default
·
2022-11-22 19:31:22 +0000 UTC
parent ade45f9
In msg_note(), also add the in_reply_to author as a tag.Mention.
1 files changed,
+21,
-6
+21,
-6
1@@ -584,6 +584,9 @@ d_char *msg_note(snac *snac, char *content, char *rcpts, char *in_reply_to, char
2 /* extract the tags */
3 process_tags(fc2, &fc1, &tag);
4
5+ if (tag == NULL)
6+ tag = xs_list_new();
7+
8 if (in_reply_to != NULL) {
9 xs *p_msg = NULL;
10
11@@ -592,11 +595,26 @@ d_char *msg_note(snac *snac, char *content, char *rcpts, char *in_reply_to, char
12
13 if ((p_msg = timeline_find(snac, in_reply_to)) != NULL) {
14 /* add this author as recipient */
15- char *v;
16+ char *a, *v;
17+
18+ if ((a = xs_dict_get(p_msg, "attributedTo")) && xs_list_in(to, a) == -1)
19+ to = xs_list_append(to, a);
20+
21+ /* add this author to the tag list as a mention */
22+ xs *t_href;
23+ xs *t_name;
24+
25+ if (!xs_is_null(a) && valid_status(webfinger_request(a, &t_href, &t_name))) {
26+ xs *t = xs_dict_new();
27
28- if ((v = xs_dict_get(p_msg, "attributedTo")) && xs_list_in(to, v) == -1)
29- to = xs_list_append(to, v);
30+ t = xs_dict_append(t, "type", "Mention");
31+ t = xs_dict_append(t, "href", t_href);
32+ t = xs_dict_append(t, "name", t_name);
33
34+ tag = xs_list_append(tag, t);
35+ }
36+
37+ /* get the context, if there is one */
38 if ((v = xs_dict_get(p_msg, "context")))
39 ctxt = xs_dup(v);
40
41@@ -635,9 +653,6 @@ d_char *msg_note(snac *snac, char *content, char *rcpts, char *in_reply_to, char
42 }
43 }
44
45- if (tag == NULL)
46- tag = xs_list_new();
47-
48 if (ctxt == NULL)
49 ctxt = xs_fmt("%s#ctxt", id);
50