Renamed to content_search().

This commit is contained in:
default 2024-05-08 11:00:50 +02:00
parent dc74cac6c9
commit 52ba7f030e
3 changed files with 23 additions and 4 deletions

2
data.c
View File

@ -2490,7 +2490,7 @@ void notify_clear(snac *snac)
/** searches **/
xs_list *search_by_content(snac *user, const xs_list *timeline,
xs_list *content_search(snac *user, const xs_list *timeline,
const char *regex, int max_secs, int *timeout)
/* returns a list of posts which content matches the regex */
{

21
main.c
View File

@ -380,7 +380,26 @@ int main(int argc, char *argv[])
int to;
/* 'url' contains the regex */
xs *r = search_by_content(&snac, tl, url, 10, &to);
xs *r = content_search(&snac, tl, url, 10, &to);
int c = 0;
char *v;
/* print results as standalone links */
while (xs_list_next(r, &v, &c)) {
printf("%s/admin/p/%s\n", snac.actor, v);
}
return 0;
}
if (strcmp(cmd, "search2") == 0) { /** **/
/* undocumented (for testing only) */
xs *tl = timeline_simple_list(&snac, "public", 0, XS_ALL);
int to;
/* 'url' contains the regex */
xs *r = content_search(&snac, tl, url, 10, &to);
int c = 0;
char *v;

2
snac.h
View File

@ -179,7 +179,7 @@ xs_list *list_timeline(snac *user, const char *list, int skip, int show);
xs_val *list_content(snac *user, const char *list_id, const char *actor_md5, int op);
void list_distribute(snac *user, const char *who, const xs_dict *post);
xs_list *search_by_content(snac *user, const xs_list *timeline,
xs_list *content_search(snac *user, const xs_list *timeline,
const char *regex, int max_secs, int *timeout);
int actor_add(const char *actor, xs_dict *msg);