gbuf->comment = NULL;
gbuf->glines = NULL;
gbuf->merge = merge;
+ gbuf->userhits = 0;
+ gbuf->channelhits = 0;
}
gline *glinebufadd(glinebuf *gbuf, const char *mask, const char *creator, const char *reason, time_t expire, time_t lastmod, time_t lifetime) {
channel *cp;
nick *np;
- if (users)
- *users = 0;
-
- if (channels)
- *channels = 0;
+ gbuf->userhits = 0;
+ gbuf->channelhits = 0;
- if (channels) {
- for (i = 0; i<CHANNELHASHSIZE; i++) {
- for (cip = chantable[i]; cip; cip = cip->next) {
- cp = cip->channel;
+ for (i = 0; i<CHANNELHASHSIZE; i++) {
+ for (cip = chantable[i]; cip; cip = cip->next) {
+ cp = cip->channel;
- if (!cp)
- continue;
+ if (!cp)
+ continue;
- hit = 0;
+ hit = 0;
- for (gl = gbuf->glines; gl; gl = gl->next) {
- if (gline_match_channel(gl, cp)) {
- hit = 1;
- break;
- }
+ for (gl = gbuf->glines; gl; gl = gl->next) {
+ if (gline_match_channel(gl, cp)) {
+ hit = 1;
+ break;
}
+ }
- if (hit) {
- if (spewto)
- controlreply(spewto, "channel: %s", cip->name->content);
+ if (hit) {
+ if (spewto)
+ controlreply(spewto, "channel: %s", cip->name->content);
- (*channels)++;
- }
+ gbuf->channelhits++;
}
}
}
- if (users) {
- for (i = 0; i < NICKHASHSIZE; i++) {
- for (np = nicktable[i]; np; np = np->next) {
- hit = 0;
+ for (i = 0; i < NICKHASHSIZE; i++) {
+ for (np = nicktable[i]; np; np = np->next) {
+ hit = 0;
- for (gl = gbuf->glines; gl; gl = gl->next) {
- if (gline_match_nick(gl, np)) {
- hit = 1;
- break;
- }
+ for (gl = gbuf->glines; gl; gl = gl->next) {
+ if (gline_match_nick(gl, np)) {
+ hit = 1;
+ break;
}
+ }
- if (hit) {
- if (spewto)
- controlreply(spewto, "user: %s!%s@%s r(%s)", np->nick, np->ident, np->host->name->content, np->realname->name->content);
+ if (hit) {
+ if (spewto)
+ controlreply(spewto, "user: %s!%s@%s r(%s)", np->nick, np->ident, np->host->name->content, np->realname->name->content);
- (*users)++;
- }
+ gbuf->userhits++;
}
}
}
+
+ if (users)
+ *users = gbuf->userhits;
+
+ if (channels)
+ *channels = gbuf->channelhits;
}
int glinebufchecksane(glinebuf *gbuf, nick *spewto, int overridesanity, int overridelimit, int spewhits) {
}
}
+ controlreply(sender, "Time ID G-Lines User Hits Channel Hits Comment");
+
for (i = 0; i < MAXGLINELOG; i++) {
gbl = glinebuflog[(i + glinebuflogoffset) % MAXGLINELOG];
count++;
strftime(timebuf, sizeof(timebuf), "%d/%m/%y %H:%M:%S", localtime(&gbl->flush));
- controlreply(sender, "[%s] ID: %d - %d glines (%s)", timebuf, gbl->id, count, gbl->comment ? gbl->comment->content : "no comment");
+ controlreply(sender, "%-20s %-10d %-10d %-15d %-15d %s", timebuf, gbl->id, count, gbl->userhits, gbl->channelhits, gbl->comment ? gbl->comment->content : "no comment");
}
if (id != 0 && gbl->id == id) {
glinebufinit(&gbuf, 1);
glinebufaddbyip(&gbuf, user, &ip, 128, 0, creator, "Simulate", getnettime(), getnettime(), getnettime());
- glinebufcounthits(&gbuf, &count, NULL);
+ glinebufcounthits(&gbuf, &count, NULL, NULL);
glinebufspew(&gbuf, sender);
glinebufabort(&gbuf);