Merge branch 'newpc92timings' of /scm/spider into newpc92timings
[spider.git] / gtkconsole / gtkconsole
index 4c0492deaf8eb09e6a579cdab5602bebc797478f..bfeddb61fd1268c992cb3495aaad09a37c02d530 100755 (executable)
@@ -4,13 +4,16 @@
 #
 # usage: gtkconsole [<callsign>] [<host> <port>]
 # 
-# Copyright (c) 2001-6 Dirk Koopman G1TLH
+# Copyright (c) 2006-2007 Dirk Koopman G1TLH
+#
 #
-# $Id$
 #
 
 use strict;
 
+our $VERSION = '$Revision$';
+$VERSION =~ s|[^\d\.]+||g;
+
 our $root;
 
 # search local then perl directories
@@ -46,6 +49,8 @@ our ($dx, $cmd, $ann, $wcy, $wwv); # scrolling list windows
 our $bot;                                              # the cmd entry window
 our $date;                                             # the current date
 
+require "$root/local/DXVars.pm" if -e "$root/local/DXVars.pm";
+
 # read in the user data
 our $userfn = "$ENV{HOME}/.gtkconsole_data";
 our $user = read_user_data();
@@ -77,7 +82,7 @@ unless ($call && $host) {
        my $node = $user->{clusters}->{$user->{node}};
        
        if ($node->{call} || $user->{call}) {
-               $call = $node->{call} || $user->{call};
+               $call = $node->{call} || $user->{call} || $main::myalias;
                $host = $node->{passwd};
                $host = $node->{host};
                $port = $node->{port};
@@ -85,15 +90,13 @@ unless ($call && $host) {
 }
 
 unless ($call && $host) {
-       if (-e "$root/local/DXVars.pm") {
-               require "$root/local/DXVars.pm";
-               $call = $main::myalias;
-               $call = $main::myalias; # for the warning
-       }
        if (-e "$root/local/Listeners.pm") {
                require  "$root/local/Listeners.pm";
                $host = $main::listen->[0]->[0];
                $port = $main::listen->[0]->[1];
+               $host ||= '127.0.0.1';
+               $host = "127.0.0.1" if $host eq '0.0.0.0';
+               $port ||= 7300;
        }
 }
 
@@ -113,7 +116,7 @@ die "You need a callsign ($call), a hostname($host) and a port($port) to proceed
 
 gtk_create_main_screen();
 
-$main->set_title("gtkconsole - The DXSpider Console - $call");
+$main->set_title("gtkconsole $VERSION - DXSpider Console - $call \@ $host:$port");
 
 # connect and send stuff
 my $sock = IO::Socket::INET->new(PeerAddr=>$host, PeerPort=>$port);
@@ -362,11 +365,13 @@ sub read_user_data
                
                $u = {
                          clusters => {
+                                                  'LOCAL' => {host => '127.0.0.1', port => 7300},
                                                   'GB7DJK' => {host => 'gb7djk.dxcluster.net', port => 7300},
                                                   'WR3D' => {host => 'wr3d.dxcluster.net', port => 7300},
                                                   'GB7BAA' => {host => 'gb7baa.dxcluster.net', port => 7300},
                                                  },
-                         node => 'GB7DJK',
+                         node => 'LOCAL',
+                         call => $main::myalias,
                         };
                write_user_data($u);
        }