commit 2e27a80
default
·
2023-05-12 08:33:59 +0000 UTC
parent 3d4bf23
Minor refactor to msg_note(): the tag list is created here, not in process_tags().
1 files changed,
+5,
-8
+5,
-8
1@@ -362,7 +362,7 @@ void process_tags(snac *snac, const char *content, xs_str **n_content, xs_list *
2 /* parses mentions and tags from content */
3 {
4 xs_str *nc = xs_str_new(NULL);
5- xs_list *tl = xs_list_new();
6+ xs_list *tl = *tag;
7 xs *split;
8 xs_list *p;
9 xs_val *v;
10@@ -711,7 +711,7 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
11 xs *to = NULL;
12 xs *cc = xs_list_new();
13 xs *irt = NULL;
14- xs *tag = NULL;
15+ xs *tag = xs_list_new();
16 xs *atls = NULL;
17 xs_dict *msg = msg_base(snac, "Note", id, NULL, "@now", NULL);
18 xs_list *p;
19@@ -731,12 +731,6 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
20 /* format the content */
21 fc2 = not_really_markdown(content);
22
23- /* extract the tags */
24- process_tags(snac, fc2, &fc1, &tag);
25-
26- if (tag == NULL)
27- tag = xs_list_new();
28-
29 if (in_reply_to != NULL && *in_reply_to) {
30 xs *p_msg = NULL;
31 xs *wrk = NULL;
32@@ -779,6 +773,9 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
33 else
34 irt = xs_val_new(XSTYPE_NULL);
35
36+ /* extract the mentions and hashtags and convert the content */
37+ process_tags(snac, fc2, &fc1, &tag);
38+
39 /* create the attachment list, if there are any */
40 if (!xs_is_null(attach)) {
41 atls = xs_list_new();