]> jfr.im git - irc/quakenet/newserv.git/blobdiff - newsearch/ns-hostpct.c
CHANSERV: fix issue where chanserv_relay doesn't wait for db to be loaded before...
[irc/quakenet/newserv.git] / newsearch / ns-hostpct.c
index e37bd5a2187e3a5040b12b8e060e40d191254659..ca87951ae07b34fb5608acab1245e9a2ec193b8a 100644 (file)
@@ -7,17 +7,12 @@
 #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) {
-    parseError = "uniquehostpct: 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,7 +27,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 +52,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);
 }