File tree 4 files changed +12
-4
lines changed
4 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
+ ## [ v4.4.21] ( https://github.com/jipaix/xdccjs/tree/v4.4.21 )
3
+ ### Feat(lib)
4
+ * Job.cancel() is now always defined
5
+ ### Fix(lib)
6
+ * Job.cancel() wasn't sending "XDCC CANCEL" message
7
+ ---
2
8
## [ v4.4.20] ( https://github.com/jipaix/xdccjs/tree/v4.4.20 )
3
9
### Fix(lib)
4
10
* expose xdccJS events
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " xdccjs" ,
3
- "version" : " 4.4.20 " ,
3
+ "version" : " 4.4.21 " ,
4
4
"description" : " download files from XDCC bots on IRC, complete implementation of the XDCC protocol" ,
5
5
"engines" : {
6
6
"node" : " >=14.0.0"
Original file line number Diff line number Diff line change @@ -40,9 +40,10 @@ export default class AddJob extends TimeOut {
40
40
} ;
41
41
}
42
42
43
- protected makeCancelable ( candidate : Job , client ?: net . Socket ) : ( ) => void {
43
+ protected makeCancelable ( candidate : Candidate , client ?: net . Socket ) : ( ) => void {
44
44
const fn = ( ) : void => {
45
45
candidate . timeout . clear ( ) ;
46
+ this . say ( candidate . cancelNick , 'XDCC CANCEL' ) ;
46
47
if ( client ) {
47
48
const cancel = new Error ( 'cancel' ) ;
48
49
client . destroy ( cancel ) ;
@@ -59,9 +60,9 @@ export default class AddJob extends TimeOut {
59
60
let candidate = this . getCandidate ( target ) ;
60
61
if ( ! candidate ) {
61
62
const base = AddJob . constructCandidate ( target , range ) ;
63
+ base . cancel = this . makeCancelable ( base ) ;
62
64
const newCand = new Job ( base ) ;
63
65
AddJob . makeClearable ( newCand ) ;
64
- newCand . cancel = this . makeCancelable ( newCand ) ;
65
66
this . candidates . push ( newCand ) ;
66
67
candidate = this . getCandidate ( target ) ;
67
68
} else {
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ export class Job extends (EventEmitter as new () => TypedEmitter<JobMessageEvent
87
87
* })
88
88
* ```
89
89
*/
90
- cancel ? : ( ) => void ;
90
+ cancel : ( ) => void ;
91
91
92
92
/** @ignore */
93
93
failures : number [ ] ;
@@ -130,6 +130,7 @@ export class Job extends (EventEmitter as new () => TypedEmitter<JobMessageEvent
130
130
constructor ( candidate : Candidate ) {
131
131
// eslint-disable-next-line constructor-super
132
132
super ( ) ;
133
+ if ( ! candidate . cancel ) throw new Error ( 'candidate must be passed to makeCancelable first' ) ;
133
134
this . cancel = candidate . cancel ;
134
135
this . failures = candidate . failures ;
135
136
this . nick = candidate . nick ;
You can’t perform that action at this time.
0 commit comments