; allows to set mIRC's 'local info' to your "true" external IP regardless of network setup
; by Horstl with help from deegee :)
on *:connect: { getip }
alias -l getip {
if ($sock(getip)) { sockclose getip }
sockopen getip www.whatismyip.com 80
sockmark getip $1
}
on *:sockopen:getip:{
if ($sockerr) { echo -s * Cannot resolve your ip: $sock(getip).wsmsg | return }
sockwrite getip GET $+(/automation/n09230945.asp HTTP/1.0,$lf,HOST: whatismyip.com,$str($lf,2))
}
on *:sockread:getip:{
sockread -f &a
set -e %external.ip $gettok($bvar(&a,1-).text,-1,10)
if (($group(#set.ip.auto) == on) || ($sock($sockname).mark)) {
echo -snc info * Resolved external IP: %external.ip (set at 'local info')
localinfo $host %external.ip
}
}
#set.ip.auto off
#set.ip.auto end
menu status {
Set 'local info' to external IP $+([,auto,$chr(58) $replace($group(#set.ip.auto).status,on,enabled,off,disabled),])
.$iif(($group(#set.ip.auto) == on),$style(1)) Auto on connect
..$iif(($group(#set.ip.auto) == on),disable,enable) automation : $iif(($group(#set.ip.auto) == on),.disable,.enable) #set.ip.auto
.&Set 'local info' to ext. IP now : { getip verbose }
.-
.&Reset 'local info'
..&normal (winsock) lookup : localinfo -h
..$iif(($status != connected),$style(2)) &userhost (server) lookup: localinfo -u
.-
.Current ext. IP $+ $chr(58) $iif((%external.ip),$v1,not resolved yet) : noop
}