]> jfr.im git - irc/quakenet/newserv.git/blobdiff - newsearch/ns-host.c
Add iterators to newsearch, along with an example channel iterator function.
[irc/quakenet/newserv.git] / newsearch / ns-host.c
index 636e23f8d4fd72b3a374fd9d5b7d962d4b345461..d28f58c15daf8103e899e56df44c318f08e1dabe 100644 (file)
 #include "../irc/irc_config.h"
 #include "../lib/irc_string.h"
 
-void *host_exe(struct searchNode *thenode, int type, void *theinput);
-void *host_exe_real(struct searchNode *thenode, int type, void *theinput);
-void host_free(struct searchNode *thenode);
+void *host_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
+void *host_exe_real(searchCtx *ctx, struct searchNode *thenode, void *theinput);
+void host_free(searchCtx *ctx, struct searchNode *thenode);
 
-struct searchNode *host_parse(int type, int argc, char **argv) {
+struct searchNode *host_parse(searchCtx *ctx, int type, int argc, char **argv) {
   struct searchNode *thenode;
 
   if (type != SEARCHTYPE_NICK) {
@@ -46,14 +46,10 @@ struct searchNode *host_parse(int type, int argc, char **argv) {
   return thenode;
 }
 
-void *host_exe(struct searchNode *thenode, int type, void *theinput) {
+void *host_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
   nick *np = (nick *)theinput;
   char *buf = thenode->localdata;
 
-  if (type != RETURNTYPE_STRING) {
-    return (void *)1;
-  }
-
   if (IsSetHost(np)) {
     return np->sethost->content;
   } else if (IsHideHost(np)) {
@@ -64,17 +60,13 @@ void *host_exe(struct searchNode *thenode, int type, void *theinput) {
   }
 }
 
-void *host_exe_real(struct searchNode *thenode, int type, void *theinput) {
+void *host_exe_real(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
   nick *np = (nick *)theinput;
 
-  if (type != RETURNTYPE_STRING) {
-    return (void *)1;
-  }
-
   return np->host->name->content;
 }
 
-void host_free(struct searchNode *thenode) {
+void host_free(searchCtx *ctx, struct searchNode *thenode) {
   free(thenode->localdata);
   free(thenode);
 }