]> jfr.im git - irc/quakenet/newserv.git/blobdiff - newsearch/ns-timestamp.c
merge
[irc/quakenet/newserv.git] / newsearch / ns-timestamp.c
index 3344c85d1afafd48aa0ce83ec46128c51a198532..318942665c6b36a6fa110cf8eae3526a11967de0 100644 (file)
@@ -16,11 +16,6 @@ void timestamp_free(searchCtx *ctx, struct searchNode *thenode);
 struct searchNode *timestamp_parse(searchCtx *ctx, int argc, char **argv) {
   struct searchNode *thenode;
 
-  if (ctx->type != SEARCHTYPE_NICK) {
-    parseError = "timestamp: this function is only valid for nick searches.";
-    return NULL;
-  }
-
   if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
     parseError = "malloc: could not allocate memory for this search.";
     return NULL;
@@ -36,8 +31,16 @@ struct searchNode *timestamp_parse(searchCtx *ctx, int argc, char **argv) {
 
 void *timestamp_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
   nick *np = (nick *)theinput;
-
-  return (void *)np->timestamp;
+  chanindex *cip = (chanindex *)theinput;
+
+  if (ctx->searchcmd == reg_nicksearch) {  
+    return (void *)np->timestamp;
+  } else {
+    if (cip->channel)
+      return (void *)cip->channel->timestamp;
+    else
+      return 0;
+  }
 }
 
 void timestamp_free(searchCtx *ctx, struct searchNode *thenode) {