diff options
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 13 |
1 files changed, 9 insertions, 4 deletions
| @@ -2491,7 +2491,8 @@ void notify_clear(snac *snac) | |||
| 2491 | 2491 | ||
| 2492 | /** searches **/ | 2492 | /** searches **/ |
| 2493 | 2493 | ||
| 2494 | xs_list *content_search(snac *user, const char *regex, int priv, int max_secs, int max_res, int *timeout) | 2494 | xs_list *content_search(snac *user, const char *regex, |
| 2495 | int priv, int skip, int show, int max_secs, int *timeout) | ||
| 2495 | /* returns a list of posts which content matches the regex */ | 2496 | /* returns a list of posts which content matches the regex */ |
| 2496 | { | 2497 | { |
| 2497 | if (regex == NULL || *regex == '\0') | 2498 | if (regex == NULL || *regex == '\0') |
| @@ -2520,7 +2521,7 @@ xs_list *content_search(snac *user, const char *regex, int priv, int max_secs, i | |||
| 2520 | xs_list_next(pub_tl, &pub_md5, &pub_c); | 2521 | xs_list_next(pub_tl, &pub_md5, &pub_c); |
| 2521 | xs_list_next(priv_tl, &priv_md5, &priv_c); | 2522 | xs_list_next(priv_tl, &priv_md5, &priv_c); |
| 2522 | 2523 | ||
| 2523 | while (max_res > 0) { | 2524 | while (show > 0) { |
| 2524 | char *md5 = NULL; | 2525 | char *md5 = NULL; |
| 2525 | enum { NONE, PUBLIC, PRIVATE } from = NONE; | 2526 | enum { NONE, PUBLIC, PRIVATE } from = NONE; |
| 2526 | 2527 | ||
| @@ -2591,8 +2592,12 @@ xs_list *content_search(snac *user, const char *regex, int priv, int max_secs, i | |||
| 2591 | xs *l = xs_regex_select_n(c, regex, 1); | 2592 | xs *l = xs_regex_select_n(c, regex, 1); |
| 2592 | 2593 | ||
| 2593 | if (xs_list_len(l)) { | 2594 | if (xs_list_len(l)) { |
| 2594 | xs_set_add(&seen, md5); | 2595 | if (skip) |
| 2595 | max_res--; | 2596 | skip--; |
| 2597 | else { | ||
| 2598 | xs_set_add(&seen, md5); | ||
| 2599 | show--; | ||
| 2600 | } | ||
| 2596 | } | 2601 | } |
| 2597 | } | 2602 | } |
| 2598 | 2603 | ||