#include "../lib/strlfunc.h"
#include "patriciasearch.h"
-CommandTree *pnodeOutputTree;
searchCmd *reg_nodesearch;
int do_pnodesearch(void *source, int cargc, char **cargv);
NodeDisplayFunc defaultpnodefn = printnode;
-void regpnodedisp(const char *name, NodeDisplayFunc handler) {
- addcommandtotree(pnodeOutputTree, name, 0, 0, (CommandHandler)handler);
-}
-
-void unregpnodedisp(const char *name, NodeDisplayFunc handler) {
- deletecommandfromtree(pnodeOutputTree, name, (CommandHandler)handler);
-}
-
void _init() {
- pnodeOutputTree=newcommandtree();
-
reg_nodesearch = (searchCmd *)registersearchcommand("nodesearch",NO_OPER,do_pnodesearch, printnode);
registersearchterm(reg_nodesearch, "users", ps_users_parse, 0, "");
}
void _fini() {
- destroycommandtree(pnodeOutputTree);
-
deregistersearchcommand( reg_nodesearch );
}
if (cargc<1)
return CMD_USAGE;
- ret = parseopts(cargc, cargv, &arg, &limit, (void *)&subset, (void **)&display, reg_nodesearch->outputtree, reply, sender);
+ ret = parseopts(cargc, cargv, &arg, &limit, (void *)&subset, (void *)&display, reg_nodesearch->outputtree, reply, sender);
if(ret != CMD_OK)
return ret;
rejoinline(cargv[arg],cargc-arg);
}
- newsearch_ctxinit(&ctx, search_parse, reply, wall, NULL, reg_nodesearch, sender);
+ newsearch_ctxinit(&ctx, search_parse, reply, wall, NULL, reg_nodesearch, sender, display, limit);
if (!(search = ctx.parser(&ctx, cargv[arg]))) {
reply(sender,"Parse error: %s",parseError);
return CMD_ERROR;
}
- pnodesearch_exe(search, &ctx, sender, display, limit, subset);
+ pnodesearch_exe(search, &ctx, subset);
(search->free)(&ctx, search);
return do_pnodesearch_real(controlreply, controlwallwrapper, source, cargc, cargv);
}
-void pnodesearch_exe(struct searchNode *search, searchCtx *ctx, nick *sender, NodeDisplayFunc display, int limit, patricia_node_t *subset) {
+void pnodesearch_exe(struct searchNode *search, searchCtx *ctx, patricia_node_t *subset) {
int matches = 0;
patricia_node_t *node;
+ nick *sender = ctx->sender;
+ int limit = ctx->limit;
+ NodeDisplayFunc display = ctx->displayfn;
/* Get a marker value to mark "seen" channels for unique count */
//nmarker=nextnodemarker();