X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/3787a47cc8ce48dc7464c28a7085b62cc795dce0..3e1b768066a16c4b899b9cbdd7911be883151a05:/newsearch/ns-gline.c diff --git a/newsearch/ns-gline.c b/newsearch/ns-gline.c index 8e1e3cb7..f989633d 100644 --- a/newsearch/ns-gline.c +++ b/newsearch/ns-gline.c @@ -43,6 +43,8 @@ struct searchNode *gline_parse(searchCtx *ctx, int argc, char **argv) { localdata->marker = nextchanmarker(); else if (ctx->searchcmd == reg_nicksearch) localdata->marker = nextnickmarker(); + else if (ctx->searchcmd == reg_whowassearch) + localdata->marker = nextwhowasmarker(); else { free(localdata); parseError = "gline: invalid search type"; @@ -129,6 +131,7 @@ void *gline_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) { struct gline_localdata *localdata; nick *np; chanindex *cip; + whowas *ww; localdata = thenode->localdata; @@ -140,7 +143,12 @@ void *gline_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) { } else { np = (nick *)theinput; - np->marker = localdata->marker; + if (ctx->searchcmd == reg_nicksearch) + np->marker = localdata->marker; + else { + ww = (whowas *)np->next; + ww->marker = localdata->marker; + } localdata->count++; } @@ -162,6 +170,7 @@ void gline_free(searchCtx *ctx, struct searchNode *thenode) { struct gline_localdata *localdata; nick *np, *nnp; chanindex *cip, *ncip; + whowas *ww; int i, j, hits, safe=0; time_t ti = time(NULL); glinebuf gbuf; @@ -195,8 +204,7 @@ void gline_free(searchCtx *ctx, struct searchNode *thenode) { } } } - } - else { + } else if (ctx->searchcmd == reg_nicksearch) { for (i=0;inext; @@ -206,6 +214,18 @@ void gline_free(searchCtx *ctx, struct searchNode *thenode) { } } } + } else { + for (i = whowasoffset; i < whowasoffset + whowasmax; i++) { + ww = &whowasrecs[i % whowasmax]; + + if (ww->type == WHOWAS_UNUSED) + continue; + + if (ww->marker == localdata->marker) { + if(!glineuser(&gbuf, &ww->nick, localdata, ti)) + safe++; + } + } } glinebufcounthits(&gbuf, &hits, NULL);