Exemple #1
0
LOCAL void PROC process (const char target[]) {
/*      if (strlen(target) > sizeof(path)-5) {
 *              sayerror (E_TARGET, "too long", target);
 *              return;
 *      }
 */     found = 0;
        do_path (nsplit (adds (path, target)));
        if (found == 0) sayerror (E_TARGET, "no targets", target);
}
Exemple #2
0
static void wire_filter(char *from, char *cmd, char *param)
{
  char wirecrypt[512];
  char wirewho[512];
  char wiretmp2[512];
  char wiretmp[512];
  char wirereq[512];
  wire_list *w = wirelist;
  char reqsock;
  time_t now2 = now;
  char idle[20];
  char *enctmp;

  strcpy(wirecrypt, &cmd[5]);
  strcpy(wiretmp, param);
  nsplit(wirereq, param);

/*
 * !wire<crypt"wire"> !wirereq <destbotsock> <crypt"destbotnick">
 * -----  wirecrypt    wirereq    wirewho         param
 */

  if (!strcmp(wirereq, "!wirereq")) {
    nsplit(wirewho, param);
    while (w) {
      if (!strcmp(w->crypt, wirecrypt)) {
        int idx = findanyidx(w->sock);

        reqsock = atoi(wirewho);
        if (now2 - dcc[idx].timeval > 300) {
          unsigned long Days, hrs, mins;

          Days = (now2 - dcc[idx].timeval) / 86400;
          hrs = ((now2 - dcc[idx].timeval) - (Days * 86400)) / 3600;
          mins = ((now2 - dcc[idx].timeval) - (hrs * 3600)) / 60;
          if (Days > 0)
            sprintf(idle, " [%s %lud%luh]", WIRE_IDLE, Days, hrs);
          else if (hrs > 0)
            sprintf(idle, " [%s %luh%lum]", WIRE_IDLE, hrs, mins);
          else
            sprintf(idle, " [%s %lum]", WIRE_IDLE, mins);
        } else
          idle[0] = 0;
        sprintf(wirereq, "----- %c%-9s %-9s  %s%s",
                geticon(idx), dcc[idx].nick, botnetnick, dcc[idx].host, idle);
        enctmp = encrypt_string(w->key, wirereq);
        strcpy(wiretmp, enctmp);
        nfree(enctmp);
        sprintf(wirereq, "zapf %s %s !wire%s !wireresp %s %s %s",
                botnetnick, from, wirecrypt, wirewho, param, wiretmp);
        dprintf(nextbot(from), "%s\n", wirereq);
        if (dcc[idx].u.chat->away) {
          sprintf(wirereq, "-----    %s: %s\n", WIRE_AWAY,
                  dcc[idx].u.chat->away);
          enctmp = encrypt_string(w->key, wirereq);
          strcpy(wiretmp, enctmp);
          nfree(enctmp);
          sprintf(wirereq, "zapf %s %s !wire%s !wireresp %s %s %s",
                  botnetnick, from, wirecrypt, wirewho, param, wiretmp);
          dprintf(nextbot(from), "%s\n", wirereq);
        }
      }
      w = w->next;
    }
    return;
  }
  if (!strcmp(wirereq, "!wireresp")) {
    nsplit(wirewho, param);
    reqsock = atoi(wirewho);
    w = wirelist;
    nsplit(wiretmp2, param);
    while (w) {
      if (w->sock == reqsock) {
        int idx = findanyidx(reqsock);

        enctmp = decrypt_string(w->key, wiretmp2);
        strcpy(wirewho, enctmp);
        nfree(enctmp);
        if (!strcmp(dcc[idx].nick, wirewho)) {
          enctmp = decrypt_string(w->key, param);
          dprintf(idx, "%s\n", enctmp);
          nfree(enctmp);
          return;
        }
      }
      w = w->next;
    }
    return;
  }
  while (w) {
    if (!strcmp(wirecrypt, w->crypt))
      wire_display(findanyidx(w->sock), w->key, wirereq, param);
    w = w->next;
  }
}