Minor refactor to msg_note(): the tag list is created here, not in process_tags().

This commit is contained in:
default 2023-05-12 10:33:59 +02:00
parent 3d4bf235f0
commit 2e27a805fc

View file

@ -362,7 +362,7 @@ void process_tags(snac *snac, const char *content, xs_str **n_content, xs_list *
/* parses mentions and tags from content */ /* parses mentions and tags from content */
{ {
xs_str *nc = xs_str_new(NULL); xs_str *nc = xs_str_new(NULL);
xs_list *tl = xs_list_new(); xs_list *tl = *tag;
xs *split; xs *split;
xs_list *p; xs_list *p;
xs_val *v; xs_val *v;
@ -711,7 +711,7 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
xs *to = NULL; xs *to = NULL;
xs *cc = xs_list_new(); xs *cc = xs_list_new();
xs *irt = NULL; xs *irt = NULL;
xs *tag = NULL; xs *tag = xs_list_new();
xs *atls = NULL; xs *atls = NULL;
xs_dict *msg = msg_base(snac, "Note", id, NULL, "@now", NULL); xs_dict *msg = msg_base(snac, "Note", id, NULL, "@now", NULL);
xs_list *p; xs_list *p;
@ -731,12 +731,6 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
/* format the content */ /* format the content */
fc2 = not_really_markdown(content); fc2 = not_really_markdown(content);
/* extract the tags */
process_tags(snac, fc2, &fc1, &tag);
if (tag == NULL)
tag = xs_list_new();
if (in_reply_to != NULL && *in_reply_to) { if (in_reply_to != NULL && *in_reply_to) {
xs *p_msg = NULL; xs *p_msg = NULL;
xs *wrk = NULL; xs *wrk = NULL;
@ -779,6 +773,9 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
else else
irt = xs_val_new(XSTYPE_NULL); irt = xs_val_new(XSTYPE_NULL);
/* extract the mentions and hashtags and convert the content */
process_tags(snac, fc2, &fc1, &tag);
/* create the attachment list, if there are any */ /* create the attachment list, if there are any */
if (!xs_is_null(attach)) { if (!xs_is_null(attach)) {
atls = xs_list_new(); atls = xs_list_new();