diff options
-rw-r--r-- | src/fe-common/irc/dcc/fe-dcc-get.c | 8 | ||||
-rw-r--r-- | src/fe-common/irc/dcc/module-formats.c | 1 | ||||
-rw-r--r-- | src/fe-common/irc/dcc/module-formats.h | 1 | ||||
-rw-r--r-- | src/irc/dcc/dcc-get.c | 8 |
4 files changed, 17 insertions, 1 deletions
diff --git a/src/fe-common/irc/dcc/fe-dcc-get.c b/src/fe-common/irc/dcc/fe-dcc-get.c index 093b90e3..4c76e7cd 100644 --- a/src/fe-common/irc/dcc/fe-dcc-get.c +++ b/src/fe-common/irc/dcc/fe-dcc-get.c @@ -98,6 +98,12 @@ static void dcc_error_close_not_found(const char *type, const char *nick, IRCTXT_DCC_GET_NOT_FOUND, nick, fname); } +static void dcc_error_write(GET_DCC_REC *dcc, const char *error) +{ + printformat(NULL, NULL, MSGLEVEL_DCC, + IRCTXT_DCC_GET_WRITE_ERROR, dcc->file, error); +} + static void sig_dcc_list_print(GET_DCC_REC *dcc) { if (IS_DCC_GET(dcc)) @@ -112,6 +118,7 @@ void fe_dcc_get_init(void) signal_add("dcc error file create", (SIGNAL_FUNC) dcc_error_file_create); signal_add("dcc error get not found", (SIGNAL_FUNC) dcc_error_get_not_found); signal_add("dcc error close not found", (SIGNAL_FUNC) dcc_error_close_not_found); + signal_add("dcc error write", (SIGNAL_FUNC) dcc_error_write); signal_add("dcc list print", (SIGNAL_FUNC) sig_dcc_list_print); } @@ -123,5 +130,6 @@ void fe_dcc_get_deinit(void) signal_remove("dcc error file create", (SIGNAL_FUNC) dcc_error_file_create); signal_remove("dcc error get not found", (SIGNAL_FUNC) dcc_error_get_not_found); signal_remove("dcc error close not found", (SIGNAL_FUNC) dcc_error_close_not_found); + signal_remove("dcc error write", (SIGNAL_FUNC) dcc_error_write); signal_remove("dcc list print", (SIGNAL_FUNC) sig_dcc_list_print); } diff --git a/src/fe-common/irc/dcc/module-formats.c b/src/fe-common/irc/dcc/module-formats.c index c3e8d9da..b6d47f55 100644 --- a/src/fe-common/irc/dcc/module-formats.c +++ b/src/fe-common/irc/dcc/module-formats.c @@ -54,6 +54,7 @@ FORMAT_REC fecommon_irc_dcc_formats[] = { { "dcc_get_connected", "{dcc DCC receiving file {dccfile $0} from {nick $1} [$2 port $3]}", 4, { 0, 0, 0, 1 } }, { "dcc_get_complete", "{dcc DCC received file {dccfile $0} [$1kB] from {nick $2} in {hilight $3} secs [$4kB/s]}", 5, { 0, 2, 0, 2, 3 } }, { "dcc_get_aborted", "{dcc DCC aborted receiving file {dccfile $0} from {nick $1}}", 2, { 0, 0 } }, + { "dcc_get_write_error", "{dcc DCC error writing to file {dccfile $0}: {comment $1}", 2, { 0, 0 } }, { "dcc_unknown_ctcp", "{dcc DCC unknown ctcp {hilight $0} from {nick $1} [$2]}", 3, { 0, 0, 0 } }, { "dcc_unknown_reply", "{dcc DCC unknown reply {hilight $0} from {nick $1} [$2]}", 3, { 0, 0, 0 } }, { "dcc_unknown_type", "{dcc DCC unknown type {hilight $0}}", 1, { 0 } }, diff --git a/src/fe-common/irc/dcc/module-formats.h b/src/fe-common/irc/dcc/module-formats.h index 23e948fd..b02f081d 100644 --- a/src/fe-common/irc/dcc/module-formats.h +++ b/src/fe-common/irc/dcc/module-formats.h @@ -32,6 +32,7 @@ enum { IRCTXT_DCC_GET_CONNECTED, IRCTXT_DCC_GET_COMPLETE, IRCTXT_DCC_GET_ABORTED, + IRCTXT_DCC_GET_WRITE_ERROR, IRCTXT_DCC_UNKNOWN_CTCP, IRCTXT_DCC_UNKNOWN_REPLY, IRCTXT_DCC_UNKNOWN_TYPE, diff --git a/src/irc/dcc/dcc-get.c b/src/irc/dcc/dcc-get.c index 52c93483..d13f8376 100644 --- a/src/irc/dcc/dcc-get.c +++ b/src/irc/dcc/dcc-get.c @@ -154,7 +154,13 @@ static void sig_dccget_receive(GET_DCC_REC *dcc) return; } - write(dcc->fhandle, buffer, ret); + if (write(dcc->fhandle, buffer, ret) != ret) { + /* most probably out of disk space */ + signal_emit("dcc error write", 2, + dcc, g_strerror(errno)); + dcc_close(DCC(dcc)); + return; + } dcc->transfd += ret; } |