]> jfr.im git - irc/quakenet/newserv.git/blobdiff - newsearch/ns-host.c
TRUSTS: require sqlite
[irc/quakenet/newserv.git] / newsearch / ns-host.c
index d28f58c15daf8103e899e56df44c318f08e1dabe..ab919d840f016c012ab75a57565f5f17394e6dfc 100644 (file)
@@ -14,14 +14,10 @@ void *host_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
 void *host_exe_real(searchCtx *ctx, struct searchNode *thenode, void *theinput);
 void host_free(searchCtx *ctx, struct searchNode *thenode);
 
-struct searchNode *host_parse(searchCtx *ctx, int type, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (type != SEARCHTYPE_NICK) {
-    parseError = "host: this function is only valid for nick searches.";
-    return NULL;
-  }
-
+struct searchNode *host_parse(searchCtx *ctx, int argc, char **argv) {
+  struct searchNode *thenode, *argsn;
+  char *p;
+  
   if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
     parseError = "malloc: could not allocate memory for this search.";
     return NULL;
@@ -37,10 +33,17 @@ struct searchNode *host_parse(searchCtx *ctx, int type, int argc, char **argv) {
   thenode->exe = host_exe;
   thenode->free = host_free;
 
-  /* Allow "host real" to match realhost */
-
-  if (argc>0 && !ircd_strcmp(argv[0],"real")) {
-    thenode->exe = host_exe_real;
+  if (argc>0) {
+    if (!(argsn=argtoconststr("host", ctx, argv[0], &p))) {
+      free(thenode);
+      return NULL;
+    }
+  
+    /* Allow "host real" to match realhost */
+    if (!ircd_strcmp(p,"real"))
+      thenode->exe = host_exe_real;
+
+    argsn->free(ctx, argsn);
   }
 
   return thenode;