mIRC Home    About    Download    Register    News    Help

Print Thread
#143145 21/02/06 07:38 PM
Joined: Apr 2004
Posts: 759
M
Hoopy frood
OP Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
i would LOVE the on OPEN and on CLOSE for DCC chats and fserves to react to actually opening/closing the window, as suppose to wheter the connection was made succesfully.
In its current state using on OPEN to check wheter or not a DCC CHAT or FSERV was initiated is useless since it wont trigger if they fail The only other 2 ways i can think of are:
[*] Listening to ctcp's is a mess to because there is no way of knowing if the user has the Accept dialog and cancels.
[*] On ACTIVE is another way but if the user uses minimize on CHAT/GET these wont trigger.
[*] ON DCCSERVER only triggers only on succesful connections as well.

Seperating the on OPEN and checking for succesful connections would be way better imo.
i.e on OPEN CLOSE trigger on creation/destroy of the window no matter the successrate of the DCC.
and an ON DCC with the following identifiers
$dcc(Name/N)
properties: type,status


$maybe
#143146 22/02/06 07:29 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Dont know if u wanted a work around, but i wrote this a while back, so i added dcc chat windows to it as well (used to do just dcc sends and gets)
Code:
;Event Trapping DCC GET/SEND/CHAT 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.chat | check.and.reset }
;
;
;*** EVENTS ***
;
on *:LOAD:       { record.dcc.get.send.chat | check.and.reset }
on *:START:      { record.dcc.get.send.chat | check.and.reset }
on *:FILERCVD:*: { check.and.reset }
on *:GETFAIL:*:  { check.and.reset }
on *:FILESENT:*: { check.and.reset }
on *:SENDFAIL:*: { check.and.reset }
on *:OPEN:=:     { check.and.reset }
on *:CLOSE:=:    { check.and.reset }
on *:ACTIVE:*:   { if (!$lactive) { check.and.reset } }
on *:UNLOAD:     { .timer.check.dcc.get.send.chat off | hfree -w record.dcc.get | hfree -w record.dcc.send | hfree -w record.dcc.chat }
;
;
;*** ROUTINES ***
;
alias -l check.and.reset { check.dcc.get.send.chat | .timer.check.dcc.get.send.chat -o 0 1 check.dcc.get.send.chat }
;
alias -l record.dcc.get.send.chat {
  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
  }
  ;
  hadd -m record.dcc.chat * | hdel -w record.dcc.chat *
  var %i = $chat(0)
  hadd record.dcc.chat 0 %i
  while (%i) {
    hadd record.dcc.chat %i              $chat(%i)
    hadd record.dcc.chat $+(%i,.ip)      $chat(%i).ip
    hadd record.dcc.chat $+(%i,.status)  $chat(%i).status
    hadd record.dcc.chat $+(%i,.logfile) $chat(%i).logfile
    hadd record.dcc.chat $+(%i,.stamp)   $chat(%i).stamp
    hadd record.dcc.chat $+(%i,.wid)     $chat(%i).wid
    hadd record.dcc.chat $+(%i,.cid)     $chat(%i).cid
    hadd record.dcc.chat $+(%i,.hwnd)    $chat(%i).hwnd
    dec %i
  }
}
;
alias -l check.dcc.get.send.chat {
  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
        break
      }
      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
        break
      }
      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
  }
  ;
  hadd -m record.dcc.chat *.present | hdel -w record.dcc.send *.present
  var %i = $chat(0)
  while (%i) {
    var %hwnd = $chat(%i).hwnd
    var %c = $hfind(record.dcc.chat,%hwnd,0).data
    var %found = $false
    while (%c) {
      if (*.hwnd iswm $hfind(record.dcc.chat,%hwnd,%c).data) {
        hadd record.dcc.chat $+($gettok($v2,1,46),.present) $true
        var %found = $true
        break
      }
      dec %c
    }
    if (!%found) { .signal dcc.chat.opened $+($chat(%i),>,$chat(%i).ip,>,$chat(%i).status,>,$chat(%i).logfile,>,$chat(%i).stamp,>,$chat(%i).wid,>,$chat(%i).cid,>,$chat(%i).hwnd) }
    dec %i
  }
  var %i = $rd.chat(0)
  while (%i) {
    if (!$rd.chat(%i).present) { .signal dcc.chat.closed $+($rd.chat(%i),>,$rd.chat(%i).ip,>,$rd.chat(%i).status,>,$rd.chat(%i).logfile,>,$rd.chat(%i).stamp,>,$rd.chat(%i).wid,>,$rd.chat(%i).cid,>,$rd.chat(%i).hwnd) }
    dec %i
  }
  ;
  record.dcc.get.send.chat 
}
;
;
;*** 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)) }
alias -l rd.chat { return $hget(record.dcc.chat,$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
;& dcc.chat.opened $1 to $16 = nick ip status logfile stamp wid cid hwnd
;& dcc.chat.closed $1 to $16 = nick ip status logfile stamp 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- }
on *:SIGNAL:dcc.chat.opened:{ tokenize 62 $1- | echo -st EVENT SIGNAL:dcc.chat.opened: $1- }
on *:SIGNAL:dcc.chat.closed:{ tokenize 62 $1- | echo -st EVENT SIGNAL:dcc.chat.closed: $1- }


Since theres nothing to match the events exactly (if there were why would we need this!), I had to do it to a timer, so the even might go off up to a second after the window opens, but its still quite usefull if u needed to do something here.

#143147 24/02/06 07:04 AM
Joined: Apr 2004
Posts: 759
M
Hoopy frood
OP Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
Nice DaveC, i couldnt be assed to write the timerchecks because i knew by forehand they couldnt be 100% accurate. Even a 1 second lag between opening a window and the signal would be bad in a custum switchbar in my opinion. Though in many other situations this is a very reasonable time. After speaking with hixxy about this he created this http://www.mirc.net/projects.php?go=1140623662 dll to check for hwnds being created in mIRC.

So there we have it 2 alternatives, however it would still be nice if mIRC made the distinction by itself.


$maybe
#143148 24/02/06 06:57 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
to right, untell you mentioned it, i had not even relaises the on open didnt trigger when the dcc window was created, (some code i had in a ON OPEN = was even checking its connected state, how pointless was that!)


Link Copied to Clipboard