diff options
author | default <nobody@localhost> | 2024-05-08 10:20:25 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2024-05-08 10:20:25 +0200 |
commit | 3ab733cdf5a71b9a27399e8336e0c236c13d67fb (patch) | |
tree | 81e9885f2bffabcaf849f170888eaa0be40a4234 /main.c | |
parent | 5d519288fb9bb8fdfb9323c77a3d1b18c480a5d6 (diff) |
New function search_by_content().
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -44,6 +44,7 @@ int usage(void) printf("limit {basedir} {uid} {actor} Limits an actor (drops their announces)\n"); printf("unlimit {basedir} {uid} {actor} Unlimits an actor\n"); printf("verify_links {basedir} {uid} Verifies a user's links (in the metadata)\n"); + printf("search {basedir} {uid} {regex} Searches posts by content\n"); return 1; } @@ -374,6 +375,23 @@ int main(int argc, char *argv[]) return 0; } + if (strcmp(cmd, "search") == 0) { /** **/ + xs *tl = timeline_simple_list(&snac, "private", 0, XS_ALL); + + /* 'url' contains the regex */ + xs *r = search_by_content(&snac, tl, url, 10); + + 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, "ping") == 0) { /** **/ xs *actor_o = NULL; |