X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/16cc6e32e6b07184834afacba31693e3f5e8a94f..211567363bd8bfbd70cef81e4208ea02d49ebb55:/newsearch/ns-authname.c diff --git a/newsearch/ns-authname.c b/newsearch/ns-authname.c index 3c602abe..f1e299b3 100644 --- a/newsearch/ns-authname.c +++ b/newsearch/ns-authname.c @@ -7,19 +7,17 @@ #include #include -void *authname_exe(struct searchNode *thenode, int type, void *theinput); -void authname_free(struct searchNode *thenode); +void *authname_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput); +void authname_free(searchCtx *ctx, struct searchNode *thenode); -struct searchNode *authname_parse(int type, int argc, char **argv) { +struct searchNode *authname_parse(searchCtx *ctx, int argc, char **argv) { struct searchNode *thenode; - if (type != SEARCHTYPE_NICK) { - parseError = "authname: 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 = authname_exe; @@ -28,21 +26,17 @@ struct searchNode *authname_parse(int type, int argc, char **argv) { return thenode; } -void *authname_exe(struct searchNode *thenode, int type, void *theinput) { +void *authname_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) { nick *np = (nick *)theinput; - if (type != RETURNTYPE_STRING) { - return (void *)1; - } - if (IsAccount(np)) return np->authname; else - return "[NULL]"; + return ""; /* will cast to a FALSE */ } -void authname_free(struct searchNode *thenode) { +void authname_free(searchCtx *ctx, struct searchNode *thenode) { free(thenode); }