]> jfr.im git - irc/quakenet/newserv.git/blame - trusts2_newsearch/tsns-tbid.c
gline->glines2, trusts_search->trusts2_search, trusts_newsearch->trusts2_newsearch
[irc/quakenet/newserv.git] / trusts2_newsearch / tsns-tbid.c
CommitLineData
0ac8476d
P
1#include "trusts_newsearch.h"
2
3#include <stdio.h>
4#include <stdlib.h>
5
6void *tsns_tbid_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
7void tsns_tbid_free(searchCtx *ctx, struct searchNode *thenode);
8
9struct searchNode *tsns_tbid_parse(searchCtx *ctx, int argc, char **argv) {
10 struct searchNode *thenode;
11
12 if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
13 parseError = "malloc: could not allocate memory for this search.";
14 return NULL;
15 }
16
17 thenode->returntype = RETURNTYPE_INT;
18 thenode->localdata = NULL;
19 thenode->exe = tsns_tbid_exe;
20 thenode->free = tsns_tbid_free;
21
22 return thenode;
23}
24
25void *tsns_tbid_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
26 patricia_node_t *node;
27
28 node = (patricia_node_t *)theinput;
29 if (node->exts[tgb_ext] != NULL)
30 return (void *)(((trustblock_t *)node->exts[tgb_ext])->id);
31 else
32 return (void *)0; /* will cast to a FALSE */
33}
34
35void tsns_tbid_free(searchCtx *ctx, struct searchNode *thenode) {
36 free(thenode);
37}