#!/usr/bin/wishx -f
set zircon(lib) /usr/X11R6/lib/zircon
#
#	ZIRCON - an X11 interface to the Internet Relay Chat
#
#	Written by
#		Lindsay (Lindsay F. Marshall)
#		Jimbles (Jon Harley)
#
#	Copyright (c) 1993
#
#	See the file COPYRIGHT for details
#
set auto_path [linsert $auto_path 0 $zircon(lib)/lib]
#
if ![string match {7.[45]} [info tclversion]] {
    tk_dialog .err Error {*** Sorry, you need tcl 7.4 or later to run Zircon} \
      error 0 OK
    exit 1
}

if {[string match {7.5} [info tclversion]] &&
   ![string match {} [info commands socket]]} {
    source $zircon(lib)/lib/interp/tcl7.5.tcl
} \
elseif [info exists dp_version] {
    source $zircon(lib)/lib/interp/tcldp.tcl
} \
elseif {[info exists tclx_library] && [infox have_sockets]} {
    source $zircon(lib)/lib/interp/tclx.tcl
} {
    tk_dialog .err Error \
      {*** Your tcl/tk interpreter does not have a suitable networking extension!!} \
      error 0 OK
    exit 1
}
set USINGIRC 0
#
wm withdraw .
#
foreach ty {Entry Text Button} {
    foreach x [bind $ty] { bind $ty $x {+ notIdle %W} }
}
#
InitGlobals
Net net0 -invisible $invisible -wallops $wallops -srvmsg $srvmsg
#
# save some space!!!
#
rename InitGlobals {}
if {$zircon(host) != {nil}} {
    set s [Server :: list]
    set v [lsearch $s $zircon(host)]
    listdel s $v
    while {![net0 startIRC $zircon(host)]} {
	if [string match {} $s] break
	set zircon(host) [lindex $s 0]
	set s [lrange $s 1 end]
	update
    }
}
