]>
jfr.im git - irc/quakenet/newserv.git/blob - newsearch/ns-size.c
10 void *size_exe(searchCtx
*ctx
, struct searchNode
*thenode
, void *theinput
);
11 void size_free(searchCtx
*ctx
, struct searchNode
*thenode
);
13 struct searchNode
*size_parse(searchCtx
*ctx
, int argc
, char **argv
) {
14 struct searchNode
*thenode
;
16 if (ctx
->type
!= SEARCHTYPE_CHANNEL
) {
17 parseError
= "size: this function is only valid for channel searches.";
21 if (!(thenode
=(struct searchNode
*)malloc(sizeof(struct searchNode
)))) {
22 /* couldn't malloc() memory for thenode, so free localdata to avoid leakage */
23 parseError
= "malloc: could not allocate memory for this search.";
27 thenode
->returntype
= RETURNTYPE_INT
;
28 thenode
->localdata
= NULL
;
29 thenode
->exe
= size_exe
;
30 thenode
->free
= size_free
;
35 void *size_exe(searchCtx
*ctx
, struct searchNode
*thenode
, void *theinput
) {
36 chanindex
*cip
= (chanindex
*)theinput
;
38 if (cip
->channel
==NULL
)
41 return (void *)((unsigned long)cip
->channel
->users
->totalusers
);
44 void size_free(searchCtx
*ctx
, struct searchNode
*thenode
) {