mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 06:25:04 +00:00
Renamed to content_search().
This commit is contained in:
parent
dc74cac6c9
commit
52ba7f030e
3 changed files with 23 additions and 4 deletions
2
data.c
2
data.c
|
@ -2490,7 +2490,7 @@ void notify_clear(snac *snac)
|
||||||
|
|
||||||
/** searches **/
|
/** 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)
|
const char *regex, int max_secs, int *timeout)
|
||||||
/* returns a list of posts which content matches the regex */
|
/* returns a list of posts which content matches the regex */
|
||||||
{
|
{
|
||||||
|
|
21
main.c
21
main.c
|
@ -380,7 +380,26 @@ int main(int argc, char *argv[])
|
||||||
int to;
|
int to;
|
||||||
|
|
||||||
/* 'url' contains the regex */
|
/* '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;
|
int c = 0;
|
||||||
char *v;
|
char *v;
|
||||||
|
|
4
snac.h
4
snac.h
|
@ -179,8 +179,8 @@ 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);
|
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);
|
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);
|
const char *regex, int max_secs, int *timeout);
|
||||||
|
|
||||||
int actor_add(const char *actor, xs_dict *msg);
|
int actor_add(const char *actor, xs_dict *msg);
|
||||||
int actor_get(const char *actor, xs_dict **data);
|
int actor_get(const char *actor, xs_dict **data);
|
||||||
|
|
Loading…
Reference in a new issue