mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-10 03:50:38 +03:00
Convert the regex to lowercase in content_search().
Is this a good idea?
This commit is contained in:
parent
34311714ce
commit
2ed0a08f9f
4
data.c
4
data.c
@ -2498,6 +2498,8 @@ xs_list *content_search(snac *user, const char *regex,
|
|||||||
if (regex == NULL || *regex == '\0')
|
if (regex == NULL || *regex == '\0')
|
||||||
return xs_list_new();
|
return xs_list_new();
|
||||||
|
|
||||||
|
xs *i_regex = xs_tolower_i(xs_dup(regex));
|
||||||
|
|
||||||
xs_set seen;
|
xs_set seen;
|
||||||
|
|
||||||
xs_set_init(&seen);
|
xs_set_init(&seen);
|
||||||
@ -2574,7 +2576,7 @@ xs_list *content_search(snac *user, const char *regex,
|
|||||||
c = xs_tolower_i(c);
|
c = xs_tolower_i(c);
|
||||||
|
|
||||||
/* apply regex */
|
/* apply regex */
|
||||||
xs *l = xs_regex_select_n(c, regex, 1);
|
xs *l = xs_regex_select_n(c, i_regex, 1);
|
||||||
|
|
||||||
if (xs_list_len(l)) {
|
if (xs_list_len(l)) {
|
||||||
if (xs_set_add(&seen, md5) == 1)
|
if (xs_set_add(&seen, md5) == 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user