]> jfr.im git - irc/quakenet/newserv.git/blobdiff - newsearch/ns-hostpct.c
SearchCtx should contain 'type' - this is to make life easier when defining new searc...
[irc/quakenet/newserv.git] / newsearch / ns-hostpct.c
index e37bd5a2187e3a5040b12b8e060e40d191254659..45676afbde43609548e7f76ceba195324749085f 100644 (file)
@@ -7,13 +7,13 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-void *hostpct_exe(struct searchNode *thenode, void *theinput);
-void hostpct_free(struct searchNode *thenode);
+void *hostpct_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
+void hostpct_free(searchCtx *ctx, struct searchNode *thenode);
 
-struct searchNode *hostpct_parse(int type, int argc, char **argv) {
+struct searchNode *hostpct_parse(searchCtx *ctx, int argc, char **argv) {
   struct searchNode *thenode;
 
-  if (type != SEARCHTYPE_CHANNEL) {
+  if (ctx->type != SEARCHTYPE_CHANNEL) {
     parseError = "uniquehostpct: this function is only valid for channel searches.";
     return NULL;
   }
@@ -32,7 +32,7 @@ struct searchNode *hostpct_parse(int type, int argc, char **argv) {
   return thenode;
 }
 
-void *hostpct_exe(struct searchNode *thenode, void *theinput) {
+void *hostpct_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
   int i;
   unsigned int marker;
   unsigned int hosts=0;
@@ -57,10 +57,10 @@ void *hostpct_exe(struct searchNode *thenode, void *theinput) {
     }
   }
   
-  return (void *)((hosts * 100)/cip->channel->users->totalusers);
+  return (void *)(long)((hosts * 100)/cip->channel->users->totalusers);
 }
 
-void hostpct_free(struct searchNode *thenode) {
+void hostpct_free(searchCtx *ctx, struct searchNode *thenode) {
   free(thenode);
 }