예제 #1
0
/* start normal or passive DCC download */
void t_setup_dcc(transfer *tr)
{
    char *vhost;
    int e = 1;

    updatecontext();

    vhost = get_local_vhost();
    if (tr->passive_dcc) {
        bzero((char *) &(tr->con.local), sizeof(tr->con.local));
        if (tr->con.family == AF_INET) {
            tr->con.local.sin.sin_family = AF_INET;
            tr->con.local.sin.sin_port = htons(0);
            if (vhost) {
                e = inet_pton(tr->con.family, vhost, &(tr->con.local.sin.sin_addr));
            } else {
                tr->con.local.sin.sin_addr.s_addr = gnetwork->myip.sin.sin_addr.s_addr;
            }
        } else {
            tr->con.local.sin6.sin6_family = AF_INET6;
            tr->con.local.sin6.sin6_port = htons(0);
            if (vhost) {
                e = inet_pton(tr->con.family, vhost, &(tr->con.local.sin6.sin6_addr));
            }
        }
        if (e != 1) {
            outerror(OUTERROR_TYPE_WARN_LOUD, "Invalid IP: %s", vhost);
        }
        tr->tr_status = TRANSFER_STATUS_RESUME;
        tr->con.localport = 0;
    } else {
        t_setuplisten(tr);

        if (tr->tr_status != TRANSFER_STATUS_LISTENING)
            return;
    }

    t_start_dcc_send(tr);
}
예제 #2
0
void t_remind(transfer * const t) {
   gnetwork_t *backup;
   
   updatecontext();
   
   backup = gnetwork;
   gnetwork = &(gdata.networks[t->net]);
   if (gnetwork->serverstatus == SERVERSTATUS_CONNECTED)
     {
       notice(t->nick,"** You have a DCC pending, Set your client to receive the transfer. "
              "Type \"/MSG %s XDCC CANCEL\" to abort the transfer. "
              "(%li seconds remaining until timeout)",
              get_user_nick(),
              (long)(t->con.lastcontact+180-gdata.curtime));
     }
   
   if ( gdata.reminder_send_retry > t->reminded ) {
     t_start_dcc_send(t);
     }
   gnetwork = backup;
   t->reminded++;
   }