X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/d5043cfe0bff3f76a8e89f819c3a863534f1406c..18afb5fb8815bebadb2ff5f4465c326d1b4ce3d7:/newsearch/ns-kick.c diff --git a/newsearch/ns-kick.c b/newsearch/ns-kick.c index 9f4f9355..0b168a83 100644 --- a/newsearch/ns-kick.c +++ b/newsearch/ns-kick.c @@ -8,24 +8,26 @@ #include #include -void *kick_exe(struct searchNode *thenode, void *theinput); -void kick_free(struct searchNode *thenode); +void *kick_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput); +void kick_free(searchCtx *ctx, struct searchNode *thenode); -struct searchNode *kick_parse(int type, int argc, char **argv) { - struct searchNode *thenode; +struct searchNode *kick_parse(searchCtx *ctx, int argc, char **argv) { + struct searchNode *thenode, *kicknick; nick *np; + char *p; - if (type!=SEARCHTYPE_CHANNEL) { - parseError="kick: only channel searches are supported"; - return NULL; - } - if (argc!=1) { parseError="kick: usage: (kick target)"; return NULL; } - if ((np=getnickbynick(argv[0]))==NULL) { + if (!(kicknick=argtoconststr("kick", ctx, argv[0], &p))) + return NULL; + + np=getnickbynick(p); + kicknick->free(ctx, kicknick); + + if (np==NULL) { parseError="kick: unknown nickname"; return NULL; } @@ -48,7 +50,7 @@ struct searchNode *kick_parse(int type, int argc, char **argv) { return thenode; } -void *kick_exe(struct searchNode *thenode, void *theinput) { +void *kick_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) { nick *np; chanindex *cip; @@ -62,6 +64,6 @@ void *kick_exe(struct searchNode *thenode, void *theinput) { return (void *)1; } -void kick_free(struct searchNode *thenode) { +void kick_free(searchCtx *ctx, struct searchNode *thenode) { free(thenode); }