summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authorGravatar grunfink2025-05-22 11:15:07 +0200
committerGravatar grunfink2025-05-22 11:15:07 +0200
commit096bb217105202ce6ec5bad046fd70cc3e3508cd (patch)
treee739fef7755347dc2f80f31b782467461ae3bacd /mastoapi.c
parentMerge pull request 'Improvements for Russian translation (инстанция ... (diff)
parentadd missed replacement to the `mastoapi_get_handler` function (`search` case) (diff)
downloadpenes-snac2-096bb217105202ce6ec5bad046fd70cc3e3508cd.tar.gz
penes-snac2-096bb217105202ce6ec5bad046fd70cc3e3508cd.tar.xz
penes-snac2-096bb217105202ce6ec5bad046fd70cc3e3508cd.zip
Merge pull request 'use utf-8 lowercase function for tags #396' (#400) from postscriptum/snac2:utf8-lower-tags into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/400
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/mastoapi.c b/mastoapi.c
index a7d9c34..c46a971 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -15,6 +15,7 @@
15#include "xs_url.h" 15#include "xs_url.h"
16#include "xs_mime.h" 16#include "xs_mime.h"
17#include "xs_match.h" 17#include "xs_match.h"
18#include "xs_unicode.h"
18 19
19#include "snac.h" 20#include "snac.h"
20 21
@@ -381,7 +382,7 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
381 } 382 }
382 } 383 }
383 384
384 /* no code? 385 /* no code?
385 I'm not sure of the impacts of this right now, but Subway Tooter does not 386 I'm not sure of the impacts of this right now, but Subway Tooter does not
386 provide a code so one must be generated */ 387 provide a code so one must be generated */
387 if (xs_is_null(code)){ 388 if (xs_is_null(code)){
@@ -1637,7 +1638,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1637 const char *aq = xs_dict_get(args, "q"); 1638 const char *aq = xs_dict_get(args, "q");
1638 1639
1639 if (!xs_is_null(aq)) { 1640 if (!xs_is_null(aq)) {
1640 xs *q = xs_tolower_i(xs_dup(aq)); 1641 xs *q = xs_utf8_to_lower(xs_dup(aq));
1641 out = xs_list_new(); 1642 out = xs_list_new();
1642 xs *wing = following_list(&snac1); 1643 xs *wing = following_list(&snac1);
1643 xs *wers = follower_list(&snac1); 1644 xs *wers = follower_list(&snac1);
@@ -1780,7 +1781,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1780 } 1781 }
1781 else 1782 else
1782 if (strcmp(opt, "statuses") == 0) { 1783 if (strcmp(opt, "statuses") == 0) {
1783 /* we don't serve statuses of others; return the empty list */ 1784 /* we don't serve statuses of others; return the empty list */
1784 out = xs_list_new(); 1785 out = xs_list_new();
1785 } 1786 }
1786 else 1787 else
@@ -1999,7 +2000,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1999 } 2000 }
2000 else 2001 else
2001 if (strcmp(cmd, "/v2/filters") == 0) { /** **/ 2002 if (strcmp(cmd, "/v2/filters") == 0) { /** **/
2002 /* snac will never have filters 2003 /* snac will never have filters
2003 * but still, without a v2 endpoint a short delay is introduced 2004 * but still, without a v2 endpoint a short delay is introduced
2004 * in some apps */ 2005 * in some apps */
2005 *body = xs_dup("[]"); 2006 *body = xs_dup("[]");
@@ -2459,7 +2460,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
2459 if (logged_in) { 2460 if (logged_in) {
2460 const xs_list *timeline = xs_dict_get(args, "timeline[]"); 2461 const xs_list *timeline = xs_dict_get(args, "timeline[]");
2461 xs_str *json = NULL; 2462 xs_str *json = NULL;
2462 if (!xs_is_null(timeline)) 2463 if (!xs_is_null(timeline))
2463 json = xs_json_dumps(markers_get(&snac1, timeline), 4); 2464 json = xs_json_dumps(markers_get(&snac1, timeline), 4);
2464 2465
2465 if (!xs_is_null(json)) 2466 if (!xs_is_null(json))
@@ -3227,7 +3228,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
3227 if (!xs_is_null(home)) 3228 if (!xs_is_null(home))
3228 home_marker = xs_dict_get(home, "last_read_id"); 3229 home_marker = xs_dict_get(home, "last_read_id");
3229 } 3230 }
3230 3231
3231 const xs_str *notify_marker = xs_dict_get(args, "notifications[last_read_id]"); 3232 const xs_str *notify_marker = xs_dict_get(args, "notifications[last_read_id]");
3232 if (xs_is_null(notify_marker)) { 3233 if (xs_is_null(notify_marker)) {
3233 const xs_dict *notify = xs_dict_get(args, "notifications"); 3234 const xs_dict *notify = xs_dict_get(args, "notifications");