summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2006-07-27 21:05:15 +0000
committerSebastien Helleu <flashcode@flashtux.org>2006-07-27 21:05:15 +0000
commitd861cb0fd3591d712041661d43722ff652bc2612 (patch)
treed964007822fb8bdc00ed9f06f5af085614bb75fb /src
parentc92ad8b195973512dc4de40dd129d6c3fee3dbfd (diff)
downloadweechat-d861cb0fd3591d712041661d43722ff652bc2612.zip
Use of constants for min/max DCC blocksize
Diffstat (limited to 'src')
-rw-r--r--src/common/weeconfig.c2
-rw-r--r--src/irc/irc-dcc.c4
-rw-r--r--src/irc/irc.h3
3 files changed, 6 insertions, 3 deletions
diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c
index 11d05ce70..cb8449539 100644
--- a/src/common/weeconfig.c
+++ b/src/common/weeconfig.c
@@ -825,7 +825,7 @@ t_config_option weechat_options_dcc[] =
NULL, NULL, &cfg_dcc_timeout, NULL, &config_change_noop },
{ "dcc_blocksize", N_("block size for dcc packets"),
N_("block size for dcc packets in bytes (default: 65536)"),
- OPTION_TYPE_INT, 1024, 102400, 65536,
+ OPTION_TYPE_INT, DCC_MIN_BLOCKSIZE, DCC_MAX_BLOCKSIZE, 65536,
NULL, NULL, &cfg_dcc_blocksize, NULL, &config_change_noop },
{ "dcc_port_range", N_("allowed ports for outgoing dcc"),
N_("restricts outgoing dcc to use only ports in the given range "
diff --git a/src/irc/irc-dcc.c b/src/irc/irc-dcc.c
index c51b6cb12..b35ecc459 100644
--- a/src/irc/irc-dcc.c
+++ b/src/irc/irc-dcc.c
@@ -1294,7 +1294,7 @@ dcc_handle ()
{
t_irc_dcc *ptr_dcc;
int num_read, num_sent;
- static char buffer[102400];
+ static char buffer[DCC_MAX_BLOCKSIZE];
uint32_t pos;
fd_set read_fd;
static struct timeval timeout;
@@ -1453,7 +1453,7 @@ dcc_handle ()
gui_printf (NULL, _("%s DCC failed because blocksize is too "
"big. Check value of \"dcc_blocksize\" option, "
"max is %d.\n"),
- sizeof (buffer));
+ WEECHAT_ERROR, DCC_MAX_BLOCKSIZE);
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (HOTLIST_MSG);
continue;
diff --git a/src/irc/irc.h b/src/irc/irc.h
index f1b9ee3f9..ede0d6668 100644
--- a/src/irc/irc.h
+++ b/src/irc/irc.h
@@ -248,6 +248,9 @@ struct t_irc_message
#define DCC_FAILED 4 /* DCC failed */
#define DCC_ABORTED 5 /* DCC aborted by user */
+#define DCC_MIN_BLOCKSIZE 1024 /* min DCC block size when sending file */
+#define DCC_MAX_BLOCKSIZE 102400 /* max DCC block size when sending file */
+
#define DCC_IS_CHAT(type) ((type == DCC_CHAT_RECV) || (type == DCC_CHAT_SEND))
#define DCC_IS_FILE(type) ((type == DCC_FILE_RECV) || (type == DCC_FILE_SEND))
#define DCC_IS_RECV(type) ((type == DCC_CHAT_RECV) || (type == DCC_FILE_RECV))