summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 09e18a1..62108ad 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -1348,7 +1348,7 @@ xs_list *mastoapi_timeline(snac *user, const xs_dict *args, const char *index_fn
1348 if (limit == 0) 1348 if (limit == 0)
1349 limit = 20; 1349 limit = 20;
1350 1350
1351 if (min_id == NULL && index_desc_first(f, md5, 0)) { 1351 if (index_desc_first(f, md5, 0)) {
1352 do { 1352 do {
1353 xs *msg = NULL; 1353 xs *msg = NULL;
1354 1354
@@ -1366,6 +1366,11 @@ xs_list *mastoapi_timeline(snac *user, const xs_dict *args, const char *index_fn
1366 break; 1366 break;
1367 } 1367 }
1368 1368
1369 if (min_id) {
1370 if (strcmp(md5, MID_TO_MD5(min_id)) == 0)
1371 break;
1372 }
1373
1369 /* get the entry */ 1374 /* get the entry */
1370 if (user) { 1375 if (user) {
1371 if (!valid_status(timeline_get_by_md5(user, md5, &msg))) 1376 if (!valid_status(timeline_get_by_md5(user, md5, &msg)))
@@ -1435,8 +1440,14 @@ xs_list *mastoapi_timeline(snac *user, const xs_dict *args, const char *index_fn
1435 out = xs_list_append(out, st); 1440 out = xs_list_append(out, st);
1436 cnt++; 1441 cnt++;
1437 } 1442 }
1443 if (min_id) {
1444 while (cnt > limit) {
1445 out = xs_list_del(out, 0);
1446 cnt--;
1447 }
1448 }
1438 1449
1439 } while (cnt < limit && index_desc_next(f, md5)); 1450 } while ((min_id || (cnt < limit)) && index_desc_next(f, md5));
1440 } 1451 }
1441 1452
1442 int more = index_desc_next(f, md5); 1453 int more = index_desc_next(f, md5);
@@ -2589,6 +2600,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
2589 const char *visibility = xs_dict_get(args, "visibility"); 2600 const char *visibility = xs_dict_get(args, "visibility");
2590 const char *summary = xs_dict_get(args, "spoiler_text"); 2601 const char *summary = xs_dict_get(args, "spoiler_text");
2591 const char *media_ids = xs_dict_get(args, "media_ids"); 2602 const char *media_ids = xs_dict_get(args, "media_ids");
2603 const char *language = xs_dict_get(args, "language");
2592 2604
2593 if (xs_is_null(media_ids)) 2605 if (xs_is_null(media_ids))
2594 media_ids = xs_dict_get(args, "media_ids[]"); 2606 media_ids = xs_dict_get(args, "media_ids[]");
@@ -2639,7 +2651,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
2639 2651
2640 /* prepare the message */ 2652 /* prepare the message */
2641 xs *msg = msg_note(&snac, content, NULL, irt, attach_list, 2653 xs *msg = msg_note(&snac, content, NULL, irt, attach_list,
2642 strcmp(visibility, "public") == 0 ? 0 : 1); 2654 strcmp(visibility, "public") == 0 ? 0 : 1, language);
2643 2655
2644 if (!xs_is_null(summary) && *summary) { 2656 if (!xs_is_null(summary) && *summary) {
2645 msg = xs_dict_set(msg, "sensitive", xs_stock(XSTYPE_TRUE)); 2657 msg = xs_dict_set(msg, "sensitive", xs_stock(XSTYPE_TRUE));
@@ -2989,7 +3001,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
2989 if (o) { 3001 if (o) {
2990 const char *name = xs_dict_get(o, "name"); 3002 const char *name = xs_dict_get(o, "name");
2991 3003
2992 xs *msg = msg_note(&snac, "", atto, (char *)id, NULL, 1); 3004 xs *msg = msg_note(&snac, "", atto, (char *)id, NULL, 1, NULL);
2993 msg = xs_dict_append(msg, "name", name); 3005 msg = xs_dict_append(msg, "name", name);
2994 3006
2995 xs *c_msg = msg_create(&snac, msg); 3007 xs *c_msg = msg_create(&snac, msg);