/* traced <to@bot> <chain:chain..> */ static void bot_traced(int idx, char *par) { char *to = NULL, *p = NULL; int i, sock; to = newsplit(&par); p = strchr(to, '@'); if (p == NULL) p = to; else { *p = 0; p++; } if (!strcasecmp(p, conf.bot->nick)) { time_t t = 0; char *p2 = par, *ss = TBUF; splitc(ss, to, ':'); if (ss[0]) sock = atoi(ss); else sock = (-1); if (par[0] == ':') { t = atoi(par + 1); p2 = strchr(par + 1, ':'); if (p2) p2++; else p2 = par + 1; } for (i = 0; i < dcc_total; i++) { if (dcc[i].type && (dcc[i].type->flags & DCT_CHAT) && (!strcasecmp(dcc[i].nick, to)) && ((sock == (-1)) || (sock == dcc[i].sock))) { if (t) { int j=0; register char *c = p2; for (; *c != '\0'; c++) if (*c == ':') j++; time_t tm; egg_timeval_t tv; timer_get_now(&tv); tm = ((tv.sec % 10000) * 100 + (tv.usec * 100) / (1000000)) - t; dprintf(i, "%s -> %s (%d.%d secs, %d hop%s)\n", "Trace result", p2, (int)(tm / 100), (int)(tm % 100), j, (j != 1) ? "s" : ""); } else dprintf(i, "%s -> %s\n", "Trace result", p); } } } else { i = nextbot(p); if (p != to) *--p = '@'; if (i >= 0) botnet_send_traced(i, to, par); } }
/* traced <to@bot> <chain:chain..> */ static void bot_traced(int idx, char *par) { char *to, *p; int i, sock; to = newsplit(&par); p = strchr(to, '@'); if (p == NULL) p = to; else { *p = 0; p++; } if (!egg_strcasecmp(p, botnetnick)) { time_t t = 0; char *p = par, *ss = TBUF; splitc(ss, to, ':'); if (ss[0]) sock = atoi(ss); else sock = -1; if (par[0] == ':') { t = atoi(par + 1); p = strchr(par + 1, ':'); if (p) p++; else p = par + 1; } for (i = 0; i < dcc_total; i++) if ((dcc[i].type->flags & DCT_CHAT) && (!egg_strcasecmp(dcc[i].nick, to)) && ((sock == -1) || (sock == dcc[i].sock))) { if (t) { int j = 0; { register char *c = p; for (; *c != '\0'; c++) if (*c == ':') j++; } dprintf(i, "%s -> %s (%lu secs, %d hop%s)\n", BOT_TRACERESULT, p, now - t, j, (j != 1) ? "s" : ""); } else dprintf(i, "%s -> %s\n", BOT_TRACERESULT, p); } } else { i = nextbot(p); if (p != to) *--p = '@'; if (i >= 0) botnet_send_traced(i, to, par); } }
/* trace <from@bot> <dest> <chain:chain..> */ static void bot_trace(int idx, char *par) { char *from = NULL, *dest = NULL; int i; from = newsplit(&par); dest = newsplit(&par); simple_snprintf(TBUF, sizeof(TBUF), "%s:%s", par, conf.bot->nick); botnet_send_traced(idx, from, TBUF); if (strcasecmp(dest, conf.bot->nick) && ((i = nextbot(dest)) > 0)) botnet_send_trace(i, from, dest, par); }
/* trace <from@bot> <dest> <chain:chain..> */ static void bot_trace(int idx, char *par) { char *from, *dest; int i; from = newsplit(&par); dest = newsplit(&par); simple_sprintf(TBUF, "%s:%s", par, botnetnick); botnet_send_traced(idx, from, TBUF); if (egg_strcasecmp(dest, botnetnick) && ((i = nextbot(dest)) > 0)) botnet_send_trace(i, from, dest, par); }