From: minima Date: Mon, 17 Dec 2001 19:06:00 +0000 (+0000) Subject: Added set/prompt (and unset/prompt) command so that Stephan can fool some X-Git-Tag: R_1_50~132 X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=f0323dc530e2aa3fe5b8cd50b1c8c35aac67c52e;p=spider.git Added set/prompt (and unset/prompt) command so that Stephan can fool some external programs into thinking it is talking to clx. --- diff --git a/Changes b/Changes index 40c4fd1f..e96d3709 100644 --- a/Changes +++ b/Changes @@ -6,6 +6,8 @@ file from a msg (hopefully containing 2 Line Nasa keps) and then load - all in one step. Added load/keps to the help files 3. Updated spanish Messages 4. Improve wcy command from Stephan DK8LV's input +5. Added set/prompt (and unset/prompt) command so that Stephan can fool some +external programs into thinking it is talking to clx. 15Dec01======================================================================= 1. added superfluous spaces back into PC73 for the benefit of clx 14Dec01======================================================================= diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index cb99b9d1..b9d59a9a 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -1415,6 +1415,18 @@ given after the normal 'login: ' prompt. This command allows the sysop to completely delete and remove a password for a user. +=== 0^SET/PROMPT ^Set your prompt to +=== 0^UNSET/PROMPT^Set your prompt back to default +This command will set your user prompt to exactly the string that you +say. The point of this command to enable a user to interface to programs +that are looking for a specific prompt (or else you just want a different +fixed prompt). + + SET/PROMPT clx > + +UNSET/PROMPT will undo the SET/PROMPT command and set you prompt back to +normal. + === 5^SET/SPIDER [..]^Make the callsign an DXSpider node Tell the system that the call(s) are to be treated as DXSpider node and fed new style DX Protocol rather normal user commands. diff --git a/cmd/set/prompt.pl b/cmd/set/prompt.pl new file mode 100644 index 00000000..c1653c61 --- /dev/null +++ b/cmd/set/prompt.pl @@ -0,0 +1,28 @@ +# +# set the prompt of the user +# +# Copyright (c) 2001 - Dirk Koopman +# +# $Id$ +# + +my ($self, $line) = @_; +my $call = $self->call; +my $user; + +# remove leading and trailing spaces +$line =~ s/^\s+//; +$line =~ s/\s+$//; + +return (1, $self->msg('e9')) if !$line; + +$user = DXUser->get_current($call); +if ($user) { + $user->prompt($line); + $self->{prompt} = $line; # this is like this because $self->prompt is a function that does something else + $user->put(); + return (1, $self->msg('prs', $line)); +} else { + return (1, $self->msg('namee2', $call)); +} + diff --git a/cmd/unset/prompt.pl b/cmd/unset/prompt.pl new file mode 100644 index 00000000..35d02a0b --- /dev/null +++ b/cmd/unset/prompt.pl @@ -0,0 +1,22 @@ +# +# unset the prompt of the user +# +# Copyright (c) 2001 - Dirk Koopman +# +# $Id$ +# + +my ($self, $line) = @_; +my $call = $self->call; +my $user; + +$user = DXUser->get_current($call); +if ($user) { + delete $user->{prompt}; + delete $self->{prompt}; + $user->put(); + return (1, $self->msg('pru', $line)); +} else { + return (1, $self->msg('namee2', $call)); +} + diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm index 8dae7cd6..6ded9e8e 100644 --- a/perl/DXChannel.pm +++ b/perl/DXChannel.pm @@ -109,6 +109,7 @@ $count = 0; badcount => '1,Bad Word Count', edit => '7,Edit Function', registered => '9,Registered?,yesno', + prompt => '0,Required Prompt', ); use vars qw($VERSION $BRANCH); diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index 212b9a0c..8b704ab5 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -107,6 +107,7 @@ sub start $self->{logininfo} = $user->wantlogininfo; $self->{ann_talk} = $user->wantann_talk; $self->{here} = 1; + $self->{prompt} = $user->prompt if $user->prompt; # sort out registration if ($main::reqreg == 1) { @@ -523,7 +524,11 @@ sub disconnect sub prompt { my $self = shift; - $self->send($self->msg($self->here ? 'pr' : 'pr2', $self->call, cldate($main::systime), ztime($main::systime))); + if ($self->{prompt}) { + $self->send($self->{prompt}); + } else { + $self->send($self->msg($self->here ? 'pr' : 'pr2', $self->call, cldate($main::systime), ztime($main::systime))); + } } # broadcast a message to all users [except those mentioned after buffer] diff --git a/perl/DXUser.pm b/perl/DXUser.pm index 47ebcdb0..b996e5c5 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -75,6 +75,7 @@ $lasttime = 0; lastoper => '9,Last for/oper,cldatetime', nothere => '0,Not Here Text', registered => '9,Registered?,yesno', + prompt => '0,Required Prompt', ); no strict; diff --git a/perl/Messages b/perl/Messages index 0ca9d77f..cc45c718 100644 --- a/perl/Messages +++ b/perl/Messages @@ -202,6 +202,8 @@ package DXM; 'pos' => 'From Callsign: $_[0] Lat: $_[1] Long: $_[2]', pr => '$_[0] de $main::mycall $_[1] $_[2] >', pr2 => '($_[0]) de $main::mycall $_[1] $_[2] >', + prs => 'Prompt now set to \"$_[0]\"', + pru => 'Prompt now set back to default', priv => 'Privilege level changed on $_[0]', prx => '$main::mycall >', pw0 => 'Enter old password: ',