]> jfr.im git - irc/quakenet/newserv.git/blobdiff - newsearch/ns-age.c
LUA: add function for channel chanop notice
[irc/quakenet/newserv.git] / newsearch / ns-age.c
index 7a0b5a4e4d2a95cbf057a1faa89ecd439c9fa7ab..9b318371a769fdaf5d11c5110889f7c28e78fd5a 100644 (file)
@@ -29,9 +29,17 @@ struct searchNode *age_parse(searchCtx *ctx, int argc, char **argv) {
 
 void *age_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
   nick *np = (nick *)theinput;
-  whowas *ww = (whowas *)np->next;
+  whowas *ww;
+  time_t ts;
+
+  if (ctx->searchcmd == reg_nicksearch)
+    ts = np->timestamp;
+  else {
+    ww = (whowas *)np->next;
+    ts = ww->timestamp;
+  }
 
-  return (void *)(getnettime() - ww->timestamp);
+  return (void *)(getnettime() - ts);
 }
 
 void age_free(searchCtx *ctx, struct searchNode *thenode) {