summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-05-11 12:43:59 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-05-11 12:43:59 +0000
commitcb2868557491ce3d1d61d6d55811a80a387efe4f (patch)
tree9c5eb3a8a200daad59d37bf88307b9a8a630aa73
parent54ffbf9c57a623af4ad8a3909444c6827ca4c610 (diff)
downloadirssi-cb2868557491ce3d1d61d6d55811a80a387efe4f.zip
"dcc error file not found" -> "dcc error file open". Print the actual error
message based on errno, don't just assume the file wasn't found. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1471 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--docs/signals.txt2
-rw-r--r--src/fe-common/irc/dcc/fe-dcc-send.c10
-rw-r--r--src/fe-common/irc/dcc/module-formats.c2
-rw-r--r--src/fe-common/irc/dcc/module-formats.h2
-rw-r--r--src/irc/dcc/dcc-resume.c3
-rw-r--r--src/irc/dcc/dcc-send.c3
6 files changed, 13 insertions, 9 deletions
diff --git a/docs/signals.txt b/docs/signals.txt
index 12630a5e..20484abd 100644
--- a/docs/signals.txt
+++ b/docs/signals.txt
@@ -189,7 +189,7 @@ dcc*.c:
"dcc get receive", DCC_REC
"dcc error connect", DCC_REC
"dcc error file create", DCC_REC, char *filename
- "dcc error file not found", char *nick, char *filename
+ "dcc error file open", char *nick, char *filename, int errno
"dcc error get not found", char *nick
"dcc error send exists", char *nick, char *filename
"dcc error unknown type", char *type
diff --git a/src/fe-common/irc/dcc/fe-dcc-send.c b/src/fe-common/irc/dcc/fe-dcc-send.c
index 788d34f9..359e903c 100644
--- a/src/fe-common/irc/dcc/fe-dcc-send.c
+++ b/src/fe-common/irc/dcc/fe-dcc-send.c
@@ -64,13 +64,15 @@ static void dcc_closed(SEND_DCC_REC *dcc)
}
}
-static void dcc_error_file_not_found(const char *nick, const char *fname)
+static void dcc_error_file_open(const char *nick, const char *fname,
+ void *error)
{
g_return_if_fail(nick != NULL);
g_return_if_fail(fname != NULL);
printformat(NULL, NULL, MSGLEVEL_DCC,
- IRCTXT_DCC_SEND_FILE_NOT_FOUND, fname);
+ IRCTXT_DCC_SEND_FILE_OPEN_ERROR, fname,
+ g_strerror(GPOINTER_TO_INT(error)));
}
static void dcc_error_send_exists(const char *nick, const char *fname)
@@ -124,7 +126,7 @@ void fe_dcc_send_init(void)
{
signal_add("dcc connected", (SIGNAL_FUNC) dcc_connected);
signal_add("dcc closed", (SIGNAL_FUNC) dcc_closed);
- signal_add("dcc error file not found", (SIGNAL_FUNC) dcc_error_file_not_found);
+ signal_add("dcc error file open", (SIGNAL_FUNC) dcc_error_file_open);
signal_add("dcc error send exists", (SIGNAL_FUNC) dcc_error_send_exists);
signal_add("dcc error close not found", (SIGNAL_FUNC) dcc_error_close_not_found);
signal_add("complete command dcc send", (SIGNAL_FUNC) sig_dcc_send_complete);
@@ -135,7 +137,7 @@ void fe_dcc_send_deinit(void)
{
signal_remove("dcc connected", (SIGNAL_FUNC) dcc_connected);
signal_remove("dcc closed", (SIGNAL_FUNC) dcc_closed);
- signal_remove("dcc error file not found", (SIGNAL_FUNC) dcc_error_file_not_found);
+ signal_remove("dcc error file open", (SIGNAL_FUNC) dcc_error_file_open);
signal_remove("dcc error send exists", (SIGNAL_FUNC) dcc_error_send_exists);
signal_remove("dcc error close not found", (SIGNAL_FUNC) dcc_error_close_not_found);
signal_remove("complete command dcc send", (SIGNAL_FUNC) sig_dcc_send_complete);
diff --git a/src/fe-common/irc/dcc/module-formats.c b/src/fe-common/irc/dcc/module-formats.c
index 2bbea562..2c6c7bd3 100644
--- a/src/fe-common/irc/dcc/module-formats.c
+++ b/src/fe-common/irc/dcc/module-formats.c
@@ -45,7 +45,7 @@ FORMAT_REC fecommon_irc_dcc_formats[] = {
{ "dcc_send_channel", "{dcc DCC SEND from {nick $0} [$1 port $2]: $3 [$4 bytes] requested in channel {channel $5}}", 6, { 0, 0, 1, 0, 2, 0 } },
{ "dcc_send_exists", "{dcc DCC already sending file {dccfile $0} for {nick $1}}", 2, { 0, 0 } },
{ "dcc_send_not_found", "{dcc DCC not sending file {dccfile $1} to {nick $0}}", 2, { 0, 0 } },
- { "dcc_send_file_not_found", "{dcc DCC file not found: {dccfile $0}}", 1, { 0 } },
+ { "dcc_send_file_open_error", "{dcc DCC can't open file {dccfile $0}: $1}", 2, { 0, 0 } },
{ "dcc_send_connected", "{dcc DCC sending file {dccfile $0} for {nick $1} [$2 port $3]}", 4, { 0, 0, 0, 1 } },
{ "dcc_send_complete", "{dcc DCC sent file {dccfile $0} [{hilight $1}kB] for {nick $2} in {hilight $3} secs [{hilight $4kB/s}]}", 5, { 0, 2, 0, 2, 3 } },
{ "dcc_send_aborted", "{dcc DCC aborted sending file {dccfile $0} for {nick $1}}", 2, { 0, 0 } },
diff --git a/src/fe-common/irc/dcc/module-formats.h b/src/fe-common/irc/dcc/module-formats.h
index 45839220..ad7c867a 100644
--- a/src/fe-common/irc/dcc/module-formats.h
+++ b/src/fe-common/irc/dcc/module-formats.h
@@ -23,7 +23,7 @@ enum {
IRCTXT_DCC_SEND_CHANNEL,
IRCTXT_DCC_SEND_EXISTS,
IRCTXT_DCC_SEND_NOT_FOUND,
- IRCTXT_DCC_SEND_FILE_NOT_FOUND,
+ IRCTXT_DCC_SEND_FILE_OPEN_ERROR,
IRCTXT_DCC_SEND_CONNECTED,
IRCTXT_DCC_SEND_COMPLETE,
IRCTXT_DCC_SEND_ABORTED,
diff --git a/src/irc/dcc/dcc-resume.c b/src/irc/dcc/dcc-resume.c
index f97f6ae9..899a7475 100644
--- a/src/irc/dcc/dcc-resume.c
+++ b/src/irc/dcc/dcc-resume.c
@@ -132,7 +132,8 @@ static void dcc_send_resume(GET_DCC_REC *dcc)
dcc->file = dcc_get_download_path(dcc->arg);
dcc->fhandle = open(dcc->file, O_WRONLY);
if (dcc->fhandle == -1) {
- signal_emit("dcc error file not found", 2, dcc, dcc->file);
+ signal_emit("dcc error file open", 3, dcc->nick, dcc->file,
+ GINT_TO_POINTER(errno));
return;
}
diff --git a/src/irc/dcc/dcc-send.c b/src/irc/dcc/dcc-send.c
index 319898ef..8f517063 100644
--- a/src/irc/dcc/dcc-send.c
+++ b/src/irc/dcc/dcc-send.c
@@ -203,7 +203,8 @@ static void cmd_dcc_send(const char *data, IRC_SERVER_REC *server,
g_free(str);
if (hfile == -1) {
- signal_emit("dcc error file not found", 2, target, fname);
+ signal_emit("dcc error file open", 3, target, fname,
+ GINT_TO_POINTER(errno));
cmd_params_free(free_arg);
return;
}