]> jfr.im git - irc/quakenet/newserv.git/blobdiff - newsearch/ns-channel.c
fix makefile of jupe module
[irc/quakenet/newserv.git] / newsearch / ns-channel.c
index badde2ffc6958d2f07f9b8fb771aa41231b0ae0e..3a79920f309e0fbdfb011d4438a13d7f65f867da 100644 (file)
@@ -9,24 +9,25 @@
 
 #include "../channel/channel.h"
 
-void *channel_exe(struct searchNode *thenode, void *theinput);
-void channel_free(struct searchNode *thenode);
+void *channel_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
+void channel_free(searchCtx *ctx, struct searchNode *thenode);
 
-struct searchNode *channel_parse(int type, int argc, char **argv) {
-  struct searchNode *thenode;
+struct searchNode *channel_parse(searchCtx *ctx, int argc, char **argv) {
+  struct searchNode *thenode, *convsn;
   channel *cp;
-
-  if (type != SEARCHTYPE_NICK) {
-    parseError = "channel: this function is only valid for nick searches.";
-    return NULL;
-  }
-
+  char *p;
+  
   if (argc<1) {
     parseError = "channel: usage: channel <channel name>";
     return NULL;
   }
 
-  if (!(cp=findchannel(argv[0]))) {
+  if (!(convsn=argtoconststr("channel", ctx, argv[0], &p)))
+    return NULL;
+
+  cp=findchannel(p);
+  convsn->free(ctx, convsn);
+  if (!cp) {
     parseError = "channel: unknown channel";
     return NULL;
   }
@@ -44,7 +45,7 @@ struct searchNode *channel_parse(int type, int argc, char **argv) {
   return thenode;
 }
 
-void *channel_exe(struct searchNode *thenode, void *theinput) {
+void *channel_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
   nick *np = (nick *)theinput;
   channel *cp = thenode->localdata;
 
@@ -55,7 +56,7 @@ void *channel_exe(struct searchNode *thenode, void *theinput) {
   }
 }
 
-void channel_free(struct searchNode *thenode) {
+void channel_free(searchCtx *ctx, struct searchNode *thenode) {
   free(thenode);
 }