mirror of
https://github.com/irssi/irssi.git
synced 2025-01-03 14:56:47 -05:00
"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
This commit is contained in:
parent
54ffbf9c57
commit
cb28685574
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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 } },
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user