diff options
Diffstat (limited to 'mastoapi.c')
| -rw-r--r-- | mastoapi.c | 9 |
1 files changed, 9 insertions, 0 deletions
| @@ -1826,6 +1826,11 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1826 | const xs_list *excl = xs_dict_get(args, "exclude_types[]"); | 1826 | const xs_list *excl = xs_dict_get(args, "exclude_types[]"); |
| 1827 | const char *min_id = xs_dict_get(args, "min_id"); | 1827 | const char *min_id = xs_dict_get(args, "min_id"); |
| 1828 | const char *max_id = xs_dict_get(args, "max_id"); | 1828 | const char *max_id = xs_dict_get(args, "max_id"); |
| 1829 | const char *limit = xs_dict_get(args, "limit"); | ||
| 1830 | int limit_count = 0; | ||
| 1831 | if (!xs_is_null(limit)) { | ||
| 1832 | limit_count = atoi(limit); | ||
| 1833 | } | ||
| 1829 | 1834 | ||
| 1830 | if (dbglevel) { | 1835 | if (dbglevel) { |
| 1831 | xs *js = xs_json_dumps(args, 0); | 1836 | xs *js = xs_json_dumps(args, 0); |
| @@ -1913,6 +1918,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1913 | } | 1918 | } |
| 1914 | 1919 | ||
| 1915 | out = xs_list_append(out, mn); | 1920 | out = xs_list_append(out, mn); |
| 1921 | if (!xs_is_null(limit)) { | ||
| 1922 | if (--limit_count <= 0) | ||
| 1923 | break; | ||
| 1924 | } | ||
| 1916 | } | 1925 | } |
| 1917 | 1926 | ||
| 1918 | srv_debug(1, xs_fmt("mastoapi_notifications count %d", xs_list_len(out))); | 1927 | srv_debug(1, xs_fmt("mastoapi_notifications count %d", xs_list_len(out))); |