示例#1
0
文件: botcmd.c 项目: vap0r/wraith
/* 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);
}
示例#2
0
/* (a courtesy info to help during connect bursts)
 * idle <bot> <sock> <#secs> [away msg]
 */
static void bot_idle(int idx, char *par)
{
  char *bot, *work;
  int sock, idle;

  if (bot_flags(dcc[idx].user) & BOT_ISOLATE)
    return;
  bot = newsplit(&par);
  work = newsplit(&par);
#ifndef NO_OLD_BOTNET
  if (dcc[idx].u.bot->numver < NEAT_BOTNET)
    sock = atoi(work);
  else
#endif
    sock = base64_to_int(work);
  if (sock == 0)
    sock = partysock(bot, work);
  work = newsplit(&par);
#ifndef NO_OLD_BOTNET
  if (dcc[idx].u.bot->numver < NEAT_BOTNET)
    idle = atoi(work);
  else
#endif
    idle = base64_to_int(work);
  partysetidle(bot, sock, idle);
  if (par[0]) {
    partystat(bot, sock, PLSTAT_AWAY, 0);
    partyaway(bot, sock, par);
  }
  botnet_send_idle(idx, bot, sock, idle, par);
}
示例#3
0
/* 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);
}
示例#4
0
文件: botcmd.c 项目: vap0r/wraith
/* (a courtesy info to help during connect bursts)
 * idle <bot> <sock> <#secs> [away msg]
 */
static void bot_idle(int idx, char *par)
{
  char *bot = NULL, *work = NULL;
  int sock, idle;

  bot = newsplit(&par);
  work = newsplit(&par);
  sock = base64_to_int(work);
  work = newsplit(&par);
  idle = base64_to_int(work);
  partysetidle(bot, sock, idle);
  if (par[0]) {
    partystat(bot, sock, PLSTAT_AWAY, 0);
    partyaway(bot, sock, par);
  }
  botnet_send_idle(idx, bot, sock, idle, par);
}