diff options
| author | 2024-05-10 11:55:45 +0200 | |
|---|---|---|
| committer | 2024-05-10 11:55:45 +0200 | |
| commit | 5d1577af3ceaad8e3e89cf53a1c523e6a5c710a6 (patch) | |
| tree | 499b520ed2fb18dcdcc60866178de6eee70e9681 | |
| parent | More content_search() tweaks. (diff) | |
| download | penes-snac2-5d1577af3ceaad8e3e89cf53a1c523e6a5c710a6.tar.gz penes-snac2-5d1577af3ceaad8e3e89cf53a1c523e6a5c710a6.tar.xz penes-snac2-5d1577af3ceaad8e3e89cf53a1c523e6a5c710a6.zip | |
More web ui search tweaks baaaaah I'm boring.
| -rw-r--r-- | data.c | 17 | ||||
| -rw-r--r-- | html.c | 2 |
2 files changed, 13 insertions, 6 deletions
| @@ -2499,8 +2499,10 @@ xs_list *content_search(snac *user, const char *regex, | |||
| 2499 | return xs_list_new(); | 2499 | return xs_list_new(); |
| 2500 | 2500 | ||
| 2501 | xs_set seen; | 2501 | xs_set seen; |
| 2502 | xs_set skipped; | ||
| 2502 | 2503 | ||
| 2503 | xs_set_init(&seen); | 2504 | xs_set_init(&seen); |
| 2505 | xs_set_init(&skipped); | ||
| 2504 | 2506 | ||
| 2505 | if (max_secs == 0) | 2507 | if (max_secs == 0) |
| 2506 | max_secs = 3; | 2508 | max_secs = 3; |
| @@ -2592,14 +2594,19 @@ xs_list *content_search(snac *user, const char *regex, | |||
| 2592 | xs *l = xs_regex_select_n(c, regex, 1); | 2594 | xs *l = xs_regex_select_n(c, regex, 1); |
| 2593 | 2595 | ||
| 2594 | if (xs_list_len(l)) { | 2596 | if (xs_list_len(l)) { |
| 2595 | if (skip > 0) | 2597 | if (skip > 0) { |
| 2596 | skip--; | 2598 | if (xs_set_add(&skipped, md5) == 1) |
| 2597 | else | 2599 | skip--; |
| 2598 | if (xs_set_add(&seen, md5) == 1) | 2600 | } |
| 2599 | show--; | 2601 | else { |
| 2602 | if (xs_set_add(&seen, md5) == 1) | ||
| 2603 | show--; | ||
| 2604 | } | ||
| 2600 | } | 2605 | } |
| 2601 | } | 2606 | } |
| 2602 | 2607 | ||
| 2608 | xs_set_free(&skipped); | ||
| 2609 | |||
| 2603 | return xs_set_result(&seen); | 2610 | return xs_set_result(&seen); |
| 2604 | } | 2611 | } |
| 2605 | 2612 | ||
| @@ -2578,7 +2578,7 @@ int html_get_handler(const xs_dict *req, const char *q_path, | |||
| 2578 | else | 2578 | else |
| 2579 | title = xs_fmt(L("Nothing found for '%s'"), q); | 2579 | title = xs_fmt(L("Nothing found for '%s'"), q); |
| 2580 | 2580 | ||
| 2581 | *body = html_timeline(&snac, tl, 0, skip, show, tl_len > 0, title, page, 1); | 2581 | *body = html_timeline(&snac, tl, 0, skip, tl_len, tl_len > 0, title, page, 1); |
| 2582 | *b_size = strlen(*body); | 2582 | *b_size = strlen(*body); |
| 2583 | status = 200; | 2583 | status = 200; |
| 2584 | } | 2584 | } |