Пример #1
0
/* send DCC command to start download */
void t_start_dcc_send(transfer *tr)
{
    char *dccdata;
    char *sendnamestr;

    updatecontext();

    sendnamestr = getsendname(tr->xpack->file);
    dccdata = setup_dcc_local(&tr->con.local);
    if (tr->passive_dcc) {
        bzero((char *) &(tr->con.local), sizeof(tr->con.local));
        privmsg_fast(tr->nick, IRC_CTCP "DCC SEND %s %s %" LLPRINTFMT "d %u" IRC_CTCP, /* NOTRANSLATE */
                     sendnamestr, dccdata,
                     tr->xpack->st_size,
                     tr->id);
    } else {
        privmsg_fast(tr->nick, IRC_CTCP "DCC SEND %s %s %" LLPRINTFMT "d" IRC_CTCP, /* NOTRANSLATE */
                     sendnamestr, dccdata,
                     tr->xpack->st_size);

        ioutput(OUT_S|OUT_L|OUT_D, COLOR_YELLOW,
                "listen on port %d for %s (%s on %s)",
                tr->con.localport, tr->nick, tr->hostname, gnetwork->name);
    }
    mydelete(dccdata);
    mydelete(sendnamestr);
}
Пример #2
0
static int l_setup_listen(upload * const l)
{
  char *tempstr;
  char *msg;
  unsigned int rc;

  updatecontext();

  rc = irc_open_listen(&(l->con));
  if (rc != 0) {
    l_closeconn(l, "Connection Lost", 0);
    return 1;
  }

  msg = setup_dcc_local(&(l->con.local));
  tempstr = getsendname(l->file);
  privmsg_fast(l->nick, IRC_CTCP "DCC SEND %s %s %" LLPRINTFMT "d %u" IRC_CTCP, /* NOTRANSLATE */
               tempstr, msg, l->totalsize, l->token);
  mydelete(msg);
  msg = mymalloc(maxtextlength);
  my_getnameinfo(msg, maxtextlength -1, &(l->con.local.sa));
  ioutput(OUT_S|OUT_L|OUT_D, COLOR_MAGENTA,
          "DCC SEND sent to %s on %s, waiting for connection on %s",
          l->nick, gnetwork->name, msg);
  mydelete(tempstr);
  mydelete(msg);

  l->ul_status = UPLOAD_STATUS_LISTENING;
  return 0;
}
Пример #3
0
int setupdccchatout(const char *nick, const char *hostmask, const char *token)
{
  char *msg;
  char *token2 = NULL;
  unsigned int rc;
  dccchat_t *chat;
  
  updatecontext();
  
  chat = irlist_add(&gdata.dccchats, sizeof(dccchat_t));
  chat->name = gnetwork->name;
  chat->status = DCCCHAT_UNUSED;
  chat->con.family = gnetwork->myip.sa.sa_family;

  rc = irc_open_listen(&(chat->con));
  if (rc != 0)
    return 1;
  
  gdata.num_dccchats++;
  chat->status = DCCCHAT_LISTENING;
  chat->con.clientsocket = FD_UNUSED;
  chat->nick = mystrdup(nick);
  chat->net = gnetwork->net;
  chat->hostmask = mystrdup(hostmask);
  
  msg = setup_dcc_local(&(chat->con.local));
  if (token != NULL) {
    privmsg_fast(nick, IRC_CTCP "DCC CHAT CHAT %s %s" IRC_CTCP, msg, token);
  } else {
    privmsg_fast(nick, IRC_CTCP "DCC CHAT CHAT %s" IRC_CTCP, msg);
  }
  my_getnameinfo(msg, maxtextlength -1, &(chat->con.local.sa));
  chat->con.localaddr = mystrdup(msg);
  mydelete(token2);
  mydelete(msg);
  ioutput(OUT_S|OUT_L|OUT_D, COLOR_MAGENTA,
          "DCC CHAT sent to %s on %s, waiting for connection on %s",
          nick, chat->name, chat->con.localaddr);
  return 0;
}