summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--activitypub.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/activitypub.c b/activitypub.c
index 19ac607..18ed25c 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -772,7 +772,7 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
772 xs *cc = xs_list_new(); 772 xs *cc = xs_list_new();
773 xs *irt = NULL; 773 xs *irt = NULL;
774 xs *tag = xs_list_new(); 774 xs *tag = xs_list_new();
775 xs *atls = NULL; 775 xs *atls = xs_list_new();
776 xs_dict *msg = msg_base(snac, "Note", id, NULL, "@now", NULL); 776 xs_dict *msg = msg_base(snac, "Note", id, NULL, "@now", NULL);
777 xs_list *p; 777 xs_list *p;
778 xs_val *v; 778 xs_val *v;
@@ -838,10 +838,8 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
838 838
839 /* create the attachment list, if there are any */ 839 /* create the attachment list, if there are any */
840 if (!xs_is_null(attach)) { 840 if (!xs_is_null(attach)) {
841 atls = xs_list_new();
842
843 while (xs_list_iter(&attach, &v)) { 841 while (xs_list_iter(&attach, &v)) {
844 xs *d = xs_dict_new(); 842 xs *d = xs_dict_new();
845 char *url = xs_list_get(v, 0); 843 char *url = xs_list_get(v, 0);
846 char *alt = xs_list_get(v, 1); 844 char *alt = xs_list_get(v, 1);
847 char *mime = xs_mime_by_ext(url); 845 char *mime = xs_mime_by_ext(url);
@@ -897,7 +895,7 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
897 895
898 msg = xs_dict_append(msg, "sourceContent", content); 896 msg = xs_dict_append(msg, "sourceContent", content);
899 897
900 if (atls != NULL) 898 if (xs_list_len(atls))
901 msg = xs_dict_append(msg, "attachment", atls); 899 msg = xs_dict_append(msg, "attachment", atls);
902 900
903 return msg; 901 return msg;