Exemple #1
0
/* chan <from> <chan> <text>
 */
static void bot_chan2(int idx, char *msg)
{
  char *from, *p;
  int i, chan;

  if (bot_flags(dcc[idx].user) & BOT_ISOLATE)
    return;
  from = newsplit(&msg);
  p = newsplit(&msg);
#ifndef NO_OLD_BOTNET
  if (dcc[idx].u.bot->numver < NEAT_BOTNET)
    chan = atoi(p);
  else
#endif
    chan = base64_to_int(p);
  /* Strip annoying control chars */
  for (p = from; *p;) {
    if ((*p < 32) || (*p == 127))
      strcpy(p, p + 1);
    else
      p++;
  }
  p = strchr(from, '@');
  if (p) {
    sprintf(TBUF, "<%s> %s", from, msg);
    *p = 0;
    if (!partyidle(p + 1, from)) {
      *p = '@';
      fake_alert(idx, "user", from);
      return;
    }
    *p = '@';
    p++;
  } else {
    sprintf(TBUF, "*** (%s) %s", from, msg);
    p = from;
  }
  i = nextbot(p);
  if (i != idx) {
    fake_alert(idx, "direction", p);
  } else {
    chanout_but(-1, chan, "%s\n", TBUF);
    /* Send to new version bots */
    if (i >= 0)
      botnet_send_chan(idx, from, NULL, chan, msg);
    if (strchr(from, '@') != NULL)
      check_tcl_chat(from, chan, msg);
    else
      check_tcl_bcst(from, chan, msg);
  }
}
Exemple #2
0
/* chan <from> <chan> <text>
 */
static void bot_chan2(int idx, char *msg)
{
  char *from = NULL, *p = NULL;
  int i, chan;

  from = newsplit(&msg);
  p = newsplit(&msg);
  chan = base64_to_int(p);
  /* Strip annoying control chars */
  for (p = from; *p;) {
    if ((*p < 32) || (*p == 127))
      memmove(p, p + 1, strlen(p));
    else
      p++;
  }
  p = strchr(from, '@');
  if (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;
      simple_snprintf(TBUF, sizeof(TBUF), "<%s@[botnet]> %s", newfrom, msg);
    } else
      simple_snprintf(TBUF, sizeof(TBUF), "<%s> %s", from, msg);
    *p = 0;
    if (!partyidle(p + 1, from)) {
      *p = '@';
      fake_alert(idx, "user", from, "chan2_i");
      return;
    }
    *p = '@';
    p++;
  } else {
    simple_snprintf(TBUF, sizeof(TBUF), "*** (%s) %s", from, msg);
    p = from;
  }
  i = nextbot(p);
  if (i != idx) {
    fake_alert(idx, "direction", p, "chan2_ii");
  } else {
    chanout_but(-1, chan, "%s\n", TBUF);
    /* Send to new version bots */
    if (i >= 0)
      botnet_send_chan(idx, from, NULL, chan, msg);
  }
}
Exemple #3
0
static int tcl_dccputchan(ClientData cd, Tcl_Interp *irp,
                          int argc, char *argv[])
{
  int chan;
  char msg[401];

  BADARGS(3, 3, " channel message");

  chan = atoi(argv[1]);
  if ((chan < 0) || (chan > 199999)) {
    Tcl_AppendResult(irp, "channel out of range; must be 0 through 199999", NULL);
    return TCL_ERROR;
  }
  strncpyz(msg, argv[2], sizeof msg);

  chanout_but(-1, chan, "*** %s\n", argv[2]);
  botnet_send_chan(-1, botnetnick, NULL, chan, argv[2]);
  check_tcl_bcst(botnetnick, chan, argv[2]);
  return TCL_OK;
}