]> jfr.im git - irc/quakenet/newserv.git/blobdiff - newsearch/ns-server.c
merge
[irc/quakenet/newserv.git] / newsearch / ns-server.c
index 8d91bef1c7844788d0de8dc318cc5dc4d38e3992..aff9886d4bed167698846efecf57fed9a167ebb6 100644 (file)
@@ -19,33 +19,39 @@ void server_free(searchCtx *ctx, struct searchNode *thenode);
 
 int ext;
 
-struct searchNode *server_parse(searchCtx *ctx, int type, int argc, char **argv) {
+struct searchNode *server_parse(searchCtx *ctx, int argc, char **argv) {
   struct searchNode *thenode;
   int i;
   long numeric;
 
-  if (type != SEARCHTYPE_NICK) {
-    parseError = "server: this function is only valid for nick searches.";
-    return NULL;
-  }
-
   if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
     parseError = "malloc: could not allocate memory for this search.";
     return NULL;
   }
 
   if (argc>0) {
+    struct searchNode *servername;
+    char *p;
+    
+    if (!(servername=argtoconststr("server", ctx, argv[0], &p))) {
+      free(thenode);
+      return NULL;
+    }
+     
     numeric = -1;
     for(i=0;i<MAXSERVERS;i++) {
       sstring *n = serverlist[i].name;
-      if(n && !strcmp(n->content, argv[0])) {
+      if(n && !strcmp(n->content, p)) {
         numeric = i;
         break;
       }
     }
 
+    (servername->free)(ctx, servername);
+    
     if(numeric == -1) {
       parseError = "server: server not found.";
+      free(thenode);
       return NULL;
     }