]> jfr.im git - irc/quakenet/newserv.git/blobdiff - newsearch/ns-timestamp.c
LUA: add function for channel chanop notice
[irc/quakenet/newserv.git] / newsearch / ns-timestamp.c
index d5df5c81382179b1a25106ea5d951aed21394838..433c26a0567f2be1676d9940333b5e5aba54e0e0 100644 (file)
 void *timestamp_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
 void timestamp_free(searchCtx *ctx, struct searchNode *thenode);
 
-struct searchNode *timestamp_parse(searchCtx *ctx, int type, int argc, char **argv) {
+struct searchNode *timestamp_parse(searchCtx *ctx, int argc, char **argv) {
   struct searchNode *thenode;
 
-  if ((type != SEARCHTYPE_NICK) && (type != SEARCHTYPE_CHANNEL)){
-    parseError = "timestamp: this function is only valid for nick or channel searches.";
-    return NULL;
-  }
-
   if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
     parseError = "malloc: could not allocate memory for this search.";
     return NULL;
   }
 
   thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = (void *)(long)type;
+  thenode->localdata = NULL;
   thenode->exe = timestamp_exe;
   thenode->free = timestamp_free;
 
@@ -37,8 +32,8 @@ struct searchNode *timestamp_parse(searchCtx *ctx, int type, int argc, char **ar
 void *timestamp_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
   nick *np = (nick *)theinput;
   chanindex *cip = (chanindex *)theinput;
-  
-  if ((long)thenode->localdata == SEARCHTYPE_NICK) {
+
+  if (ctx->searchcmd == reg_nicksearch || ctx->searchcmd == reg_whowassearch) {
     return (void *)np->timestamp;
   } else {
     if (cip->channel)