1 Programming Notes ($Id$)
3 * Every command that can used on the command line lives in either this
4 directory ('cmd') or in a local version ('local_cmd'). You are cajoled or
5 ordered not to and generally discouraged from altering the commands in
6 the 'cmd' directory. You can put local copies in the 'local_cmd' directory
7 and they will override the standard ones.
9 * If you want to play, do it in the 'local_cmd' directory. It's very easy and
10 reasonably safe. You can override a command whilst the cluster is running.
11 Compilation errors will simply give you error messages, it won't stop the
12 cluster running - this only happens if you mess with the internals to the
13 extent that it gets confused...
15 * A command is a piece of perl, it is simply a small snippet of program
16 that is dynamically loaded into the cluster on invocation from the
17 command line. The last modification time is used to determine whether to
20 * New (or altered) commands are available for test the moment you save them.
22 * A command is placed into the appropriate directory with a '.pl' appended
23 to the end. So the 'show/qra' command lives in 'cmd/show/qra.pl' (or a
24 local version would be in 'local_cmd/show/qra.pl'.
26 * For the security conscious, potentially dubious characters (i.e. not
27 [A-Za-z0-9_/]) are converted to their hex equivalents. This will almost
28 certainly mean that the user will get an error message (unless you have
29 your secret squirrel hat on and have deliberately put such commands up
30 [in 'local_cmd' of course]).
32 * The snippets of program you put here are wrapped in an eval { } and
33 are subroutines derived from the DXChannel class. They effectively
34 the following declaration :-
36 sub Emb_<cmdname>($self, $args)
43 * slash characters are replaced by '_' so the equivalent name for 'show/qth'
46 * you would normally do a 'my ($self, $line) = @_;' as the first thing. There
47 are a complete set of accessors for DXUser, DXCommandmode and DXChannel
48 classes and these are the recommended way of getting at these classes.
49 A fairly standard start might be:-
51 my ($self, $line) = @_;
52 @args = split /\s+/, $line;
56 * $args is the rest of the line after the command (as a string).
58 * You are responsible for maintaining user security. If you have a command
59 that does something a normal system shouldn't be allowed to do or see,
60 there is $self->priv (using the above example) which gives you the running
61 privilege level of the channel. USE IT!
63 * The normal privilege levels are:-
66 9 - console privilege.
68 The sysop privilege is for things that you are prepared for remote
69 sysops and clusters to do or see.
71 A console privilege can only be executed locally (at least if you have
72 correctly installed the client program in inetd or ax25d).
74 The set/priv command can only be executed by a console privileged
77 * You must return a list with a 0 or 1 as the first element. 1 means
78 success and 0 means fail. Each element of the list which follows is
79 assumed to be one line for output. Don't put \n characters at the end
80 of an element (the client will put the correct one in if required
83 * As this is perl and it is very easy to alter stuff to get it correct,
84 I would like to see some intelligent argument processing, e.g. if
85 you can have one callsign, you can have several. Interpret your
86 arguments; so for example:-
88 set/locator jo02lq - sets your own locator to JO02LQ
89 set/locator g1tlh jo02lq - sets G1TLH's locator (if you are allowed)
93 show/locator - displays your locator (and other info?)
94 show/locator in92jo - displays the bearing and distance to
95 IN92JO using your lat/long or locator
96 show/locator jn56in in92jo - bearing and distance between two
98 show/locator gb7dxc - bearing and distance to gb7dxc if poss.
100 * It is important that you remember when you have tie hashes using MLDBM
101 et al. If you do a DXUser->get($call) you will get a different (older)
102 thing than the one in $self->$user. This is almost certainly NOT what
103 you want if want to modify a user that is currently connected.
105 * Anything you output with a > as the last character is taken to mean
106 that this is a prompt and will not have a \r or \n appended to it.
108 * help files can also be placed in the appropriate place. These files
109 have exactly the same naming conventions as commands except that they
110 have a '.hlp' appended to the command name rather than a '.pl'. All
111 in the help file are sent to the user except those starting with a '#'