whowas *ww;
nick *wnp;
struct irc_in_addr ipaddress_canonical;
+ void *args[2];
/* Create a new record. */
if (standalone)
ww->timestamp = getnettime();
ww->type = WHOWAS_USED;
+ args[0] = ww;
+ args[1] = np;
+ triggerhook(HOOK_WHOWAS_NEWRECORD, args);
+
return ww;
}
if (!ww || ww->type == WHOWAS_UNUSED)
return;
+ triggerhook(HOOK_WHOWAS_LOSTRECORD, ww);
+
np = &ww->nick;
freesstring(np->host->name);
freehost(np->host);
snprintf(hostmask, sizeof(hostmask), "%s!%s@%s%s%s [%s] (%s)",
np->nick, np->ident, np->host->name->content,
np->auth ? "/" : "", np->auth ? np->authname : "",
- IPtostr(np->p_ipaddr),
+ IPtostr(np->ipaddress),
printflags(np->umodes, umodeflags));
strftime(timebuf, sizeof(timebuf), "%d/%m/%y %H:%M:%S", localtime(&(ww->timestamp)));
return buf;
}
+const char *whowas_formatchannels(whowas *ww) {
+ static char buf[512];
+ int i, first = 1;
+
+ strcpy(buf, "Channels: ");
+
+ for (i = 0; i < WW_MAXCHANNELS; i++) {
+ if (!ww->channels[i])
+ break;
+
+ if (!first)
+ strncat(buf, ", ", sizeof(buf));
+ else
+ first = 0;
+
+ strncat(buf, ww->channels[i]->name->content, sizeof(buf));
+ }
+
+ if (!ww->channels[0])
+ strncat(buf, "(No channels.)", sizeof(buf));
+
+ buf[sizeof(buf) - 1] = '\0';
+
+ return buf;
+}
+
unsigned int nextwhowasmarker() {
whowas *ww;
int i;
}
void _init(void) {
+ memset(whowasrecs, 0, sizeof(whowasrecs));
+
registerhook(HOOK_NICK_QUIT, whowas_handlequitorkill);
registerhook(HOOK_NICK_KILL, whowas_handlequitorkill);
registerhook(HOOK_NICK_RENAME, whowas_handlerename);