]> jfr.im git - irc/quakenet/newserv.git/blobdiff - newsearch/ns-kick.c
TRUSTS: require sqlite
[irc/quakenet/newserv.git] / newsearch / ns-kick.c
index 9f4f9355fbdb4626385fc79474f0c887613bb755..0b168a83b147337be2954b7c66f08721912bb281 100644 (file)
@@ -8,24 +8,26 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-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);
 }