X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/15a91b41493c79276ca1e59c09500eeb0fea888d..f28b61f26dec986fb87602b5c75ad812b8297d85:/newsearch/ns-timestamp.c diff --git a/newsearch/ns-timestamp.c b/newsearch/ns-timestamp.c index cd3d0347..433c26a0 100644 --- a/newsearch/ns-timestamp.c +++ b/newsearch/ns-timestamp.c @@ -13,14 +13,9 @@ 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) { - 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 type, int argc, char **ar 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 || ctx->searchcmd == reg_whowassearch) { + return (void *)np->timestamp; + } else { + if (cip->channel) + return (void *)cip->channel->timestamp; + else + return 0; + } } void timestamp_free(searchCtx *ctx, struct searchNode *thenode) {