summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mastoapi.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 28418e6..43090bc 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -878,6 +878,11 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg)
878 st = xs_dict_append(st, "reblogged", 878 st = xs_dict_append(st, "reblogged",
879 (snac && xs_list_in(idx, snac->md5) != -1) ? xs_stock_true : xs_stock_false); 879 (snac && xs_list_in(idx, snac->md5) != -1) ? xs_stock_true : xs_stock_false);
880 880
881 /* get the last person who boosted this */
882 xs *boosted_by_md5 = NULL;
883 if (xs_list_len(idx))
884 boosted_by_md5 = xs_dup(xs_list_get(idx, -1));
885
881 xs_free(idx); 886 xs_free(idx);
882 xs_free(ixc); 887 xs_free(ixc);
883 idx = object_children(id); 888 idx = object_children(id);
@@ -933,6 +938,28 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg)
933 st = xs_dict_append(st, "pinned", 938 st = xs_dict_append(st, "pinned",
934 (snac && is_pinned(snac, id)) ? xs_stock_true : xs_stock_false); 939 (snac && is_pinned(snac, id)) ? xs_stock_true : xs_stock_false);
935 940
941 /* is it a boost? */
942 if (!xs_is_null(boosted_by_md5)) {
943 /* create a new dummy status, using st as the 'reblog' field */
944 xs_dict *bst = xs_dict_new();
945 xs *b_actor = NULL;
946
947 if (valid_status(object_get_by_md5(boosted_by_md5, &b_actor))) {
948 xs *b_acct = mastoapi_account(b_actor);
949 xs *fake_uri = xs_fmt("%s/d/%s", srv_baseurl, mid);
950
951 bst = xs_dict_append(bst, "id", mid);
952 bst = xs_dict_append(bst, "created_at", xs_dict_get(st, "created_at"));
953 bst = xs_dict_append(bst, "account", b_acct);
954 bst = xs_dict_append(bst, "uri", fake_uri);
955 bst = xs_dict_append(bst, "content", "");
956 bst = xs_dict_append(bst, "reblog", st);
957
958 xs_free(st);
959 st = bst;
960 }
961 }
962
936 return st; 963 return st;
937} 964}
938 965