mIRC Homepage

/url in socket event clears $sockname (context)

Posted By: Loki12583

/url in socket event clears $sockname (context) - 10/07/19 08:31 PM

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 =
Posted By: Khaled

Re: /url in socket event clears $sockname (context) - 11/07/19 08:54 AM

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.
Posted By: Khaled

Re: /url in socket event clears $sockname (context) - 12/07/19 12:18 PM

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.
© 2019 mIRC Discussion Forums