]>
jfr.im git - irc/quakenet/newserv.git/blob - trusts_newsearch/tsns-tbid.c
1 #include "trusts_newsearch.h"
6 void *tsns_tbid_exe(searchCtx
*ctx
, struct searchNode
*thenode
, void *theinput
);
7 void tsns_tbid_free(searchCtx
*ctx
, struct searchNode
*thenode
);
9 struct searchNode
*tsns_tbid_parse(searchCtx
*ctx
, int argc
, char **argv
) {
10 struct searchNode
*thenode
;
12 if (!(thenode
=(struct searchNode
*)malloc(sizeof (struct searchNode
)))) {
13 parseError
= "malloc: could not allocate memory for this search.";
17 thenode
->returntype
= RETURNTYPE_INT
;
18 thenode
->localdata
= NULL
;
19 thenode
->exe
= tsns_tbid_exe
;
20 thenode
->free
= tsns_tbid_free
;
25 void *tsns_tbid_exe(searchCtx
*ctx
, struct searchNode
*thenode
, void *theinput
) {
26 patricia_node_t
*node
;
28 node
= (patricia_node_t
*)theinput
;
29 if (node
->exts
[tgb_ext
] != NULL
)
30 return (void *)(((trustblock_t
*)node
->exts
[tgb_ext
])->id
);
32 return (void *)0; /* will cast to a FALSE */
35 void tsns_tbid_free(searchCtx
*ctx
, struct searchNode
*thenode
) {