summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-05-12 10:33:59 +0200
committerGravatar default2023-05-12 10:33:59 +0200
commit2e27a805fcdf439fb7d33ca1f37dc00a1cf9fd3a (patch)
tree2394a9dd1b1e9c3793a1f754f641d88131945098
parentMinor function prototype tweak. (diff)
downloadsnac2-2e27a805fcdf439fb7d33ca1f37dc00a1cf9fd3a.tar.gz
snac2-2e27a805fcdf439fb7d33ca1f37dc00a1cf9fd3a.tar.xz
snac2-2e27a805fcdf439fb7d33ca1f37dc00a1cf9fd3a.zip
Minor refactor to msg_note(): the tag list is created here, not in process_tags().
-rw-r--r--activitypub.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/activitypub.c b/activitypub.c
index 1e8ae6d..b322a40 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -362,7 +362,7 @@ void process_tags(snac *snac, const char *content, xs_str **n_content, xs_list *
362/* parses mentions and tags from content */ 362/* parses mentions and tags from content */
363{ 363{
364 xs_str *nc = xs_str_new(NULL); 364 xs_str *nc = xs_str_new(NULL);
365 xs_list *tl = xs_list_new(); 365 xs_list *tl = *tag;
366 xs *split; 366 xs *split;
367 xs_list *p; 367 xs_list *p;
368 xs_val *v; 368 xs_val *v;
@@ -711,7 +711,7 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
711 xs *to = NULL; 711 xs *to = NULL;
712 xs *cc = xs_list_new(); 712 xs *cc = xs_list_new();
713 xs *irt = NULL; 713 xs *irt = NULL;
714 xs *tag = NULL; 714 xs *tag = xs_list_new();
715 xs *atls = NULL; 715 xs *atls = NULL;
716 xs_dict *msg = msg_base(snac, "Note", id, NULL, "@now", NULL); 716 xs_dict *msg = msg_base(snac, "Note", id, NULL, "@now", NULL);
717 xs_list *p; 717 xs_list *p;
@@ -731,12 +731,6 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
731 /* format the content */ 731 /* format the content */
732 fc2 = not_really_markdown(content); 732 fc2 = not_really_markdown(content);
733 733
734 /* extract the tags */
735 process_tags(snac, fc2, &fc1, &tag);
736
737 if (tag == NULL)
738 tag = xs_list_new();
739
740 if (in_reply_to != NULL && *in_reply_to) { 734 if (in_reply_to != NULL && *in_reply_to) {
741 xs *p_msg = NULL; 735 xs *p_msg = NULL;
742 xs *wrk = NULL; 736 xs *wrk = NULL;
@@ -779,6 +773,9 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
779 else 773 else
780 irt = xs_val_new(XSTYPE_NULL); 774 irt = xs_val_new(XSTYPE_NULL);
781 775
776 /* extract the mentions and hashtags and convert the content */
777 process_tags(snac, fc2, &fc1, &tag);
778
782 /* create the attachment list, if there are any */ 779 /* create the attachment list, if there are any */
783 if (!xs_is_null(attach)) { 780 if (!xs_is_null(attach)) {
784 atls = xs_list_new(); 781 atls = xs_list_new();