From 2c893f2c512246c411c969a5634a003b687cd04c Mon Sep 17 00:00:00 2001 From: djk Date: Mon, 26 Apr 1999 18:54:21 +0000 Subject: [PATCH] added set/user command --- cmd/set/user.pl | 34 ++++++++++++++++++++++++++++++++++ perl/Messages | 4 ++++ 2 files changed, 38 insertions(+) create mode 100644 cmd/set/user.pl diff --git a/cmd/set/user.pl b/cmd/set/user.pl new file mode 100644 index 00000000..a4b76bd3 --- /dev/null +++ b/cmd/set/user.pl @@ -0,0 +1,34 @@ +# +# set any variable in the User file +# +# This is a hack - use the UTMOST CAUTION!!!!!!!! +# +# Copyright (c) 1999 Dirk Koopman G1TLH +# +# $Id$ +# +my ($self, $line) = @_; +return (1, $self->msg('e5')) if $self->priv < 9; + +my @args = split /\s+/, $line; +return (1, $self->msg('suser1')) if @args < 3; + +my $call = uc $args[0]; +my $ref = DXUser->get_current($call); +my $field = $args[1]; +my $value = $args[2]; + +return (1, $self->msg('suser2', $call)) unless $ref; +return (1, $self->msg('suser4', $field)) unless $ref->field_prompt($field); +my @out; + +# set it (dates and silly things like that can come later) + +my $oldvalue = $ref->{$field}; +$ref->{$field} = $value; +$ref->put(); + +push @out, $self->msg('suser3', $field, $oldvalue, $value); +push @out, print_all_fields($self, $ref, "User Information $call"); + +return (1, @out); diff --git a/perl/Messages b/perl/Messages index 4be9b109..e2be0e3f 100644 --- a/perl/Messages +++ b/perl/Messages @@ -105,6 +105,10 @@ package DXM; sloc => 'Cluster lat $_[0] long $_[1], DON\'T FORGET TO CHANGE YOUR DXVars.pm', sqra => 'Cluster QRA Locator$_[0], DON\'T FORGET TO CHANGE YOUR DXVars.pm', sorry => 'Sorry', + suser1 => 'usage: callsign user_field_name value', + suser2 => 'User $_[0] not found', + suser3 => 'User field \'$_[0]\' was \'$_[1]\' now set to \'$_[2]\'', + suser4 => 'User field name \'$_[0]\' doesn\'t exist', talks => 'Talk flag set on $_[0]', talku => 'Talk flag unset on $_[0]', usernf => '*** User record for $_[0] not found ***', -- 2.43.0