Exemplo n.º 1
0
/* actchan <from> <chan> <text>
 */
static void bot_actchan(int idx, char *par)
{
  char *from = NULL, *p = NULL;
  int i, chan;

  from = newsplit(&par);
  p = strchr(from, '@');
  if (p == NULL) {
    /* How can a bot do an action? */
    fake_alert(idx, "user@bot", from, "actchan_i");
    return;
  }
  *p = 0;
  if (!partyidle(p + 1, from)) {
    *p = '@';
    fake_alert(idx, "user", from, "actchan_ii");
    return;
  }
  *p = '@';
  p++;
  i = nextbot(p);
  if (i != idx) {
    fake_alert(idx, "direction", p, "actchan_iii");
    return;
  }
  p = newsplit(&par);
  chan = base64_to_int(p);
  for (p = from; *p;) {
    if ((*p < 32) || (*p == 127))
      memmove(p, p + 1, strlen(p));
    else
      p++;
  }
  if (!conf.bot->hub) { /* Need to strip out the hub nick */
    char *q = NULL, newfrom[HANDLEN + 9 + 1]; /* HANDLEN@[botnet] */
 
    strlcpy(newfrom, from, sizeof(newfrom));
    q = strchr(newfrom, '@');
    *q = 0;
    chanout_but(-1, chan, "* %s@[botnet] %s\n", newfrom, par);
  } else
    chanout_but(-1, chan, "* %s %s\n", from, par);
  botnet_send_act(idx, from, NULL, chan, par);
}
Exemplo n.º 2
0
/* actchan <from> <chan> <text>
 */
static void bot_actchan(int idx, char *par)
{
  char *from, *p;
  int i, chan;

  if (bot_flags(dcc[idx].user) & BOT_ISOLATE)
    return;
  from = newsplit(&par);
  p = strchr(from, '@');
  if (p == NULL) {
    /* How can a bot do an action? */
    fake_alert(idx, "user@bot", from);
    return;
  }
  *p = 0;
  if (!partyidle(p + 1, from)) {
    *p = '@';
    fake_alert(idx, "user", from);
    return;
  }
  *p = '@';
  p++;
  i = nextbot(p);
  if (i != idx) {
    fake_alert(idx, "direction", p);
    return;
  }
  p = newsplit(&par);
#ifndef NO_OLD_BOTNET
  if (dcc[idx].u.bot->numver < NEAT_BOTNET)
    chan = atoi(p);
  else
#endif
    chan = base64_to_int(p);
  for (p = from; *p;) {
    if ((*p < 32) || (*p == 127))
      strcpy(p, p + 1);
    else
      p++;
  }
  chanout_but(-1, chan, "* %s %s\n", from, par);
  botnet_send_act(idx, from, NULL, chan, par);
  check_tcl_act(from, chan, par);
}