/* link <from@bot> <who> <to-whom> */ static void bot_link(int idx, char *par) { char *from, *bot, *rfrom; int i; from = newsplit(&par); bot = newsplit(&par); if (!egg_strcasecmp(bot, botnetnick)) { if ((rfrom = strchr(from, ':'))) rfrom++; else rfrom = from; putlog(LOG_CMDS, "*", "#%s# link %s", rfrom, par); if (botlink(from, -1, par)) botnet_send_priv(idx, botnetnick, from, NULL, "%s %s ...", BOT_LINKATTEMPT, par); else botnet_send_priv(idx, botnetnick, from, NULL, "%s.", BOT_CANTLINKTHERE); } else { i = nextbot(bot); if (i >= 0) botnet_send_link(i, from, bot, par); } }
/* link <from@bot> <who> <to-whom> */ static void bot_link(int idx, char *par) { char *from = NULL, *bot = NULL, *rfrom = NULL; int i; from = newsplit(&par); bot = newsplit(&par); if (!strcasecmp(bot, conf.bot->nick)) { if ((rfrom = strchr(from, ':'))) rfrom++; else rfrom = from; putlog(LOG_CMDS, "*", "#%s# link %s", rfrom, par); if (botlink(from, -1, par)) botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s %s ...", "Attempting to link", par); else botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s.", "Can't link there"); } else { i = nextbot(bot); if (i >= 0) botnet_send_link(i, from, bot, par); } }
static int tcl_link(ClientData cd, Tcl_Interp *irp, int argc, char *argv[]) { int x, i; char bot[HANDLEN + 1], bot2[HANDLEN + 1]; BADARGS(2, 3, " ?via-bot? bot"); strncpyz(bot, argv[1], sizeof bot); if (argc == 3) { x = 1; strncpyz(bot2, argv[2], sizeof bot2); i = nextbot(bot); if (i < 0) x = 0; else botnet_send_link(i, botnetnick, bot, bot2); } else x = botlink("", -2, bot); egg_snprintf(bot, sizeof bot, "%d", x); Tcl_AppendResult(irp, bot, NULL); return TCL_OK; }