]> jfr.im git - irc/quakenet/newserv.git/blobdiff - newsearch/ns-realname.c
CHANSERV: fix issue where chanserv_relay doesn't wait for db to be loaded before...
[irc/quakenet/newserv.git] / newsearch / ns-realname.c
index e047b121fbc028ea0b58a275a16c1d728255f0b5..e55824447100768bed5c9d63449908c84768f1a7 100644 (file)
@@ -7,19 +7,17 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-void *realname_exe(struct searchNode *thenode, int type, void *theinput);
-void realname_free(struct searchNode *thenode);
+void *realname_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
+void realname_free(searchCtx *ctx, struct searchNode *thenode);
 
-struct searchNode *realname_parse(int type, int argc, char **argv) {
+struct searchNode *realname_parse(searchCtx *ctx, int argc, char **argv) {
   struct searchNode *thenode;
 
-  if (type != SEARCHTYPE_NICK) {
-    parseError = "realname: this function is only valid for nick searches.";
+  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
+    parseError = "malloc: could not allocate memory for this search.";
     return NULL;
   }
 
-  thenode=(struct searchNode *)malloc(sizeof (struct searchNode));
-
   thenode->returntype = RETURNTYPE_STRING;
   thenode->localdata = NULL;
   thenode->exe = realname_exe;
@@ -28,17 +26,13 @@ struct searchNode *realname_parse(int type, int argc, char **argv) {
   return thenode;
 }
 
-void *realname_exe(struct searchNode *thenode, int type, void *theinput) {
+void *realname_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
   nick *np = (nick *)theinput;
 
-  if (type != RETURNTYPE_STRING) {
-    return (void *)1;
-  }
-
   return np->realname->name->content;
 }
 
-void realname_free(struct searchNode *thenode) {
+void realname_free(searchCtx *ctx, struct searchNode *thenode) {
   free(thenode);
 }