]>
jfr.im git - irc/quakenet/newserv.git/blob - trusts_newsearch/tsns-thstartdate.c
1 #include "trusts_newsearch.h"
6 void *tsns_thstartdate_exe(searchCtx
*ctx
, struct searchNode
*thenode
, void *theinput
);
7 void tsns_thstartdate_free(searchCtx
*ctx
, struct searchNode
*thenode
);
9 struct searchNode
*tsns_thstartdate_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_thstartdate_exe
;
20 thenode
->free
= tsns_thstartdate_free
;
25 void *tsns_thstartdate_exe(searchCtx
*ctx
, struct searchNode
*thenode
, void *theinput
) {
27 patricia_node_t
*node
= (patricia_node_t
*)theinput
;
29 if (ctx
->searchcmd
== reg_nodesearch
) {
30 if (node
->exts
[tgh_ext
] != NULL
)
31 return (void *)(((trusthost_t
*)node
->exts
[tgh_ext
])->startdate
);
33 return (void *)0; /* will cast to a FALSE */
34 } else if (ctx
->searchcmd
== reg_thsearch
) {
35 th
= (trusthost_t
*)theinput
;
36 return (void *)(th
->startdate
);
42 void tsns_thstartdate_free(searchCtx
*ctx
, struct searchNode
*thenode
) {