#!/usr/local/bin/wish4.1
set zircon(lib) [pwd]
#
#	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 compare {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} }
}
#
Initialise
lappend zircon(nets) [set current(net) [Net default]]
InitGlobals
#
# save some space!!! it will reload if necessary.
#
rename Initialise {}
rename InitGlobals {}
#
if $zircon(C) {
    $current(net) show
    if {$zircon(C) == 2} {
	mkInfoBox WARNING .@h$current(net) {Server Host Error} \
	  {No server selected for this network. Use the "Server"\
menu button to select one.}
    }
} \
elseif {[string compare [set hst [$current(net) hostid]] nil]} {
    set s [$current(net) servers]
    set v [lsearch $s $hst]
    listdel s $v
    while {![$current(net) startIRC]} {
	if [string match {} $s] break
	$current(net) configure -hostid [lindex $s 0]
	set s [lrange $s 1 end]
	update
    }
}
