+ newsearch_ctxinit(&ctx, search_astparse, reply, wall, &cache, reg_nicksearch, sender, display, limit);
+
+ buf[0] = '\0';
+ reply(sender, "Parsing: %s", ast_printtree(buf, sizeof(buf), tree, reg_nicksearch));
+ search = ctx.parser(&ctx, (char *)tree);
+ if(!search) {
+ reply(sender, "Parse error: %s", parseError);
+ return CMD_ERROR;
+ }
+
+ reply(sender, "Executing...");
+ if(header)
+ header(sender, headerarg);
+ nicksearch_exe(search, &ctx);
+
+ (search->free)(&ctx, search);
+
+ return CMD_OK;
+}
+
+int ast_chansearch(searchASTExpr *tree, replyFunc reply, void *sender, wallFunc wall, ChanDisplayFunc display, HeaderFunc header, void *headerarg, int limit) {
+ searchCtx ctx;
+ searchASTCache cache;
+ searchNode *search;
+ char buf[1024];
+
+ newsearch_ctxinit(&ctx, search_astparse, reply, wall, &cache, reg_chansearch, sender, display, limit);
+
+ memset(&cache, 0, sizeof(cache));
+ cache.tree = tree;