diff --git a/src/irc/dcc/dcc-get.c b/src/irc/dcc/dcc-get.c index 0ebf3e20..36da43f4 100644 --- a/src/irc/dcc/dcc-get.c +++ b/src/irc/dcc/dcc-get.c @@ -176,9 +176,11 @@ static void sig_dccget_connected(DCC_REC *dcc) } if (dcc->get_type != DCC_GET_RESUME) { - dcc->fhandle = open(dcc->file, O_WRONLY | O_TRUNC | O_CREAT, dcc_file_create_mode); + dcc->fhandle = open(dcc->file, O_WRONLY | O_TRUNC | O_CREAT, + dcc_file_create_mode); if (dcc->fhandle == -1) { - signal_emit("dcc error file create", 2, dcc, dcc->file); + signal_emit("dcc error file create", 2, + dcc, dcc->file); dcc_destroy(dcc); return; } @@ -205,9 +207,11 @@ void dcc_get_connect(DCC_REC *dcc) dcc->handle = net_connect_ip(&dcc->addr, dcc->port, source_host_ok ? source_host_ip : NULL); if (dcc->handle != NULL) { - dcc->tagconn = g_input_add(dcc->handle, - G_INPUT_WRITE | G_INPUT_READ, - (GInputFunction) sig_dccget_connected, dcc); + dcc->tagconn = + g_input_add(dcc->handle, + G_INPUT_WRITE | G_INPUT_READ, + (GInputFunction) sig_dccget_connected, + dcc); } else { /* error connecting */ signal_emit("dcc error connect", 1, dcc); diff --git a/src/irc/dcc/dcc-resume.c b/src/irc/dcc/dcc-resume.c index 3fa884bb..3404a092 100644 --- a/src/irc/dcc/dcc-resume.c +++ b/src/irc/dcc/dcc-resume.c @@ -90,11 +90,10 @@ static void ctcp_msg_dcc_resume(IRC_SERVER_REC *server, const char *data, char *str; long size; - if (!dcc_ctcp_resume_parse(DCC_TYPE_RESUME, data, nick, &dcc, &size)) + if (!dcc_ctcp_resume_parse(DCC_TYPE_RESUME, data, nick, &dcc, &size)) { signal_emit("dcc error ctcp", 5, "RESUME", data, nick, addr, target); - - if (dcc != NULL && dcc_resume_file_check(dcc, server, size)) { + } else if (dcc != NULL && dcc_resume_file_check(dcc, server, size)) { str = g_strdup_printf(dcc->file_quoted ? "DCC ACCEPT \"%s\" %d %lu" : "DCC ACCEPT %s %d %lu", @@ -114,11 +113,10 @@ static void ctcp_msg_dcc_accept(IRC_SERVER_REC *server, const char *data, long size; if (!dcc_ctcp_resume_parse(DCC_TYPE_ACCEPT, data, nick, &dcc, &size) || - (dcc != NULL && dcc->get_type != DCC_GET_RESUME)) + (dcc != NULL && dcc->get_type != DCC_GET_RESUME)) { signal_emit("dcc error ctcp", 5, "ACCEPT", data, nick, addr, target); - - if (dcc != NULL && dcc_resume_file_check(dcc, server, size)) + } else if (dcc != NULL && dcc_resume_file_check(dcc, server, size)) dcc_get_connect(dcc); } @@ -145,15 +143,15 @@ static void dcc_send_resume(DCC_REC *dcc) /* already received whole file */ dcc->starttime = time(NULL); dcc_reject(dcc, NULL); - return; + } else { + str = g_strdup_printf(dcc->file_quoted ? + "DCC RESUME \"%s\" %d %lu" : + "DCC RESUME %s %d %lu", + dcc->arg, dcc->port, dcc->transfd); + dcc_ctcp_message(dcc->server, dcc->nick, + dcc->chat, FALSE, str); + g_free(str); } - - str = g_strdup_printf(dcc->file_quoted ? - "DCC RESUME \"%s\" %d %lu" : - "DCC RESUME %s %d %lu", - dcc->arg, dcc->port, dcc->transfd); - dcc_ctcp_message(dcc->server, dcc->nick, dcc->chat, FALSE, str); - g_free(str); } /* SYNTAX: DCC RESUME [ []] */