mirror of
https://github.com/weechat/weechat.git
synced 2026-06-28 22:06:38 +02:00
Use of constants for min/max DCC blocksize
This commit is contained in:
@@ -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 "
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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 "
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user