
               ********************************************

                              SmartPoll.rexx

                                Version 1.3

                    An advanced poll script for points

                 Public domain in 1995 by Magnus Holmgren

               ********************************************


1. Introduction
===============

 SmartPoll.rexx is mainly intended for points that either have several
bosses, and/or boss(es) with several lines, but it is still useful for
other points, that send filerequests/crash mail to other nodes. It can call
any number of bosses, with any number of lines, in a rotating manner. It
will exit when a successfull call to each boss have been made. It can also
handle crash/direct/normal mail and filerequests to any node (in your
nodelist). It also supports AKAs, and can ignore certain nodes.


2. Requirements
===============

 In order to use this poll script, you need some software properly
installed:

 · ARexx. :) This includes rexxsupport.library.
 · RexxReqTools (for the requesters).
 · TrapDoor (a registered copy).
 · traplist.library and a (partial) nodelist (for the outbound scanning).


3. Installation
===============

 Simply copy the script to some drawer you find convenient (e.g. "Rexx:").
Then you need to do some configuring. I suggest you don't edit the script,
but instead make use of the configuration file. The default is
"Mail:SmartPoll.cfg", but this can easily be changed. Simply use a text
editor to write it (note: you can use tabs, since the script will translate
any tabs found into spaces before processing it). See chapter 5
(Configuration) for more information about the configuration.

 In this archive there is also a file called SmartPoll.comp.rexx. This is
the SmartPoll.rexx file passed through a "Rexx compressor", that removes
all comments, and joins as many commands as possible to one line, to make
the ARexx parsing (somewhat) faster (and the file quite a bit smaller).


4. Usage
========

 It is very simple to use SmartPoll.rexx. Simply start it, with an optional
name of the configuration file. If no name is specified, it will default to
"Mail:SmartPoll.cfg" (for backward compatibility, "Mail:Poll.cfg" is also
checked if "Mail:SpartPoll.cfg" doesn't exist). The script will then read
the configuration, an associated data file, and perhaps scan your outbound
directory, and finally start TrapDoor (if needed) and try to call all nodes.

 If a console window is opened, then you can stop the script by pressing
Ctrl-C in that window. If you want to stop polling a certain node, the
press Esc in one of the TrapDoor windows when that node is called. A
requester will appear, asking you if you would like to continue polling the
node.

 The file "Mail:SmartPoll.data" (previously known as "Mail:Poll.data") is a
data file that this script needs in order to know which bosses that should
be polled a certain day. You don't need to do anything about this file, the
script handles it by itself.


5. Configuration
================

 The configuration file for SmartPoll.rexx is a simple text file with
certain "configuration commands" (similar to the TrapDoor configuration
file). Only one configuration command per line. Each command need at least
one argument. Empty lines, or lines that start with the char "#" are
ignored (i.e. they are comments). The following commands exists:

 AKA         - This command specifies AKAs. This way, SmartPoll can
               properly recognize e.g. packets for another net when using
               the "POLL NORMAL" command. This command expects two
               arguments: The number of your boss, and the AKA it is also
               known as (in that order). The node number of your boss
               should be one of the nodes specified with the NODE command.

 ASK         - This command specifies if the script should ask you if it
               should (keep) poll(ing) a certain node. If "NO", then all
               nodes found in the outbound (even if they weren't due for
               polling) will be added to the poll list. Also, if certain
               errors occur (or there is no answer), then that node will be
               excluded from further polling (during that session). If
               "YES", then the script will ask you on how to act.

               If you use SmartPoll unattended (e.g. from a Cron script
               during night), you should definitively set this to "NO".

 CONSOLE     - Name of the console. In this window SmartPoll.rexx will
               print some information output during the polling. Default is
               "Con:0/14/640/100/Poll.rexx/SCREEN TrapDoor". Use "Nil:" (or
               "Null:", if you have it) to disable this.

 ERRORLIMIT  - When TrapDoor have returned certain errors for a node the
               number of times specified here, then a requester will
               appear, asking if you should continue polling the node.
               Default is 5.

 IGNORE      - Any files found in OUTBOUND for this node will be silently
               ignored. Nice to have if you use e.g. AmiGate.

 NODE        - Here you specify your boss(es). The argument string should
               look like this (argument enclosed in "<>" are required, "[]"
               are optional):

               <Days> <Boss> [Phone... [PW=Password]]

               They "Days" argument specifies how often this boss should be
               polled. Use 0 for each time SmartPoll.rexx is started, 1 for
               every day, 2 for every other day etc. The current system date
               is used to keep track of this.

               "Boss" specifies the node number of your boss.

               "Phone" is the phonenumber(s) of your boss. A number may not
               contain spaces. You can add any number of phonenumbers, and
               SmartPoll.Rexx will try each one in a rotating manner. If
               you don't have a nodelist (for your boss(es)), then you must
               specify a phonenumber.

               The "Password" must be the last word on the line, and is
               indicated by a "PW=" in front of it. This is needed if you
               don't have a nodelist and poll several bosses (or if you
               haven't installed the passwords with TrapList).

               Note: Earlier versions of SmartPoll didn't handle passwords
               properly for custom phonenumbers. SmartPoll will now try to
               find the password for all nodes, if not specified, and
               traplist.library is available.

               You may specify as many bosses as you like.

 OUTBOUND    - The name of your outbound drawer. Default is "Mail:Outbound".

 POLL        - This specifies what files the outbound scanner should include
               (or not include) in the poll list. The following arguments
               may be specified (in any number and/or order, the last of a
               certain type is used):

               CRASH     - Include crash mail.
               NOCRASH   - Don't include crash mail (default).
               DIRECT    - Include direct mail.
               NODIRECT  - Don't include direct mail (default).
               NORMAL    - Include normal mail.
               NONORMAL  - Don't include normal mail (default).
               REQUEST   - Include file requests.
               NOREQUEST - Don't include file requests (default).

               The (NO)NORMAL argument is useful, since you can configure to
               call a boss, say, every third day. By adding "NORMAL", you can
               "force" a poll if the outbound should happen to hold any mail
               for that boss.

               If all types are disabled (the default), then the outbound
               drawer will not be scanned.

               A nodelist (and traplist.library) is required for this
               feature to work.

 PUBSCREEN   - The name of the public screen on which requesters should
               appear on. Default is "TrapDoor" (if this screen doesn't
               exist, then the default public screen will be used instead).

 REDAILDELAY - The redail delay, specified in seconds. Default is 30. After
               each "dialing" round, SmartPoll.rexx will wait this time
               before restarting the dialing. This only happens if there is
               at least one node that haven't been called yet.

 REXXNAME    - The name of the TrapDoor ARexx port. Default is "TrapDoor".

 TDCMD       - The command used to start TrapDoor, if this is needed. The
               arguments "REXXNAME" (using what was configured with the
               REXXNAME command) and "ANSWER" will be added to this string.
               This string should include the full path to TrapDoor, if
               this is needed, plus any additional configuration commands
               you like. Default is "TrapDoor".

               If TrapDoor was started by SmartPoll, it will also send a
               "QUIT" command to TrapDoor when it exits.


6. Known problems
=================

 If files in the outbound drawer have spaces in their names then this
script might get confused. However, SmartPoll checks the filename suffix
(and ignores files without a proper suffix), so there shouldn't be any
problems.

 This script seems stable in everyday usage, but since I haven't tested all
features that carefully, bugs/quirks may remain.


7. The future
=============

 The current version suits my needs rather well. However, it isn't the most
user friendly program (to interact with the actual polling is a bit
tricky). Thus, a possible future "extension" could be a rewrite into C,
with a nice user interface (perhaps something similar to TrapDispatcher).
However, I currently have no time for such a thing. I personally don't
really need it, and there are other projects that I feel are more important.


8. Author
=========

 This script was written by Magnus Holmgren. Comments, questions etc., can
be sent to:

    Magnus Holmgren
    Kvarnbergsvägen 5
    S-444 47  Stenungsund
    SWEDEN

    Fidonet:  "Magnus Holmgren" @ 2:204/204.6


9. Version history
==================

 Version 1.0:

  · Initial release


 Version 1.1:

 · Forgot to initialize a stem-item, causing problems when polling
"non-bosses".


 Version 1.2:

 · When "Skip"ing a node found in the outbound, the requester could be
repeated (since there may be more than one file for a certain node).
Delete also handle the extra files.

 · Fixed the spelling error of the "REDIALDELAY" command. The old command
("REDAILDELAY") is still supported for backward compatibility.

 · Fixed a few requester messages in the polling loop. Didn't use a proper
linefeed char.. :)

 · "Polling around midnight" problem fixed. Now it checks all dates before
starting to poll. That way, if SmartPoll is started a little before
midnight (usually to poll a node or two that wasn't polled yet), then the
script won't poll the other nodes after the time passes midnight (and
making the polling the next day "impossible" (without changing the data
file)).


  Version 1.3:

  · Added the "AKA" command.

  · Added the "IGNORE" command. Nice if you use AmiGate.

  · SmartPoll will now try to find a password for nodes with custom phone
numbers. In earlier versions, I assumed that sending the "BOSS" Rexx
command to TrapDoor was enough. It turned out it wasn't. This caused
problems that were difficult to understand at first (the connection "error"
message from TrapDoor was,nt very informative ;).

  · The default configuration name now is 'Mail:SmartPoll.cfg'. However,
SmartPoll will still read the 'Mail:Poll.cfg' file, in case the new name
can't be found. Also, the datafile have been renamed similarly. I haven't
bothered to support the old name (no need).

