/* away <bot> <sock> <message> * null message = unaway */ static void bot_away(int idx, char *par) { char *bot = NULL, *etc = NULL; int sock, partyidx, linking = 0; bot = newsplit(&par); if (bot[0] == '!') { linking = 1; bot++; } if (b_status(idx) & STAT_LINKING) { linking = 1; } etc = newsplit(&par); sock = base64_to_int(etc); if (par[0]) { partystat(bot, sock, PLSTAT_AWAY, 0); partyaway(bot, sock, par); } else { partystat(bot, sock, 0, PLSTAT_AWAY); } partyidx = getparty(bot, sock); if (!linking) { if (par[0]) chanout_but(-1, party[partyidx].chan, "*** (%s) %s %s: %s.\n", conf.bot->hub ? bot : "[botnet]", party[partyidx].nick, "is now away", par); else chanout_but(-1, party[partyidx].chan, "*** (%s) %s %s.\n", conf.bot->hub ? bot : "[botnet]", party[partyidx].nick, "is no longer away"); } botnet_send_away(idx, bot, sock, par, linking); }
/* Mark someone on dcc chat as no longer away */ void not_away(int idx) { if (dcc[idx].u.chat->away == NULL) { dprintf(idx, "You weren't away!\n"); return; } if (dcc[idx].u.chat->channel >= 0) { chanout_but(-1, dcc[idx].u.chat->channel, "*** %s is no longer away.\n", dcc[idx].nick); if (dcc[idx].u.chat->channel < GLOBAL_CHANS) { botnet_send_away(-1, botnetnick, dcc[idx].sock, NULL, idx); } } dprintf(idx, "You're not away any more.\n"); nfree(dcc[idx].u.chat->away); dcc[idx].u.chat->away = NULL; check_tcl_away(botnetnick, dcc[idx].sock, NULL); }
/* away <bot> <sock> <message> * null message = unaway */ static void bot_away(int idx, char *par) { char *bot, *etc; int sock, partyidx, linking = 0; if (bot_flags(dcc[idx].user) & BOT_ISOLATE) return; bot = newsplit(&par); #ifndef NO_OLD_BOTNET if (dcc[idx].u.bot->numver >= NEAT_BOTNET) #endif if (bot[0] == '!') { linking = 1; bot++; } if (dcc[idx].status & BSTAT_LINKING) linking = 1; etc = newsplit(&par); #ifndef NO_OLD_BOTNET if (dcc[idx].u.bot->numver < NEAT_BOTNET) sock = atoi(etc); else #endif sock = base64_to_int(etc); if (sock == 0) sock = partysock(bot, etc); check_tcl_away(bot, sock, par); if (par[0]) { partystat(bot, sock, PLSTAT_AWAY, 0); partyaway(bot, sock, par); } else partystat(bot, sock, 0, PLSTAT_AWAY); partyidx = getparty(bot, sock); if ((dcc[idx].u.bot->numver >= NEAT_BOTNET) && !linking) { if (par[0]) chanout_but(-1, party[partyidx].chan, "*** (%s) %s %s: %s.\n", bot, party[partyidx].nick, NET_AWAY, par); else chanout_but(-1, party[partyidx].chan, "*** (%s) %s %s.\n", bot, party[partyidx].nick, NET_UNAWAY); } botnet_send_away(idx, bot, sock, par, linking); }
void set_away(int idx, char *s) { if (s == NULL) { not_away(idx); return; } if (!s[0]) { not_away(idx); return; } if (dcc[idx].u.chat->away != NULL) nfree(dcc[idx].u.chat->away); dcc[idx].u.chat->away = nmalloc(strlen(s) + 1); strcpy(dcc[idx].u.chat->away, s); if (dcc[idx].u.chat->channel >= 0) { chanout_but(-1, dcc[idx].u.chat->channel, "*** %s is now away: %s\n", dcc[idx].nick, s); if (dcc[idx].u.chat->channel < GLOBAL_CHANS) { botnet_send_away(-1, botnetnick, dcc[idx].sock, s, idx); } } dprintf(idx, "You are now away.\n"); check_tcl_away(botnetnick, dcc[idx].sock, s); }