damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 2d02766461031fba5e3e7a08212723b185ef1317
parent 1e6873c879e1fbad8f726866ea4863726379ff25
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 13 Jan 2025 18:08:47 -0800

nostrdb: filter: add ndb_filter_find_search helper

This can be used to quicky pull the search string
from a filter

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mnostrdb/src/nostrdb.c | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/nostrdb/src/nostrdb.c b/nostrdb/src/nostrdb.c @@ -2906,6 +2906,16 @@ ndb_filter_find_elements(struct ndb_filter *filter, enum ndb_filter_fieldtype ty return NULL; } +static const char *ndb_filter_find_search(struct ndb_filter *filter) +{ + struct ndb_filter_elements *els; + + if (!(els = ndb_filter_find_elements(filter, NDB_FILTER_SEARCH))) + return NULL; + + return ndb_filter_get_string_element(filter, els, 0); +} + int ndb_filter_is_subset_of(const struct ndb_filter *a, const struct ndb_filter *b) { int i;