;Event Trapping DCC GET/SEND windows opening & closing, See SIGNALS at bottom for code to cut and paste into your code.
;
;
;*** MISC *** (not used)
;
alias rd.ms { record.dcc.get.send | check.and.reset }
;
;
;*** EVENTS ***
;
on *:LOAD: { record.dcc.get.send | check.and.reset }
on *:START: { record.dcc.get.send | check.and.reset }
on *:FILERCVD:*: { check.and.reset }
on *:FILESENT:*: { check.and.reset }
on *:SENDFAIL:*: { check.and.reset }
on *:GETFAIL:*: { check.and.reset }
on *:ACTIVE:*: { if (!$lactive) { check.and.reset } }
on *:UNLOAD: { .timer.check.dcc.get.send off | hfree -w record.dcc.get | hfree -w record.dcc.send }
;
;
;*** ROUTINES ***
;
alias -l check.and.reset { check.dcc.get.send | .timer.check.dcc.get.send -o 0 1 check.dcc.get.send }
;
alias -l record.dcc.get.send {
hadd -m record.dcc.get * | hdel -w record.dcc.get *
var %i = $get(0)
hadd record.dcc.get 0 %i
while (%i) {
hadd record.dcc.get %i $get(%i)
hadd record.dcc.get $+(%i,.ip) $get(%i).ip
hadd record.dcc.get $+(%i,.status) $get(%i).status
hadd record.dcc.get $+(%i,.file) $get(%i).file
hadd record.dcc.get $+(%i,.path) $get(%i).path
hadd record.dcc.get $+(%i,.size) $get(%i).size
hadd record.dcc.get $+(%i,.rcvd) $get(%i).rcvd
hadd record.dcc.get $+(%i,.cps) $get(%i).cps
hadd record.dcc.get $+(%i,.pc) $get(%i).pc
hadd record.dcc.get $+(%i,.secs) $get(%i).secs
hadd record.dcc.get $+(%i,.done) $get(%i).done
hadd record.dcc.get $+(%i,.resume) $get(%i).resume
hadd record.dcc.get $+(%i,.wid) $get(%i).wid
hadd record.dcc.get $+(%i,.cid) $get(%i).cid
hadd record.dcc.get $+(%i,.hwnd) $get(%i).hwnd
dec %i
}
;
hadd -m record.dcc.send * | hdel -w record.dcc.send *
var %i = $send(0)
hadd record.dcc.send 0 %i
while (%i) {
hadd record.dcc.send %i $send(%i)
hadd record.dcc.send $+(%i,.ip) $send(%i).ip
hadd record.dcc.send $+(%i,.status) $send(%i).status
hadd record.dcc.send $+(%i,.file) $send(%i).file
hadd record.dcc.send $+(%i,.path) $send(%i).path
hadd record.dcc.send $+(%i,.size) $send(%i).size
hadd record.dcc.send $+(%i,.sent) $send(%i).sent
hadd record.dcc.send $+(%i,.lra) $send(%i).lra
hadd record.dcc.send $+(%i,.cps) $send(%i).cps
hadd record.dcc.send $+(%i,.pc) $send(%i).pc
hadd record.dcc.send $+(%i,.secs) $send(%i).secs
hadd record.dcc.send $+(%i,.done) $send(%i).done
hadd record.dcc.send $+(%i,.resume) $send(%i).resume
hadd record.dcc.send $+(%i,.wid) $send(%i).wid
hadd record.dcc.send $+(%i,.cid) $send(%i).cid
hadd record.dcc.send $+(%i,.hwnd) $send(%i).hwnd
dec %i
}
}
;
alias -l check.dcc.get.send {
hadd -m record.dcc.get *.present | hdel -w record.dcc.get *.present
var %i = $get(0)
while (%i) {
var %hwnd = $get(%i).hwnd
var %c = $hfind(record.dcc.get,%hwnd,0).data
var %found = $false
while (%c) {
if (*.hwnd iswm $hfind(record.dcc.get,%hwnd,%c).data) {
hadd record.dcc.get $+($gettok($v2,1,46),.present) $true
var %found = $true
}
dec %c
}
if (!%found) { .signal dcc.get.opened $+($get(%i),>,$get(%i).ip,>,$get(%i).status,>,$get(%i).file,>,$get(%i).path,>,$get(%i).size,>,$get(%i).rcvd,>,$get(%i).cps,>,$get(%i).pc,>,$get(%i).secs,>,$get(%i).done,>,$get(%i).resume,>,$get(%i).wid,>,$get(%i).cid,>,$get(%i).hwnd) }
dec %i
}
var %i = $rd.get(0)
while (%i) {
if (!$rd.get(%i).present) { .signal dcc.get.closed $+($rd.get(%i),>,$rd.get(%i).ip,>,$rd.get(%i).status,>,$rd.get(%i).file,>,$rd.get(%i).path,>,$rd.get(%i).size,>,$rd.get(%i).rcvd,>,$rd.get(%i).cps,>,$rd.get(%i).pc,>,$rd.get(%i).secs,>,$rd.get(%i).done,>,$rd.get(%i).resume,>,$rd.get(%i).wid,>,$rd.get(%i).cid,>,$rd.get(%i).hwnd) }
dec %i
}
;
hadd -m record.dcc.send *.present | hdel -w record.dcc.send *.present
var %i = $send(0)
while (%i) {
var %hwnd = $send(%i).hwnd
var %c = $hfind(record.dcc.send,%hwnd,0).data
var %found = $false
while (%c) {
if (*.hwnd iswm $hfind(record.dcc.send,%hwnd,%c).data) {
hadd record.dcc.send $+($gettok($v2,1,46),.present) $true
var %found = $true
}
dec %c
}
if (!%found) { .signal dcc.send.opened $+($send(%i),>,$send(%i).ip,>,$send(%i).status,>,$send(%i).file,>,$send(%i).path,>,$send(%i).size,>,$send(%i).sent,>,$send(%i).lra,>,$send(%i).cps,>,$send(%i).pc,>,$send(%i).secs,>,$send(%i).done,>,$send(%i).resume,>,$send(%i).wid,>,$send(%i).cid,>,$send(%i).hwnd) }
dec %i
}
var %i = $rd.send(0)
while (%i) {
if (!$rd.send(%i).present) { .signal dcc.send.closed $+($rd.send(%i),>,$rd.send(%i).ip,>,$rd.send(%i).status,>,$rd.send(%i).file,>,$rd.send(%i).path,>,$rd.send(%i).size,>,$rd.send(%i).sent,>,$rd.send(%i).lra,>,$rd.send(%i).cps,>,$rd.send(%i).pc,>,$rd.send(%i).secs,>,$rd.send(%i).done,>,$rd.send(%i).resume,>,$rd.send(%i).wid,>,$rd.send(%i).cid,>,$rd.send(%i).hwnd) }
dec %i
}
;
record.dcc.get.send
}
;
;
;*** CUSTOM $IDENTIFIERS ***
;
alias -l rd.get { return $hget(record.dcc.get ,$iif($len($prop),$+($1,.,$prop),$1)) }
alias -l rd.send { return $hget(record.dcc.send,$iif($len($prop),$+($1,.,$prop),$1)) }
;
;
;------------------------------[Copy code below here and use within your scripts]------------------------------
;
;*** SIGNALS ***
;
;In dcc.get.opened $1 to $15 = nick ip status file path size rcvd cps pc secs done resume wid cid hwnd
;& dcc.get.closed $1 to $15 = nick ip status file path size rcvd cps pc secs done resume wid cid hwnd
;& dcc.send.opened $1 to $16 = nick ip status file path size sent lra cps pc secs done resume wid cid hwnd
;& dcc.send.closed $1 to $16 = nick ip status file path size sent lra cps pc secs done resume wid cid hwnd
;^ the above assumes you have used TOKENIZE 62 $1- as each value is seperated by a > $chr(62)
;
;NB:file & path may contain spaces these values are still held in $4 & $5 respectively
;
on *:SIGNAL:dcc.get.opened: { tokenize 62 $1- | echo -st EVENT SIGNAL:dcc.get.opened: $1- }
on *:SIGNAL:dcc.get.closed: { tokenize 62 $1- | echo -st EVENT SIGNAL:dcc.get.closed: $1- }
on *:SIGNAL:dcc.send.opened:{ tokenize 62 $1- | echo -st EVENT SIGNAL:dcc.send.opened: $1- }
on *:SIGNAL:dcc.send.closed:{ tokenize 62 $1- | echo -st EVENT SIGNAL:dcc.send.closed: $1- }