mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
I can only imagine this bug is not limited to socket events nor $sockname, but using /url within at least sockread and sockclose causes $sockname to be unset. I have not tested beyond these cases. I've also noted that context is switched after the /url call. The sockclose event runs before the next line in sockread after /url. I can somewhat understand how identifiers would be lost with this context switch, but not why the switch happens in the first place.

Workaround for possible side effects due to context swtich - always call /url from a timer?

Code
alias test {
  sockopen -e url_sock www.google.com 443
}

on *:sockopen:url_sock:{
  sockwrite -n $sockname GET / HTTP/1.0
  sockwrite -n $sockname Host: google.com
  sockwrite -n $sockname User-Agent: mIRC
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname $crlf
}

on *:sockread:url_sock:{
  sockread -f %read
  if (%read == The document has moved) {
    echo 4 -ag sockread: $!sockname = $sockname
    url www.yahoo.com
    echo 4 -ag sockread: $!sockname = $sockname
  }
}

on *:sockclose:url_sock:{
  echo 3 -ag sockclose: $!sockname = $sockname
  url www.yahoo.com
  echo 3 -ag sockclose: $!sockname = $sockname
}


Quote
sockread:  $sockname = url_sock
sockclose: $sockname = url_sock
sockclose: $sockname =

sockread:  $sockname =

Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
Thanks for your bug report. The /url command calls ShellExecute() which seems to trigger a sequence of windows events outside of the current event, probably related to DDE. I will look into this in a future version. In the meantime, you will need to use /timer.

Update: It looks like Firefox had a similar issue a few years ago with ShellExecute(). The same solution might apply in this case.

Last edited by Khaled; 11/07/19 10:24 AM.
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
I have made a change in the latest beta that affects a number of features that use ShellExecute(), such as /run, /url, opening the Received Files folder, and so on. This appears to resolve this issue.


Link Copied to Clipboard