diff options
author | Timo Sirainen <cras@irssi.org> | 2002-11-11 06:35:12 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-11-11 06:35:12 +0000 |
commit | 488e7b70f40eb45dafa97a22e2b19995bde52933 (patch) | |
tree | 0a664055c4e071254c297544efb07fb9033d7b16 /src/fe-common/irc/dcc | |
parent | cd3ff41f3e59bf6955abf339426672ec14bb6194 (diff) | |
download | irssi-488e7b70f40eb45dafa97a22e2b19995bde52933.zip |
DCC send supports now queueing. Patch by Heikki Orsila <heikki@ee.tut.fi>,
although I did pretty heavy changes which hopefully didn't break it too
badly :)
New syntax: DCC SEND [-append | -prepend | flush | -rmtail | -rmhead] <nick>
-<file> [<file> ...]
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2994 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/irc/dcc')
-rw-r--r-- | src/fe-common/irc/dcc/fe-dcc-send.c | 27 | ||||
-rw-r--r-- | src/fe-common/irc/dcc/module-formats.c | 2 | ||||
-rw-r--r-- | src/fe-common/irc/dcc/module-formats.h | 2 |
3 files changed, 29 insertions, 2 deletions
diff --git a/src/fe-common/irc/dcc/fe-dcc-send.c b/src/fe-common/irc/dcc/fe-dcc-send.c index 6ec49ed8..1672bdd1 100644 --- a/src/fe-common/irc/dcc/fe-dcc-send.c +++ b/src/fe-common/irc/dcc/fe-dcc-send.c @@ -26,6 +26,7 @@ #include "dcc-file.h" #include "dcc-send.h" +#include "dcc-queue.h" #include "module-formats.h" #include "printtext.h" @@ -86,6 +87,12 @@ static void dcc_error_send_exists(const char *nick, const char *fname) IRCTXT_DCC_SEND_EXISTS, fname, nick); } +static void dcc_error_send_no_route(const char *nick, const char *fname) +{ + printformat(NULL, NULL, MSGLEVEL_DCC, + IRCTXT_DCC_SEND_NO_ROUTE, nick, fname); +} + static void dcc_error_close_not_found(const char *type, const char *nick, const char *fname) { @@ -129,8 +136,22 @@ static void sig_dcc_send_complete(GList **list, WINDOW_REC *window, static void sig_dcc_list_print(SEND_DCC_REC *dcc) { - if (IS_DCC_SEND(dcc)) - dcc_list_print_file((FILE_DCC_REC *) dcc); + GSList *queue; + + if (!IS_DCC_SEND(dcc)) + return; + + dcc_list_print_file((FILE_DCC_REC *) dcc); + + queue = dcc_queue_get_queue(dcc->queue); + for (; queue != NULL; queue = queue->next) { + DCC_QUEUE_REC *rec = queue->data; + + printformat(NULL, NULL, MSGLEVEL_DCC, + IRCTXT_DCC_LIST_LINE_QUEUED_SEND, rec->nick, + rec->servertag == NULL ? "" : rec->servertag, + rec->file); + } } void fe_dcc_send_init(void) @@ -139,6 +160,7 @@ void fe_dcc_send_init(void) signal_add("dcc closed", (SIGNAL_FUNC) dcc_closed); 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 send no route", (SIGNAL_FUNC) dcc_error_send_no_route); 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); signal_add("dcc list print", (SIGNAL_FUNC) sig_dcc_list_print); @@ -150,6 +172,7 @@ void fe_dcc_send_deinit(void) signal_remove("dcc closed", (SIGNAL_FUNC) dcc_closed); 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 send no route", (SIGNAL_FUNC) dcc_error_send_no_route); 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); 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 873344ee..ccfae8f1 100644 --- a/src/fe-common/irc/dcc/module-formats.c +++ b/src/fe-common/irc/dcc/module-formats.c @@ -45,6 +45,7 @@ FORMAT_REC fecommon_irc_dcc_formats[] = { { "dcc_send", "{dcc DCC SEND from {nick $0} [$1 port $2]: $3 [$4 bytes]}", 5, { 0, 0, 1, 0, 2 } }, { "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_no_route", "{dcc DCC route lost to nick {nick $0} when trying to send file {dccfile $1}}", 2, { 0, 0 } }, { "dcc_send_not_found", "{dcc DCC not sending file {dccfile $1} to {nick $0}}", 2, { 0, 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 } }, @@ -68,6 +69,7 @@ FORMAT_REC fecommon_irc_dcc_formats[] = { { "dcc_list_header", "{dcc DCC connections}", 0 }, { "dcc_list_line_chat", "{dcc $0 $1}", 2, { 0, 0 } }, { "dcc_list_line_file", "{dcc $0 $1: $2k of $3k ($4%%) - $5kB/s - $6}", 7, { 0, 0, 2, 2, 1, 3, 0 } }, + { "dcc_list_line_queued_send", "{dcc - $0 $2 (queued)}", 3, { 0, 0, 0 } }, { "dcc_list_footer", "", 0 }, { NULL, NULL, 0 } diff --git a/src/fe-common/irc/dcc/module-formats.h b/src/fe-common/irc/dcc/module-formats.h index b02f081d..b2266816 100644 --- a/src/fe-common/irc/dcc/module-formats.h +++ b/src/fe-common/irc/dcc/module-formats.h @@ -23,6 +23,7 @@ enum { IRCTXT_DCC_SEND, IRCTXT_DCC_SEND_CHANNEL, IRCTXT_DCC_SEND_EXISTS, + IRCTXT_DCC_SEND_NO_ROUTE, IRCTXT_DCC_SEND_NOT_FOUND, IRCTXT_DCC_SEND_FILE_OPEN_ERROR, IRCTXT_DCC_SEND_CONNECTED, @@ -46,6 +47,7 @@ enum { IRCTXT_DCC_LIST_HEADER, IRCTXT_DCC_LIST_LINE_CHAT, IRCTXT_DCC_LIST_LINE_FILE, + IRCTXT_DCC_LIST_LINE_QUEUED_SEND, IRCTXT_DCC_LIST_FOOTER }; |