/*_____________________________________________________________________________ |/ / Local Info add-on by David "Saturn" van Moolenbroek | Version 0.1, released 02-10-2003 -- support on #help.script/Quakenet | Use/modify however you want, but please keep my name in it. Thank you! | | Keywords: local info, http, sockets, regex | | This script allows anyone behind both a NAT router and a bouncer, and with | a dynamic IP address, to set their external IP address correctly, so that | they can still use DCC. The script uses a webpage to obtain the external | IP-address. In order to use this script, you'll have to TURN OFF the two | checkboxes under "On connect, always get:" in the mIRC Options (alt+o), at | Connect -> Local Info. See below to find out how to tweak the script to | fit your needs. | | The script defines the following commands/identifiers: | | /updateli | | Starts the update process of connecting to a webpage, fetching the first | IP-address it can find, and using that IP-address to set the local info | in mIRC using /localinfo. Note that the output of this command can be | silenced by preceding the command with a dot (/.updateli). | | If the default update-URL somehow doesn't work anymore, you can change the | "info-url" alias to return another URL. At least the following URLs have | been tested and found working: | | http://www.showmyip.com/ | http://www.whatismyip.com/ | http://www.whatismyipaddress.com/ | http://whatismyipaddress.net/ | http://checkip.dyndns.org/ | http://www2.simflex.com/ip.shtml | | Simple examples | | ; this trigger is included by default, and activates when mIRC starts | on *:START:updateli | | ; replace it with this one if you're on dial-up or ISDN | on *:CONNECT:updateli \ _\_____________________________________________________________________________ */ alias -l info-url return http://www.showmyip.com on *:START:updateli alias -l urlparse { ; Copyright (c) Saturn - if you copy this, please give credit where credit is due - thanks ;) if ($regex($1-,^http://(?:([^@:]+)(?::(.*?)|())@|()())([A-Za-z0-9_.-]+)(?::(\d+)|())(/.*)?$)) { if ($prop == proto) return http elseif ($prop == user) return $regml(1) elseif ($prop == pass) return $regml(2) elseif ($prop == host) return $regml(3) elseif ($prop == port) return $iif($regml(4),$ifmatch,80) elseif ($prop == path) return $iif($regml(5),$ifmatch,/) else return $true } else return $iif(!$prop,$false) } alias updateli { if ($sock(localinfo)) return sockopen localinfo $urlparse($info-url).host $urlparse($info-url).port sockmark localinfo $show $false } on *:SOCKOPEN:localinfo:{ if ($sockerr > 0) return sockwrite -n $sockname GET $urlparse($info-url).path HTTP/1.0 sockwrite -n $sockname Host: $urlparse($info-url).host sockwrite -n $sockname User-Agent: Mozilla/4.0 sockwrite -n $sockname } on *:SOCKREAD:localinfo:{ if ($sockerr > 0) return while ($true) { sockread -n &line if (!$sockbr) return tokenize 32 $sock($sockname).mark $bvar(&line,1,800).text if (($2) && ($regex($3-,((\d{1,3}\.){3}\d{1,3}))) && ($longip($regml(1)))) break elseif ((!$2) && ($0 < 3)) sockmark $sockname $1 $true } scon -a localinfo $regml(1) $regml(1) if ($1) scon -a echo $color(info2) -est External IP: $regml(1) sockclose $sockname }