I wrote a random signature generator for Pine, my email client. It worked great for a number of years, but with a recent upgrade of Pine, it started having trouble a couple of times a day, where the signature would be correctly rotated, but Pine would hang prior to sending the message, and would not save the content of the message either.I had to kill the process and retype the message. It finally got on my nerves enough that I looked into fixing it.
It turns out there is an faster way to make my script run, and seems to avoid the hanging problem too.
The first version of my script left my .signature file blank and took the text of the message and appending a signature to the end of it as the message was sent. The down-side of that is that I don't see the signature unless someone replies to me. I like reading the signatures, and also occasionally there are ones that aren't quite appropriate for communication to professors or other more formal (if email can be considered formal) communication.
My second solution writes to the .signature file on every outgoing message, but that signature is used for the next email, and thus I see the signature as I type the email. The strange thing about this solution is that the script takes the content on standard in, and pipes it right back out. Sort of silly, and I think part of the reason why it sometimes hangs, although it is simple, so I am not sure what is broken about it.
My newest solution uses Pine's sending-filters _TMPFILE_ parameter to pass in the message body content in a file. Thus, my script rotates the .signature file, and doesn't touch the _TMPFILE_ at all. A side-effect of this is that the script is quicker, as it doesn't have to do anything with the message body.

Source code:
Sending filter script The actual randomizer

PS. A friend from college wrote a randomizer for Eudora, and I fixed it up some, but I haven't used Eudora in a long time, so it hasn't been updated in years.
Posted by Jon Daley on May 25, 2005, 8:34 am | Read 2043 times
Category Programming: [first] [previous] [next] [newest]
Comments
Long ago (1994?) I wrote an sig randomizer for Pine that worked about the same way, though slightly simpler. It changed the signature file every time I logged in.
Posted by Peter Venable on May 25, 2005, 9:56 am

I think it would take me three or four years to get through all the quotes if I only changed it when I login.
Posted by jondaley on May 25, 2005, 1:39 pm
Add Comment
Add comment
E-mail me when comments occur on this article

culpable-adaptable