Skip to content

Commit 11309f0

Browse files
committed
Improve DCC SEND messages.
1 parent eb03191 commit 11309f0

File tree

1 file changed

+29
-18
lines changed

1 file changed

+29
-18
lines changed

dlFilter.mrc

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ dlFilter uses the following code from other people:
109109
Options dialog is now associated with active window's connection so show of Filter / Ads makes correct window active.
110110
On start / load warn user if "Options/Sounds/Requests/Send '!nick file' as Private Message" is checked (since it misdirects triggers).
111111
Fix interception of DCC ACCEPT CTCP messages preventing DCC SEND resumes.
112+
Alert user if requested file already exists and mIRC is set to Cancel DCCs.
113+
Improve DCC SEND start / resume / finished / interrupted messages.
112114
113115
*/
114116

@@ -1279,7 +1281,7 @@ alias -l DLF.Chan.ctcpBlock {
12791281
alias -l DLF.Chan.SpamFilter {
12801282
if ($DLF.Options.IsOp && (%DLF.opwarning.spamchan == 1) && ($me isop $chan)) {
12811283
var %msg $c(4,15,Channel spam from $nick $br($address($nick,5)) $+ : $q($1-))
1282-
.notice @ $+ $chan $logo %msg
1284+
.notice @ $+ $chan $DLF.logo %msg
12831285
DLF.Win.Echo Filter Blocked $chan $nick %msg
12841286
}
12851287
DLF.Win.Filter $1-
@@ -1482,7 +1484,7 @@ alias -l DLF.Priv.SpamFilter {
14821484
var %i $comchan($nick,0).op
14831485
while (%i) {
14841486
var %chan $comchan($nick,%i).op
1485-
.DLF.notice @ $+ %chan $logo %msg
1487+
.DLF.notice @ $+ %chan $DLF.logo %msg
14861488
dec %i
14871489
}
14881490
DLF.Win.Echo Blocked Private $nick %msg
@@ -1855,6 +1857,12 @@ alias -l DLF.DccSend.Request {
18551857
if (@* iswm %trig) %fn = $DLF.DccSend.FixString($2-)
18561858
elseif (XDCC-* iswm %trig) %fn = $2-
18571859
else %fn = $DLF.GetFileName($2-)
1860+
var %ifFileExists $dccIfFileExists, %pathfile $+($getdir(%fn),%fn)
1861+
if (($isfile(%pathfile)) && (%ifFileExists == Cancel)) {
1862+
DLF.Win.Log Server Warning $target $nick $qt(%fn) exists but "mIRC Options / DCC / If file exists" is set to "Cancel" so mIRC will cancel this download.
1863+
DLF.Win.Log Server Warning $target $nick Before your download starts either change this option to something else or delete the file.
1864+
}
1865+
18581866
hadd -mz DLF.dccsend.requests $+($network,|,$chan,|,%trig,|,$replace(%fn,$space,_),|,$encode(%fn)) 86400
18591867
DLF.Watch.Log DccSend request recorded: %trig %fn
18601868
}
@@ -1995,20 +2003,21 @@ alias -l DLF.DccSend.Block {
19952003

19962004
alias -l DLF.DccSend.Receiving {
19972005
var %fn $noqt($gettok($3-,-4-1,$asc($space)))
1998-
DLF.DccSend.AddAccepted %fn
19992006
var %req $DLF.DccSend.GetRequest(%fn)
20002007
if (%req == $null) return
20012008
var %chan $gettok(%req,2,$asc(|))
20022009
var %origfn $decode($gettok(%req,5,$asc(|)))
20032010
if (%origfn == $null) %origfn = %fn
2004-
var %secs 86400 - $hget(DLF.dccsend.requests,%req)
2005-
var %starting starting
2006-
if ($dccIfFileExists == Resume) {
2007-
var %pathfile $+($getdir(%fn),%fn)
2008-
if ($isfile(%pathfile)) {
2009-
if ($file(%pathfile).size > 0) %starting = resuming
2011+
var %starting starting, %ifFileExists $dccIfFileExists, %pathfile $+($getdir(%fn),%fn)
2012+
if ($isfile(%pathfile)) {
2013+
if (%ifFileExists == Cancel) {
2014+
DLF.Win.Log Server ctcp %chan $nick DCC Send from $nick rejected (invalid parameters) - $qt(%origfn) exists but "mIRC Options / DCC / If file exists" is set to "Cancel".
2015+
return
20102016
}
2017+
if ((%ifFileExists == Resume) && ($file(%pathfile).size > 0)) %starting = resuming
20112018
}
2019+
DLF.DccSend.AddAccepted %fn
2020+
var %secs 86400 - $hget(DLF.dccsend.requests,%req)
20122021
DLF.Win.Log Server ctcp %chan $nick DCC Get of $qt(%origfn) from $nick %starting $br(waited $duration(%secs,3))
20132022
}
20142023

@@ -2067,13 +2076,12 @@ alias -l DLF.DccSend.FileRcvd {
20672076
if (%req == $null) return
20682077
.hdel DLF.dccsend.requests %req
20692078
var %chan $gettok(%req,2,$asc(|))
2070-
var %dur $get(-1).secs
20712079
var %trig $gettok(%req,3,$asc(|))
20722080
var %origfn $decode($gettok(%req,5,$asc(|)))
20732081
if (%origfn == $null) %origfn = %fn
20742082
DLF.DccSend.RetryDelete %trig %origfn
2075-
var %bytes $get(-1).rcvd / %dur
2076-
DLF.Win.Log Server ctcp %chan $nick DCC Get of $qt(%origfn) from $nick complete $br($duration(%dur,3) $bytes(%bytes,3).suf $+ /Sec)
2083+
var %bytes $get(-1).rcvd - $get(-1).resume
2084+
DLF.Win.Log Server ctcp %chan $nick DCC Get of $qt(%origfn) from $nick complete $br(100% done - $bytes(%bytes,3).suf in $duration($get(-1).secs,3) = $bytes($get(-1).cps,3).suf $+ /Sec)
20772085
; Some servers change spaces to underscores
20782086
; But we cannot rename if Options / DCC / Folders / Command is set
20792087
; because it would run after this using the wrong filename
@@ -2129,10 +2137,13 @@ alias -l DLF.DccSend.GetFailed {
21292137
var %trig $gettok(%req,3,$asc(|))
21302138
var %origfn $decode($gettok(%req,5,$asc(|)))
21312139
if (%origfn == $null) %origfn = %fn
2132-
var %bytes $get(-1).rcvd / $get(-1).secs
2133-
var %retry $DLF.DccSend.Retry(%trig %origfn), %retrying
2140+
var %retry $DLF.DccSend.Retry(%trig %origfn), %resume $dccIfFileExists, %retrying
2141+
if (%resume !isin Resume Overwrite) %retry = $false
21342142
if (%retry) %retrying = - $c(3,retrying)
2135-
DLF.Win.Log Server ctcp %chan $nick DCC Get of %origfn from $nick incomplete $br($duration(%dur,3) $bytes(%bytes).suf $+ /Sec) %retrying
2143+
var %percent $floor($calc($get(-1).rcvd * 100 / $get(-1).size))
2144+
var %bytes $get(-1).rcvd - $get(-1).resume
2145+
DLF.Win.Log Server ctcp %chan $nick DCC Get of $qt(%origfn) from $nick incomplete $br(%percent $+ % done - $bytes(%bytes).suf received in $duration($get(-1).secs,3) = $bytes($get(-1).cps).suf $+ /Sec) %retrying
2146+
if (%resume !isin Resume Ask) DLF.Win.Log Server Warning %chan $nick To improve your chances of downloading the whole file, set "mIRC Options / DCC / If file exists" to allow mIRC to resume receiving the file from the point it just failed rather than starting again.
21362147
if (xdcc-* iswm %trig) %trig = $null
21372148
if (%retry) DLF.Chan.EditSend %chan %trig $decode($gettok(%req,5,$asc(|)))
21382149
}
@@ -5957,16 +5968,16 @@ alias -l shortjoinsparts return $DLF.mIRCini(options,2,19)
59575968
alias -l windowbuffer return $DLF.mIRCini(options,3,1)
59585969
alias -l usesinglemsg return $DLF.mIRCini(options,0,22)
59595970
alias -l sendPlingNickAsPrivate return $DLF.mIRCini(options,1,23)
5960-
alias -l dccIfFileExists {
5961-
var %value = $DLF.mIRCini(options,1,27)
5971+
alias dccIfFileExists {
5972+
var %value = $DLF.mIRCini(options,3,27)
59625973
if (%value == 0) return Ask
59635974
if (%value == 1) return Resume
59645975
if (%value == 2) return Overwrite
59655976
if (%value == 3) return Cancel
59665977
return Unknown
59675978
}
59685979

5969-
alias -l DLF.mIRCini {
5980+
alias DLF.mIRCini {
59705981
var %item $2
59715982
if ($2 isnum) %item = n $+ $2
59725983
var %ini $readini($mircini,n,$1,%item)

0 commit comments

Comments
 (0)