]> jfr.im git - irc/quakenet/newserv.git/blob - proxyscan/pns-scan.c
merge
[irc/quakenet/newserv.git] / proxyscan / pns-scan.c
1 /*
2 * pscan functionality
3 */
4
5 #include "../newsearch/newsearch.h"
6 #include "proxyscan.h"
7
8 #include <stdlib.h>
9
10 void *pscan_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
11 void pscan_free(searchCtx *ctx, struct searchNode *thenode);
12
13 struct searchNode *pscan_parse(searchCtx *ctx, int argc, char **argv) {
14 struct searchNode *thenode;
15
16 if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
17 parseError = "malloc: could not allocate memory for this search.";
18 return NULL;
19 }
20
21 thenode->returntype = RETURNTYPE_BOOL;
22 thenode->exe = pscan_exe;
23 thenode->free = pscan_free;
24 thenode->localdata = (void *)0;
25
26 return thenode;
27 }
28
29 void *pscan_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
30 startnickscan((nick *)theinput);
31 thenode->localdata = (void *)((int)thenode->localdata + 1);
32 return (void *)1;
33 }
34
35 void pscan_free(searchCtx *ctx, struct searchNode *thenode) {
36 ctx->reply(senderNSExtern, "proxyscan now scanning: %d nick(s).", (int)thenode->localdata);
37 free(thenode);
38 }
39