diff options
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/activitypub.c b/activitypub.c index 663ee3f..e52db31 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -620,7 +620,7 @@ d_char *msg_follow(snac *snac, char *url_or_uid) | |||
| 620 | } | 620 | } |
| 621 | 621 | ||
| 622 | 622 | ||
| 623 | d_char *msg_note(snac *snac, char *content, char *rcpts, char *in_reply_to, char *attach) | 623 | xs_dict *msg_note(snac *snac, xs_str *content, xs_val *rcpts, xs_str *in_reply_to, xs_list *attach) |
| 624 | /* creates a 'Note' message */ | 624 | /* creates a 'Note' message */ |
| 625 | { | 625 | { |
| 626 | xs *ntid = tid(0); | 626 | xs *ntid = tid(0); |
| @@ -633,8 +633,9 @@ d_char *msg_note(snac *snac, char *content, char *rcpts, char *in_reply_to, char | |||
| 633 | xs *irt = NULL; | 633 | xs *irt = NULL; |
| 634 | xs *tag = NULL; | 634 | xs *tag = NULL; |
| 635 | xs *atls = NULL; | 635 | xs *atls = NULL; |
| 636 | d_char *msg = msg_base(snac, "Note", id, NULL, "@now", NULL); | 636 | xs_dict *msg = msg_base(snac, "Note", id, NULL, "@now", NULL); |
| 637 | char *p, *v; | 637 | xs_list *p; |
| 638 | xs_val *v; | ||
| 638 | 639 | ||
| 639 | if (rcpts == NULL) | 640 | if (rcpts == NULL) |
| 640 | to = xs_list_new(); | 641 | to = xs_list_new(); |
| @@ -700,22 +701,18 @@ d_char *msg_note(snac *snac, char *content, char *rcpts, char *in_reply_to, char | |||
| 700 | irt = xs_val_new(XSTYPE_NULL); | 701 | irt = xs_val_new(XSTYPE_NULL); |
| 701 | 702 | ||
| 702 | /* create the attachment list, if there are any */ | 703 | /* create the attachment list, if there are any */ |
| 703 | if (!xs_is_null(attach) && *attach != '\0') { | 704 | if (!xs_is_null(attach)) { |
| 704 | xs *lsof1 = NULL; | ||
| 705 | |||
| 706 | if (xs_type(attach) == XSTYPE_STRING) { | ||
| 707 | lsof1 = xs_list_append(xs_list_new(), attach); | ||
| 708 | attach = lsof1; | ||
| 709 | } | ||
| 710 | |||
| 711 | atls = xs_list_new(); | 705 | atls = xs_list_new(); |
| 706 | |||
| 712 | while (xs_list_iter(&attach, &v)) { | 707 | while (xs_list_iter(&attach, &v)) { |
| 713 | xs *d = xs_dict_new(); | 708 | xs *d = xs_dict_new(); |
| 714 | char *mime = xs_mime_by_ext(v); | 709 | char *url = xs_list_get(v, 0); |
| 710 | char *alt = xs_list_get(v, 1); | ||
| 711 | char *mime = xs_mime_by_ext(url); | ||
| 715 | 712 | ||
| 716 | d = xs_dict_append(d, "mediaType", mime); | 713 | d = xs_dict_append(d, "mediaType", mime); |
| 717 | d = xs_dict_append(d, "url", v); | 714 | d = xs_dict_append(d, "url", url); |
| 718 | d = xs_dict_append(d, "name", ""); | 715 | d = xs_dict_append(d, "name", alt); |
| 719 | d = xs_dict_append(d, "type", | 716 | d = xs_dict_append(d, "type", |
| 720 | xs_startswith(mime, "image/") ? "Image" : "Document"); | 717 | xs_startswith(mime, "image/") ? "Image" : "Document"); |
| 721 | 718 | ||