@database Sabot @node main Sabot - A Mailbox Monitor Sabot - A Mailbox Monitor By Scott Ellis @{"About Sabot" link whatis} @{"Usage" link usage} @{"Things to know" link thingies} @{"Thanks" link thanks} @{"About the author" link author} @{"History" link history} @endnode @node whatis What is Sabot? What is Sabot? Sabot is basically a clone of Mike Schwartz's MailMinder program, but but smaller and with added functionality. What Sabot does is watch a file (presumably your mailbox), and do things when the mailbox changes. What Sabot always does is display an AppIcon on your Workbench screen showing you the status of the file being watched. If the file is empty it displays an icon illustrating an "empty mailbox". If the file is the same size an icon depicting old mail is displayed. If the mailbox gets bigger, then the icon changes to a "full mailbox" icon, until you look at the file. Very simple. Is a silly AppIcon worth almost 6k of space on your system? Of course it is...but wait, that's not all! ;-) Sabot can also launch programs. Sabot can launch programs under a variety of circumstances, including: Mailbox got bigger Click on the AppIcon Drop files onto the AppIcon Sounds exciting, eh? @endnode @node usage So how do I use Sabot? So how do I use Sabot? Sabot is simple to use. You start Sabot from either the command line, or from an Icon with appropriate ToolTypes. All options are optional, unless otherwise stated. The following are valid options: REQUIRED OPTIONAL @{"Mail" link mail} @{"XPos" link xpos} @{"NoMail" link nomail} @{"YPos" link ypos} @{"OldMail" link oldmail} @{"ClickCommand" link clickcommand} @{"MailBox" link mailbox} @{"ClickStack" link clickstack} @{"IconName" link iconname} @{"DropCommand" link dropcommand} @{"DropStack" link dropstack} @{"BeepLots" link beeplots} @{"CountDelete" link countdelete} @{"Time" link time} @{"MailRdy" link mailrdy} @endnode @node mail Mail (required) - This is the name of the icon you wish to be shown to indicate that you have new mail. (Name is WITHOUT the ".info" extension) @endnode @node nomail NoMail (required) - This is the name of the icon you wish to be shown to indicate that you do not have new mail. (Name is WITHOUT the ".info" extension) @endnode @node oldmail OldMail (required) - This is the name of the icon you wish to be shown to indicate that you have old mail. (Name is WITHOUT the ".info" extension) @endnode @node mailbox MailBox (MB) (required) - This is the name of your mailbox file. @endnode @node iconname IconName (IN) - This option controls what is printed under the AppIcon. If this option is omitted, the AppIcon will be named "MailBox". @endnode @node xpos XPos - XPos is the horizontal position, in pixels, where you want the icon to appear. If left out, the icon will be free floating in the X direction. @endnode @node ypos YPos - YPos is the vertical position, in pixels, where you want the icon to appear. If left out, the icon will be free floating in the Y direction. @endnode @node clickcommand ClickCommand (CC) - ClickCommand is the command that gets executed when the AppIcon is double-clicked. @endnode @node clickstack ClickStack (CS) - ClickStack is the stack that ClickCommand is run with. If ClickCommand was omitted, ClickStack has no effect. @endnode @node mailcommand MailCommand (MC) - MailCommand is the command that is executed when new mail arrives. @endnode @node mailstack MailStack (MS) - MailStack is the stack that MailCommand is run with. If MailCommand was omitted, MailStack has no effect. @endnode @node dropcommand DropCommand (DC) - DropCommand is the command that is executed when icons are dropped on the AppIcon. This command is executed once for each icon dropped, and the name of the Icon is appended to the DropCommand. @endnode @node dropstack DropStack (DS) - DropStack is the stack that DropCommand is run with. If DropCommand was omitted, DropStack has no effect. @endnode @node beeplots BeepLots - Normally, Sabot executes MailCommand only once, when the first new mail message arrives. If you want MailCommand to be run for each new mail message, then use the BeepLots switch. @endnode @node countdelete CountDelete - Some mail programs delete the mailbox file when there are no messages remaining, while others leave a zero length file. If your mailer deletes the file, then specify the CountDelete switch so that Sabot will know that an empty file means there are no messages, not that the mailbox just isn't completely updated yet. @endnode @node time Time - (Sabot-Timer only) This is the amount of time, in minutes that Sabot waits between looking at the mailbox for changes. Default is to check every 5 minutes. @endnode @node mailrdy MailRdy - Many mail utilities will send a message to the public port "T:MailRdy" when new mail arrives. If you wish to have Sabot create a message port with this name, use the MailRdy switch. When Sabot receives a signal at the T:MailRdy port, it will change the icon to indicate that new mail has arrived. @endnode @node thingies Things you should know- I tried to make Sabot as small and simple as possible. Sabot does everything "by the book", or at least it tries to. Commands that Sabot executes are run asynchronously, so if you drag 100 icons onto Sabot's AppIcon, it will start 100 new processes. That can make for a really slow system. ;-) Be careful, kids. Sabot tries to be intelligent with its icon switching, but there is a limit. If the mailbox file size grows by less than 130 bytes, Sabot won't change the icon. This is to allow for mail programs, such as AmigaElm to add a few characters to the mail file, in order to mark messages as old, answered, etc. If you read your mailbox using a program not started by Sabot, and you don't actually edit the file, then Sabot cannot tell that you read it, and won't change the icon. AmigaElm, when writing back the mailbox, writes to a temp file, deletes the original mailbox, then renames the temp file to the mailbox name. This small period when the mailbox is deleted causes some problems with Sabot. To eliminate these problems Sabot is now optimized to work with AmigaElm, and knows to ignore a non-existant file, but some mailers (dmail among them) would cause Sabot to not go back to a NoMail state because of this. So please specify the "COUNTDELETE" flag when using a mailer such as dmail. Some filesystems, especially networked ones like Envoy, Parnet, EnlanDFS, and NFS do not support the file notification feature that Sabot relies on. In order to use Sabot with a mailbox on such a filesystem, you need to use the Sabot-Timer version, and specify how often to check the mailbox. Please note that the Sabot-Timer version may have a few quirks that make it slighly different from the "normal" version, such taking more CPU time (It basically takes as much as if you got new mail every 5 minutes with the "normal" Sabot). This is unavoidable. @endnode @node uses Suggested uses for Sabot - I suggest having Sabot set up in the following manner: ClickCommand runs your mailreader. DropCommand runs sendmail, to your favorite person. MailCommand plays a sample. I've found these settings to be most useful. @endnode @node thanks Thanks To - Michael B. Smith Michael provided @{i}lots@{ui} of help in writing Sabot, and was also kind enough to include it in his @{b}InetUtils@{ub} package. Klaus Alexander Seistrup Klaus gave me some good ideas of changes to make to Sabot, and also gave me some nice MagicWB-looking icons to use with Sabot. Colin Stuckless Colin filled in the 1/4 of the globe that was hidden in Klaus' icons, so I could make new icons. Kenneth Fribert Suggested the OldMail idea first. Oleg Rovner Made sure these docs are readable. ;-) Eric Sommer Hacked Oleg's readble docs into this AmigaGuide database. Christopher A. Wolf Provided me with his great Commandline/Tooltype parsing code. Gotta love it. Thanks Chris! Miscellaneous other people on IRC, who gave me ideas, and tidbits of code. @endnode @node author About the Author - The author is... Name: Scott Ellis E-mail: sellis@ucssun1.sdsu.edu Snail: 3640 Mt. Everest Blvd., San Diego, CA, 92111 (USA) Feel free to contact me if you have any problems or suggestions. P.S. It's called "Sabot" because I really liked when Kim Catrall gave her little speech about sabotage in Star Trek VI: The Undiscovered Country. ;-) @endnode @node history History - @{b}1.3@{ub} - First Public Release with InetUtils V1.1 @{b}1.4@{ub} - Added MailRdy option. (Suggested by Michael B. Smith) Upped "ignored filesize change" to 200 bytes. Added icon positioning (XPos and YPos) option. (suggested by Klaus Alexander Seistrup) Removed redundant if(), and reorganized a bit of that code. Reorganized compare(), to reduce the number of icon image changes. @{b}1.5@{ub} - Fixed silly bug where the "HaveMail" icon was updated, even if it was already being shown. @{b}1.6@{ub} - Reduced code size by changing linking with amiga.lib before sc.lib. Added "OldMail" icon. (suggested by Kenneth Fribert) Fixed bug where mailbox size wasn't getting set if the mailbox was deleted. Added "CountDelete" tooltype to help with deleted mailboxes. @{b}1.7@{ub} - Sabot now shows "OldMail" if the mailbox is not empty when Sabot is started. Thanks to the hordes of people who reported this "bug". It was actually just an oversight. @{b}1.8@{ub} - Integrated new ParseParameters() into Sabot. Reduced code size even more. Created a new "Sabot Timer" that uses a polling method rather than file notification. Integrated it's source with the other version. To recreate the polling version, define "TIMER", or make "timer". Documentation now in AmigaGuide format, thanks to Eric Sommer. Put quotes around filenames that are dropped onto the AppIcon. This fixes problems with files from RAM: and files that have spaces in their names. @endnode