#!/usr/bin/dpwish -f
set zircon(lib) /user/nlfm/Working/Zircon/Development
#
#	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
#
lappend auto_path $zircon(lib)/lib
#
if ![string match "7*" [info tclversion]] {
    puts stderr {*** Sorry, you need tcl 7.* in order to run Zircon}
    exit 1
}

if ![info exists dp_version] {
#    puts stderr \
#      {*** Your tcl/tk interpreter does not have the tcl-dp extension!!}
#    exit 1
proc dp_address {args} { }
proc dp_connect {args} {
    global myid
    set srv [lindex $args 0]
    if {[set port [lindex $args 1]] == {}} { set port 6667 }
    if {[catch {set desc [open "|irc -d [$myid name] $srv:$port" r+]} msg]} {
	error $msg
    }
    return [list $desc 1234]
}
proc dp_filehandler {sock what prc} {
    fileevent $sock readable "$prc r $sock"
}
proc dp_shutdown {args} { }
proc dp_atclose {args} { }
proc dp_socketOption {args} { }
set dp_version "No tcl-dp"
proc dp_receive {sock} { return [gets $sock] }
proc dp_send {sock what} {
    puts $sock $what
    flush $sock
}
    set USINGIRC 1
} {
    set USINGIRC 0
}
#
wm withdraw .
#
InitGlobals
Control .ctl0
set mainInfo [Info info0]
setNickname $nickname
#
# save some space!!!
#
rename InitGlobals {}
if ![string match {nil} $zircon(host)] {
    set s [Server :: list]
    set v [lsearch $s $zircon(host)]
    listdel s $v
    while {![startIRC $zircon(host)]} {
	if [string match {} $s] { break }
	set zircon(host) [lindex $s 0]
	set s [lrange $s 1 end]
	update
    }
}
