Ignore DCC ACCEPT if we didn't request a DCC RESUME
Mark DCC connections that we have requested RESUME on, so that we know whether or not to act on a DCC ACCEPT that is received. Also fixes up a slightly wrong message in /DCC RESUME.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
[Changes 1.2.2]
|
[Changes 1.2.2]
|
||||||
|
|
||||||
|
* Ignore DCC ACCEPT if RESUME wasn't requested. (caf)
|
||||||
|
|
||||||
* Fix /KB so that it kicks-then-bans as intended (reported by profiler). (caf)
|
* Fix /KB so that it kicks-then-bans as intended (reported by profiler). (caf)
|
||||||
|
|
||||||
* Fix $functioncall() scripting function (reported by |Rain|). (caf)
|
* Fix $functioncall() scripting function (reported by |Rain|). (caf)
|
||||||
|
|||||||
@@ -97,6 +97,7 @@
|
|||||||
#define DCC_OFFER 0x00040000
|
#define DCC_OFFER 0x00040000
|
||||||
#define DCC_DELETE 0x00080000
|
#define DCC_DELETE 0x00080000
|
||||||
#define DCC_TWOCLIENTS 0x00100000
|
#define DCC_TWOCLIENTS 0x00100000
|
||||||
|
#define DCC_RESUME_REQ 0x00200000
|
||||||
#define DCC_QUEUE 0x00400000
|
#define DCC_QUEUE 0x00400000
|
||||||
#define DCC_TDCC 0x00800000
|
#define DCC_TDCC 0x00800000
|
||||||
#define DCC_BOTCHAT 0x01000000
|
#define DCC_BOTCHAT 0x01000000
|
||||||
|
|||||||
24
source/dcc.c
24
source/dcc.c
@@ -1415,6 +1415,7 @@ UserList *ul = NULL;
|
|||||||
if (autoresume && stat(fullname, &sb) != -1) {
|
if (autoresume && stat(fullname, &sb) != -1) {
|
||||||
n->transfer_orders.byteoffset = sb.st_size;
|
n->transfer_orders.byteoffset = sb.st_size;
|
||||||
n->bytes_read = 0L;
|
n->bytes_read = 0L;
|
||||||
|
new_d->sock.flags |= DCC_RESUME_REQ;
|
||||||
send_ctcp(CTCP_PRIVMSG, nick, CTCP_DCC, "RESUME %s %d %ld", n->filename, ntohs(n->remport), sb.st_size);
|
send_ctcp(CTCP_PRIVMSG, nick, CTCP_DCC, "RESUME %s %d %ld", n->filename, ntohs(n->remport), sb.st_size);
|
||||||
} else {
|
} else {
|
||||||
DCC_int *new = NULL;
|
DCC_int *new = NULL;
|
||||||
@@ -3430,6 +3431,7 @@ void dcc_getfile_resume_start (char *nick, char *description, char *address, cha
|
|||||||
{
|
{
|
||||||
SocketList *s;
|
SocketList *s;
|
||||||
DCC_int *n;
|
DCC_int *n;
|
||||||
|
const DCC_List *pending;
|
||||||
char *tmp = NULL;
|
char *tmp = NULL;
|
||||||
char *fullname = NULL;
|
char *fullname = NULL;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
@@ -3442,6 +3444,14 @@ struct stat sb;
|
|||||||
put_it("%s", convert_output_format("$G %RDCC%n warning in dcc_getfile_resume_start", NULL));
|
put_it("%s", convert_output_format("$G %RDCC%n warning in dcc_getfile_resume_start", NULL));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pending = find_dcc_pending(nick, description, NULL, DCC_FILEREAD, 0, -1);
|
||||||
|
if (!pending || !(pending->sock.flags & DCC_RESUME_REQ))
|
||||||
|
{
|
||||||
|
put_it("%s", convert_output_format("$G %RDCC%n Ignoring unsolicited ACCEPT from $0", "%s", nick));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(n = dcc_create(nick, description, NULL, 0, port?atol(port):0, DCC_FILEREAD, DCC_TWOCLIENTS|DCC_OFFER, start_dcc_get)))
|
if (!(n = dcc_create(nick, description, NULL, 0, port?atol(port):0, DCC_FILEREAD, DCC_TWOCLIENTS|DCC_OFFER, start_dcc_get)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -3486,19 +3496,15 @@ int old_dp, old_dn, old_dc;
|
|||||||
int blocksize = 0;
|
int blocksize = 0;
|
||||||
|
|
||||||
user = get_dcc_args(&args, &passwd, &port, &blocksize);
|
user = get_dcc_args(&args, &passwd, &port, &blocksize);
|
||||||
if (!user)
|
|
||||||
{
|
|
||||||
put_it("%s", convert_output_format("$G %RDCC%n You must supply a nickname for DCC get", NULL, NULL));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!blocksize || blocksize > MAX_DCC_BLOCK_SIZE)
|
|
||||||
blocksize = get_int_var(DCC_BLOCK_SIZE_VAR);
|
|
||||||
|
|
||||||
if (!user)
|
if (!user)
|
||||||
{
|
{
|
||||||
put_it("%s", convert_output_format("$G %RDCC%n You must supply a nickname for DCC RESUME", NULL));
|
put_it("%s", convert_output_format("$G %RDCC%n You must supply a nickname for DCC RESUME", NULL));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!blocksize || blocksize > MAX_DCC_BLOCK_SIZE)
|
||||||
|
blocksize = get_int_var(DCC_BLOCK_SIZE_VAR);
|
||||||
|
|
||||||
if (args && *args)
|
if (args && *args)
|
||||||
filename = args;
|
filename = args;
|
||||||
|
|
||||||
@@ -3557,6 +3563,8 @@ int blocksize = 0;
|
|||||||
n->blocksize = blocksize;
|
n->blocksize = blocksize;
|
||||||
n->transfer_orders.byteoffset = sb.st_size;
|
n->transfer_orders.byteoffset = sb.st_size;
|
||||||
|
|
||||||
|
s->flags |= DCC_RESUME_REQ;
|
||||||
|
|
||||||
old_dp = doing_privmsg; old_dn = doing_notice; old_dc = in_ctcp_flag;
|
old_dp = doing_privmsg; old_dn = doing_notice; old_dc = in_ctcp_flag;
|
||||||
/* Just in case we have to fool the protocol enforcement. */
|
/* Just in case we have to fool the protocol enforcement. */
|
||||||
doing_privmsg = doing_notice = in_ctcp_flag = 0;
|
doing_privmsg = doing_notice = in_ctcp_flag = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user