fixed import export
authorminima <minima>
Tue, 1 Aug 2000 21:46:08 +0000 (21:46 +0000)
committerminima <minima>
Tue, 1 Aug 2000 21:46:08 +0000 (21:46 +0000)
removed import_users.pl

Changes
cmd/set/address.pl
cmd/set/email.pl
cmd/set/homenode.pl
cmd/set/name.pl
cmd/set/password.pl
cmd/set/qth.pl
perl/DXUser.pm
perl/import_users.pl [deleted file]

diff --git a/Changes b/Changes
index 2e4be4fcfd72cce30fd9a9cbe78c03ade8d79ec0..39f982fe2c87a9ff1b65f400c10c4f2a3b6e40c5 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,8 @@
+01Aug00=======================================================================
+1. made the export and import ascii system work finally. The user_asc file
+generated (automatically and 0000Z Sunday morning) is autoloading. Just 
+execute it and it will automatically reload your user database.
+2. remove import_users.pl no longer necessary
 31Jul00=======================================================================
 1. try to fix paging problem.
 2. added help for spoof and set/forward
index 15e42579597482a00ff5c899b2c852118b44666e..daea06c84aa35a9c2ebd857e9a9386b09b71d428 100644 (file)
@@ -11,18 +11,9 @@ my $call;
 my @out;
 my $user;
 
-if ($self->priv >= 5) {             # allow a callsign as first arg
-  my @args = split /\s+/, $line;
-  $call = UC $args[0];
-  $user = DXUser->get_current($call);
-  shift @args if $user;
-  $line = join ' ', @args;
-} else {
-  $call = $self->call;
-  $user = $self->user;
-}
-
+$user = $self->user;
+$line =~ s/[{}]//g;   # no braces allowed
 $user->addr($line);
-push @out, $self->msg('addr', $call, $line);
+push @out, $self->msg('addr', $line);
 
 return (1, @out);
index 8748df1f1bed75b21e9e56696ce3bdb01ff5915b..ed68420eaed123b858d7075416c5c32571275d68 100644 (file)
@@ -13,6 +13,7 @@ my $user;
 # remove leading and trailing spaces
 $line =~ s/^\s+//;
 $line =~ s/\s+$//;
+$line =~ s/[{}]//g;  # remove any braces
 
 return (1, $self->msg('emaile1')) if !$line;
 
index f1e909ffe81412cea67ab365d8bfee522384361f..5d3cb413610f38177d8b09fb00d371aaec44fcad 100644 (file)
@@ -13,6 +13,7 @@ my $user;
 # remove leading and trailing spaces
 $line =~ s/^\s+//;
 $line =~ s/\s+$//;
+$line =~ s/[{}]//g;   # no braces allowed
 
 return (1, $self->msg('hnodee1')) if !$line;
 
index e966837d9f3324dd23a4b84d1a92032198d3b7d9..6f76ea60eec7258be7df277fb92cf5e4a1d9071d 100644 (file)
@@ -13,6 +13,7 @@ my $user;
 # remove leading and trailing spaces
 $line =~ s/^\s+//;
 $line =~ s/\s+$//;
+$line =~ s/[{}]//g;   # no braces allowed
 
 return (1, $self->msg('namee1')) if !$line;
 
index 1aa425f610686a229cce343e06e01af1fd6d4e8b..1c248d023576fc8bac0cc9cee1fb288b3bc361b2 100644 (file)
@@ -19,6 +19,7 @@ return (1, $self->msg('e5')) if $self->priv < 9;
 if ($ref = DXUser->get_current($call)) {
        $line =~ s/^\s*$call\s+//;
        $line =~ s/\s+//og;                    # remove any blanks
+       $line =~ s/[{}]//g;   # no braces allowed
        $ref->passwd($line);
        $ref->put();
        push @out, $self->msg("password", $call);
index e76e5fffbdd4ae7d70a770d1a9681272809aaf90..567208c731362974382d1fbe573b28880c2a8ea9 100644 (file)
@@ -13,6 +13,7 @@ my $user;
 # remove leading and trailing spaces
 $line =~ s/^\s+//;
 $line =~ s/\s+$//;
+$line =~ s/[{}]//g;   # no braces allowed
 
 return (1, $self->msg('qthe1')) if !$line;
 
index eaf880392c26e880198220c5fd7437ec53d3ea47..ce26c291c7919a1b0874c709b09f1f53ddc918f2 100644 (file)
@@ -103,7 +103,7 @@ sub init
 
 sub del_file
 {
-       my ($pkg, $fn, $mode) = @_;
+       my ($pkg, $fn) = @_;
   
        confess "need a filename in User" if !$fn;
        $fn .= ".v2";
@@ -308,11 +308,11 @@ sub export
        my $count = 0;
        my $fh = new IO::File ">$fn" or return "cannot open $fn ($!)";
        if ($fh) {
-               my $ref;
-               my $key;
+               my $ref = 0;
+               my $key = 0;
                my $action;
                my $t = scalar localtime;
-               print $fh "#!/usr/bin/perl
+               print $fh q{#!/usr/bin/perl
 #
 # The exported userfile for a DXSpider System
 #
@@ -320,19 +320,56 @@ sub export
 #       Time: $t
 #
 
+package main;
+
+# search local then perl directories
+BEGIN {
+       umask 002;
+       
+       # root of directory tree for this system
+       $root = "/spider"; 
+       $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
+       
+       unshift @INC, "$root/perl";     # this IS the right way round!
+       unshift @INC, "$root/local";
+
+       # try to detect a lockfile (this isn't atomic but 
+       # should do for now
+       $lockfn = "$root/perl/cluster.lock";       # lock file name
+       if (-e $lockfn) {
+               open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!";
+               my $pid = <CLLOCK>;
+               chomp $pid;
+               die "Lockfile ($lockfn) and process $pid exists - cluster must be stopped first\n" if kill 0, $pid;
+               close CLLOCK;
+       }
+}
+
 package DXUser;
 
+use DXVars;
+use DXUser;
+
+if (@ARGV) {
+        $main::userfn = shift @ARGV;
+        print "user filename now $userfn\n";
+}
+
+DXUser->del_file($main::userfn);
+DXUser->init($main::userfn, 1);
+
 %u = (
-";
-
-               for ($action = R_FIRST; !$dbm->seq($key, $ref, $action); $action = R_NEXT) {
-                       print $fh "'$key' => $ref,\n";
-                       ++$count;
-               } 
-               print $fh ");\n#\n# there were $count records\n#\n";
-               $fh->close;
-       } 
-       return $count;
+   };
+         
+for ($action = R_FIRST; !$dbm->seq($key, $ref, $action); $action = R_NEXT) {
+       print $fh "'$key' => q{$ref},\n";
+       ++$count;
+} 
+print $fh ");\n#\nprint \"there were $count records\\n\";\n#\n";
+print $fh "DXUser->sync; DXUser->finish;\n#\n";
+$fh->close;
+} 
+               return $count;
 }
 
 #
diff --git a/perl/import_users.pl b/perl/import_users.pl
deleted file mode 100755 (executable)
index 159989b..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/perl
-#
-# Export the user file in a form that can be directly imported
-# back with a do statement
-#
-
-require 5.004;
-
-# search local then perl directories
-BEGIN {
-       umask 002;
-       
-       # root of directory tree for this system
-       $root = "/spider"; 
-       $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
-       
-       unshift @INC, "$root/perl";     # this IS the right way round!
-       unshift @INC, "$root/local";
-}
-
-use DXVars;
-use DXUser;
-use DXUtil;
-use Carp;
-
-$inpfn = $ARGV[0] if @ARGV;
-croak "need a input filename" unless $inpfn;
-
-DXUser->del_file($userfn);
-DXUser->init($userfn, 1);
-
-my $s = readfilestr "$inpfn";
-eval $s;
-print $@ if $@;
-
-DXUser->finish();