X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/c7f7a584fd6c8ee4a0ede6e79e8ce2177ab863f0..8855bb48b449ed06cfd3ce528b3c0a77c37cb24b:/newsearch/ns-authedpct.c diff --git a/newsearch/ns-authedpct.c b/newsearch/ns-authedpct.c index 603b424e..f8b67dce 100644 --- a/newsearch/ns-authedpct.c +++ b/newsearch/ns-authedpct.c @@ -7,17 +7,12 @@ #include #include -void *authedpct_exe(struct searchNode *thenode, void *theinput); -void authedpct_free(struct searchNode *thenode); +void *authedpct_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput); +void authedpct_free(searchCtx *ctx, struct searchNode *thenode); -struct searchNode *authedpct_parse(int type, int argc, char **argv) { +struct searchNode *authedpct_parse(searchCtx *ctx, int argc, char **argv) { struct searchNode *thenode; - if (type != SEARCHTYPE_CHANNEL) { - parseError = "authedpct: this function is only valid for channel searches."; - return NULL; - } - if (!(thenode=(struct searchNode *)malloc(sizeof(struct searchNode)))) { /* couldn't malloc() memory for thenode, so free localdata to avoid leakage */ parseError = "malloc: could not allocate memory for this search."; @@ -32,15 +27,12 @@ struct searchNode *authedpct_parse(int type, int argc, char **argv) { return thenode; } -void *authedpct_exe(struct searchNode *thenode, void *theinput) { +void *authedpct_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) { int i; int j=0; nick *np; chanindex *cip = (chanindex *)theinput; - struct authedpct_localdata *localdata; - localdata = thenode->localdata; - if (!cip->channel) return (void *)0; @@ -52,10 +44,10 @@ void *authedpct_exe(struct searchNode *thenode, void *theinput) { j++; } - return (void *)((j * 100) / cip->channel->users->totalusers); + return (void *)(long)((j * 100) / cip->channel->users->totalusers); } -void authedpct_free(struct searchNode *thenode) { +void authedpct_free(searchCtx *ctx, struct searchNode *thenode) { free(thenode); }