Added set/prompt (and unset/prompt) command so that Stephan can fool some
authorminima <minima>
Mon, 17 Dec 2001 19:06:00 +0000 (19:06 +0000)
committerminima <minima>
Mon, 17 Dec 2001 19:06:00 +0000 (19:06 +0000)
external programs into thinking it is talking to clx.

Changes
cmd/Commands_en.hlp
cmd/set/prompt.pl [new file with mode: 0644]
cmd/unset/prompt.pl [new file with mode: 0644]
perl/DXChannel.pm
perl/DXCommandmode.pm
perl/DXUser.pm
perl/Messages

diff --git a/Changes b/Changes
index 40c4fd1ffc747141e13167bde94f523c47a0e54e..e96d37093087562c87dbcc0aaaf3c0d820319806 100644 (file)
--- 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=======================================================================
index cb99b9d1a3aa9a65a835dfb8cf7fd74979dfe62b..b9d59a9a623f3d610a0cc1af8de9e0495ce0ad0b 100644 (file)
@@ -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 <string>^Set your prompt to <string>
+=== 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 <call> [<call>..]^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 (file)
index 0000000..c1653c6
--- /dev/null
@@ -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 (file)
index 0000000..35d02a0
--- /dev/null
@@ -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));
+}
+
index 8dae7cd6d54dc3e66a2f31a317f3268628b6c7d0..6ded9e8efa9ab7e7ead5201c88a063822f791509 100644 (file)
@@ -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);
index 212b9a0c4a04c25c9a131f703ed213a0440cdda3..8b704ab5333f4f011617bd0ca88ea795dbf8743a 100644 (file)
@@ -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]
index 47ebcdb044709c46c6bec7689911da5d427847e9..b996e5c536bc6d377265cadbde0d8375a8f0bbea 100644 (file)
@@ -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;
index 0ca9d77fca3f7bf21595232afc22cee5d6405251..cc45c71808fa210a3887ed2020295ac77876c9fb 100644 (file)
@@ -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: ',