####################################################################################
#                  FlamE_BoY's Internic-Lookup ver 1.0                             #
#              Send comments or bug reports to: flameboy@canto.net                 #
#              Credits to erik and F^nor @ GalaxyNet for ideas/help rendered       #
####################################################################################
# I was browsing through the eggdrops archives of several eggdrops TCLs providers  #
#    and i couldn't find such a TCL so i decided to write one. Cheers.             #
# If you decide to use or edit this TCL, Please give me credits for it.            #
####################################################################################
# Lookup the Internic Information of a domain                                      #
# Usage is (public command) !internic <hostname>                                   #
#                            internic <hostname>                                   #
#          (msg command)     internic <hostname>                                   #
####################################################################################

bind pub - internic pub_internic
bind pub - !internic pub_internic
bind msg - internic msg_internic
bind dcc - internic dcc_internic

####################################################################################
#               You do not have to edit anything below this line!                  #
####################################################################################


proc msg_internic {nick uhost hand arg} {
  set input [open "|[exec which whois] $arg" r] 
    while ![eof $input] {
      catch {set result [gets $input]}
      if [eof $input] {break}
      set output [string trimleft $result]
  putserv "PRIVMSG $nick :$output"
 }
  catch {close $input}  
  unset input
  unset result
  return 1
}

proc pub_internic {nick uhost hand chan arg} {
  set input [open "|[exec which whois] $arg" r] 
    while ![eof $input] {
      catch {set result [gets $input]}
      if [eof $input] {break}
      set output [string trimleft $result]
  putserv "PRIVMSG $nick :$output"
 }
  catch {close $input}  
  unset input
  unset result
  return 1  
}

proc dcc_internic {hand idx arg} {
putdcc $idx "[exec [exec which whois] $arg]"
return 1
}

putlog "\002FlamE_BoY's Internic-Lookup v1.0\002 has been loaded.Email all bugs/comments to flameboy@canto.net"
