mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-26 06:53:37 +00:00
Made mastoapi account search case-insensitive.
This commit is contained in:
parent
bd8886f8a6
commit
bcf267075d
1 changed files with 10 additions and 5 deletions
11
mastoapi.c
11
mastoapi.c
|
@ -960,9 +960,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
||||||
|
|
||||||
if (logged_in && strcmp(uid, "search") == 0) { /** **/
|
if (logged_in && strcmp(uid, "search") == 0) { /** **/
|
||||||
/* search for accounts starting with q */
|
/* search for accounts starting with q */
|
||||||
const char *q = xs_dict_get(args, "q");
|
const char *aq = xs_dict_get(args, "q");
|
||||||
|
|
||||||
if (!xs_is_null(q)) {
|
if (!xs_is_null(aq)) {
|
||||||
|
xs *q = xs_tolower_i(xs_dup(aq));
|
||||||
out = xs_list_new();
|
out = xs_list_new();
|
||||||
xs *wing = following_list(&snac1);
|
xs *wing = following_list(&snac1);
|
||||||
xs *wers = follower_list(&snac1);
|
xs *wers = follower_list(&snac1);
|
||||||
|
@ -986,7 +987,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
||||||
if (valid_status(object_get(v, &actor))) {
|
if (valid_status(object_get(v, &actor))) {
|
||||||
const char *uname = xs_dict_get(actor, "preferredUsername");
|
const char *uname = xs_dict_get(actor, "preferredUsername");
|
||||||
|
|
||||||
if (!xs_is_null(uname) && xs_startswith(uname, q)) {
|
if (!xs_is_null(uname)) {
|
||||||
|
xs *luname = xs_tolower_i(xs_dup(uname));
|
||||||
|
|
||||||
|
if (xs_startswith(luname, q)) {
|
||||||
xs *acct = mastoapi_account(actor);
|
xs *acct = mastoapi_account(actor);
|
||||||
|
|
||||||
out = xs_list_append(out, acct);
|
out = xs_list_append(out, acct);
|
||||||
|
@ -994,6 +998,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
xs_set_free(&seen);
|
xs_set_free(&seen);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue