summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authorGravatar default2023-04-26 21:07:00 +0200
committerGravatar default2023-04-26 21:07:00 +0200
commitdd4ba7969f5e48544ab2e1833c353ef9830733c5 (patch)
tree1a5a34ed3dc71252e9cc0fb18133c890e677db86 /mastoapi.c
parentFixed crash in mastoapi search. (diff)
downloadsnac2-dd4ba7969f5e48544ab2e1833c353ef9830733c5.tar.gz
snac2-dd4ba7969f5e48544ab2e1833c353ef9830733c5.tar.xz
snac2-dd4ba7969f5e48544ab2e1833c353ef9830733c5.zip
Fixed video attachments.
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/mastoapi.c b/mastoapi.c
index d7bc8c1..18028cd 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -570,23 +570,25 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg)
570 while (xs_list_iter(&att, &aobj)) { 570 while (xs_list_iter(&att, &aobj)) {
571 const char *mtype = xs_dict_get(aobj, "mediaType"); 571 const char *mtype = xs_dict_get(aobj, "mediaType");
572 572
573 if (!xs_is_null(mtype) && xs_startswith(mtype, "image/")) { 573 if (!xs_is_null(mtype)) {
574 xs *matteid = xs_fmt("%s_%d", id, xs_list_len(matt)); 574 if (xs_startswith(mtype, "image/") || xs_startswith(mtype, "video/")) {
575 xs *matte = xs_dict_new(); 575 xs *matteid = xs_fmt("%s_%d", id, xs_list_len(matt));
576 xs *matte = xs_dict_new();
576 577
577 matte = xs_dict_append(matte, "id", matteid); 578 matte = xs_dict_append(matte, "id", matteid);
578 matte = xs_dict_append(matte, "type", "image"); 579 matte = xs_dict_append(matte, "type", *mtype == 'i' ? "image" : "video");
579 matte = xs_dict_append(matte, "url", xs_dict_get(aobj, "url")); 580 matte = xs_dict_append(matte, "url", xs_dict_get(aobj, "url"));
580 matte = xs_dict_append(matte, "preview_url", xs_dict_get(aobj, "url")); 581 matte = xs_dict_append(matte, "preview_url", xs_dict_get(aobj, "url"));
581 matte = xs_dict_append(matte, "remote_url", xs_dict_get(aobj, "url")); 582 matte = xs_dict_append(matte, "remote_url", xs_dict_get(aobj, "url"));
582 583
583 const char *name = xs_dict_get(aobj, "name"); 584 const char *name = xs_dict_get(aobj, "name");
584 if (xs_is_null(name)) 585 if (xs_is_null(name))
585 name = ""; 586 name = "";
586 587
587 matte = xs_dict_append(matte, "description", name); 588 matte = xs_dict_append(matte, "description", name);
588 589
589 matt = xs_list_append(matt, matte); 590 matt = xs_list_append(matt, matte);
591 }
590 } 592 }
591 } 593 }
592 594