]>
jfr.im git - irc/quakenet/newserv.git/blob - trusts/newsearch/tns-tgroup.c
5 #include "../../newsearch/newsearch.h"
10 void *tgroup_exe(searchCtx
*ctx
, struct searchNode
*thenode
, void *theinput
);
11 void tgroup_free(searchCtx
*ctx
, struct searchNode
*thenode
);
13 struct searchNode
*tgroup_parse(searchCtx
*ctx
, int argc
, char **argv
) {
14 struct searchNode
*thenode
, *arg
;
19 parseError
= "tgroup: usage: tgroup <#id|name|id>";
23 if(!(arg
=argtoconststr("tgroup", ctx
, argv
[0], &p
)))
27 (arg
->free
)(ctx
, arg
);
29 parseError
= "tgroup: unknown group";
33 if(!(thenode
=(struct searchNode
*)malloc(sizeof (struct searchNode
)))) {
34 parseError
= "malloc: could not allocate memory for this search.";
38 thenode
->returntype
= RETURNTYPE_BOOL
;
39 thenode
->exe
= tgroup_exe
;
40 thenode
->free
= tgroup_free
;
41 thenode
->localdata
= tg
;
46 void *tgroup_exe(searchCtx
*ctx
, struct searchNode
*thenode
, void *theinput
) {
48 trusthost
*th
= gettrusthost(np
);
49 trustgroup
*tg
= thenode
->localdata
;
51 if(th
&& (th
->group
== tg
))
57 void tgroup_free(searchCtx
*ctx
, struct searchNode
*thenode
) {