diff options
| -rw-r--r-- | mastoapi.c | 15 |
1 files changed, 10 insertions, 5 deletions
| @@ -960,9 +960,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 960 | 960 | ||
| 961 | if (logged_in && strcmp(uid, "search") == 0) { /** **/ | 961 | if (logged_in && strcmp(uid, "search") == 0) { /** **/ |
| 962 | /* search for accounts starting with q */ | 962 | /* search for accounts starting with q */ |
| 963 | const char *q = xs_dict_get(args, "q"); | 963 | const char *aq = xs_dict_get(args, "q"); |
| 964 | 964 | ||
| 965 | if (!xs_is_null(q)) { | 965 | if (!xs_is_null(aq)) { |
| 966 | xs *q = xs_tolower_i(xs_dup(aq)); | ||
| 966 | out = xs_list_new(); | 967 | out = xs_list_new(); |
| 967 | xs *wing = following_list(&snac1); | 968 | xs *wing = following_list(&snac1); |
| 968 | xs *wers = follower_list(&snac1); | 969 | xs *wers = follower_list(&snac1); |
| @@ -986,10 +987,14 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 986 | if (valid_status(object_get(v, &actor))) { | 987 | if (valid_status(object_get(v, &actor))) { |
| 987 | const char *uname = xs_dict_get(actor, "preferredUsername"); | 988 | const char *uname = xs_dict_get(actor, "preferredUsername"); |
| 988 | 989 | ||
| 989 | if (!xs_is_null(uname) && xs_startswith(uname, q)) { | 990 | if (!xs_is_null(uname)) { |
| 990 | xs *acct = mastoapi_account(actor); | 991 | xs *luname = xs_tolower_i(xs_dup(uname)); |
| 991 | 992 | ||
| 992 | out = xs_list_append(out, acct); | 993 | if (xs_startswith(luname, q)) { |
| 994 | xs *acct = mastoapi_account(actor); | ||
| 995 | |||
| 996 | out = xs_list_append(out, acct); | ||
| 997 | } | ||
| 993 | } | 998 | } |
| 994 | } | 999 | } |
| 995 | } | 1000 | } |