aIRC — File Browser

aIRCv0.8.69 / aIRCv0.8.69 / addons / whois.mrc

whois.mrc — 2.93 KB — Download this file

;/**********************************************************************
; *
; * aIRC
; * WHOIS (Internic) Client
; *
; **********************************************************************/
;
;
alias _whois.addonver { return 1.0 }
alias internic {
  _dialog -md _internic _simplesockd
  did -o _internic 250 1 $did(_internic,50,$did(_internic,50,1).sel)
  _internic.sok $$1-
}
alias _internic.sok {
  if ($dialog(_internic) == $null) || ($1- == $null) { return }
  if ($sock(_internic)) { sockclose _internic }
  did -r _internic 100
  _dialog.add1 _internic 50 $1-
  _recent.add internic 10 $1-
  sockopen _internic rs.internic.net 43
  sockmark _internic $1-
  did -o _internic 90 1 Connecting with rs.internic.net...
}
alias _internic.unload {
  if ($dialog(_internic)) { dialog -c _internic }
  sockclose _internic
}
ON *:DIALOG:_internic:init:0:{
  _mdx.init $_icofile(iwhois.ico,$scriptdir)
  dialog -t $dname WHOIS Client
  did -o $dname 49 1 Look Up Address:
  did -o $dname 51 1 &Look Up
  did -o $dname 52 1 &Cancel
  did -o $dname 53 1 C&lear
  did -o $dname 90 1 Ready
  var %i = 1
  while ($_recent.get(internic,%i) != $null) {
    did -ac $dname 50 $ifmatch
    inc %i
  }
}
ON *:DIALOG:_internic:edit:50:{ did -o $dname 250 1 $did(50).text }
ON *:DIALOG:_internic:sclick:50:{ did -o $dname 250 1 $did(50,$did(50,1).sel) }
ON *:DIALOG:_internic:sclick:51:{
  if ($did(250) != $null) {
    _dialog.add1 $dname 50 $did(250)
    _recent.add internic 10 $strip($did(250))
    _internic.sok $did(250)
  }
  halt
}
ON *:DIALOG:_internic:sclick:52:{
  if ($sock(_internic)) {
    sockclose _internic
    did -a $dname 100 $crlf $crlf $+ **CANCELLED** $+ $crlf
  }
  did -o $dname 90 1 Ready
}
ON *:DIALOG:_internic:sclick:53:{ did -r $dname 100 }
ON *:DIALOG:_internic:sclick:60:{
  if ($sock(_internic)) {
    info.a $_bracket($sock(_internic).mark) Whois lookup cancelled
    sockclose _internic
  }
}
ON *:SOCKOPEN:_internic: {
  if ($sockerr) {
    if ($dialog(_internic)) {
      did -a _internic 100 ERROR: $_sockerr
      did -o _internic 90 1 Ready
    }
    return
  }
  did -o _internic 90 1 Connected! Requesting info: $sock($sockname).mark
  sockwrite -n $sockname whois $sock($sockname).mark
}
ON *:SOCKREAD:_internic: {
  if ($sockerr) {
    if ($dialog(_internic)) {
      did -a _internic 100 ERROR: $_sockerr
      did -o _internic 90 1 Ready
    }
    return
  }
  did -o _internic 90 1 Receiving info: $sock($sockname).mark
  var %sr
  sockread %sr
  while ($sockbr) {
    if (%sr == $null) { did -a _internic 100 $crlf }
    else { did -a _internic 100 %sr $+ $crlf }
    if ($sockname == $null) { break }
    sockread %sr
  }
}
ON *:SOCKCLOSE:_internic: { did -o _internic 90 1 Ready }
ON *:SOCKWRITE:_internic: {
  if ($sockerr) {
    if ($dialog(_internic)) {
      did -a _internic 100 ERROR: $_sockerr
      did -o _internic 90 1 Ready
    }
    return
  }
}