🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #84690

Re: slrn - random signature file config

#84690
From: Lars Eighner
Date: Sun, 23 Sep 2001 15:41
225 lines
10284 bytes
In our last episode,
<slrn9qrppq.10n.a.l.meyers@nomad.consult-meyers.com>, the lovely and
talented A. L.  Meyers broadcast on news.software.readers:

> lgb@non.existent.invalid (Chiefy):
>>  22 Sep 2001 19:24 UTC, A. L.  Meyers typed:
>> > Hi! What must I put into .slrnrc to get slrn to execute a random
>> > signature file named ~/.sig and put the signature into my
>> > message to post?
>>  
>>  Not sure if this is what you're after, but we have a 'fortune' file with
>>  signatures contained within. It's then just a matter of calling 'fortune
>>  sigs' from within SLRN using 'post_editor_command'
>>  
>>  set post_editor_command "/usr/games/fortune sigs > ~/.sig; nano -c +%d %s -tmp"
>>  
>>  Set 'set signature' as appropriate in .slrnrc. You can also cat lines
>>  together if you have a line that doesn't change, an email address for
>>  example.
>>  
>>  Regards.

> Thanks, Chiefy! You are on the right path. My .sig file is a
> shell script which generates the signature. I use vim as editor
> under slrn. Putting

> set post_editor_command "~/.sig > ~/.signa; nano -c +%d %s -tmp"
> set signature ~/.signa

> does generate a correct .signa file but does not allow vim to
> start corrrecty. Instead, vim does not load, the signature does
> not appear and slrn asks me if I want to send an empty message.

> What fine tuning do you suggest? (BTW tin has the desired
> functionality right "out of the box".)

I can't speak for vim since I'd rather gouge my eyes out than
use vi, but here is my setup in case it is helpful to anyone:

In .slrnrc :

% The name of your signature file.  If "", no signature is added.
set signature ""

% i.e. don't let slrn add the sig

% You can have separate commands for editing posts, mail, and score files.
set mail_editor_command "jpico +%d -wordwrap '%s'"
set post_editor_command "/usr/local/sbin/followup '%s'"
set score_editor_command "jpico +%d -wordwrap '%s'"

% Custom headers to add to *new* posts
set custom_headers "X-Mail-Copies-To: nobody\nX-Revision:"

% Custom headers for followup/reply/supersedes.  These can use format
% specifiers as in the 'followup_string' variable.
set followup_custom_headers "X-Mail-Copies-To: nobody\nX-Revision:"
%set reply_custom_headers "X-newsgroup: %n\nX-realname: %r"
%set supersedes_custom_headers "X-Superseded-Date: %d"


The X-Revision: header should be added to new posts and followups.


Here is the followup script (scripts may need adjustment to
shells you have available):

#!/bin/sh
#followup

/usr/local/sbin/prepart.pl $1

jpico -wordwrap $1

ispell -L 4 -S -x $1


This calls a perl script to prepare the message, then the text
editor, and then the spelling checker.  The spelling checker can
be invoked from the editor (jpico which is an alias of joe), but
this calls it at the end of editing to encourage me to use it.

Here is the perl script to prepare the message (prepart.pl):

#!/usr/bin/perl

$group = "";
$first = "";
$file = $ARGV[0];

open (ARTICLE, $file);
open (TEMP, ">.temp");

while (<ARTICLE>)
{
if (/^Newsgroups:.*\.emacs/) {$group = "emacs"};
if (/^Newsgroups:.*\.xemacs/) {$group = "emacs"};
if (/^Newsgroups:.*\.atheism/) {$group = "atheist"};
if (/^Newsgroups:.*\.urban/) {$group = "afu"};
if (/^Newsgroups:.*\.usage/) {$group = "writer"};
if (/^Newsgroups:.*\.writing/) {$group = "writer"};
if (/^Newsgroups:.*\.english/) {$group = "writer"};
if (/^Newsgroups:.*\.test/) {$group = "test"};
if (/^Newsgroups:.*\.motss/) {$group = "socmotss"};
if (/^Newsgroups:.*\.impeach/) {$group = "peace"};
if (/^Newsgroups:.*\.peace/) {$group = "peace"};
if (/^Newsgroups:.*\.politics/) {$group = "peace"};
if (/^Newsgroups:.*\.true-crime/) {$group = "peace"};
if (/^Newsgroups:.*\.cecil-adams/) {$group = "peace"};
if (/^X-Revision:\n/) {$first = "true"};
$_ =~ s/^X-Revision: 0/X-Revision: 1/g;
$_ =~ s/^X-Revision:\n/X-Revision: 0\n/g;
print TEMP $_;
}
close ARTICLE;
if ($first eq "true")
{
if ($group eq "") {open (SIGFILE, "/usr/local/share/tags/humor.sig")};
if ($group eq "emacs") {open (SIGFILE, "/usr/local/share/tags/emacs.sig")};
if ($group eq "atheist") {open (SIGFILE, "/usr/local/share/tags/atheist.sig")};
if ($group eq "test") {open (SIGFILE, "/usr/local/share/tags/test.sig")};
if ($group eq "afu") {open (SIGFILE, "/usr/local/share/tags/afu.sig")};
if ($group eq "writer") {open (SIGFILE, "/usr/local/share/tags/writer.sig")};
if ($group eq "socmotss") {open (SIGFILE, 
         "/usr/local/share/tags/socmotss.sig")};
if ($group eq "peace") {open (SIGFILE, "/usr/local/share/tags/peace.sig")};
print TEMP "-- \n";
while (<SIGFILE>) {print TEMP $_};
system("/usr/local/share/tags/rotate.sh");
}
close TEMP;
system("mv",".temp",$file);


This script tests the Newsgroup header to decide which sig file to
use.  The X-Revision header should have been added by slrn.  The
purpose of this header is to prevent adding another sig if this
message is being re-edited. At present, the X-Revision header does
not count the number of revisions, but it could if for some reason
you saved all drafts and wished to use X-Revision to determine which
was the final one. rotate.sh is a script to rotate the quotation part
of the sig file. The sig separator, "-- \n" is added and then
the appropriate sig.

This is rotate.sh  (long lines broken)

#!/usr/local/bin/bash

gensig -m /usr/local/share/tags/athbase.txt -o \
  /usr/local/share/tags/atheist.tags > /usr/local/share/tags/atheist.sig
gensig -m /usr/local/share/tags/base.txt -o  \
 /usr/local/share/tags/socmotss.tags > /usr/local/share/tags/socmotss.sig
gensig -m /usr/local/share/tags/base.txt -o \ 
 /usr/local/share/tags/test.tags > /usr/local/share/tags/test.sig
gensig -m /usr/local/share/tags/base.txt -o \ 
 /usr/local/share/tags/writer.tags > /usr/local/share/tags/writer.sig
gensig -m /usr/local/share/tags/base.txt -o \
 /usr/local/share/tags/humor.tags > /usr/local/share/tags/humor.sig
gensig -m /usr/local/share/tags/base.txt -o \
 /usr/local/share/tags/afu.tags > /usr/local/share/tags/afu.sig
gensig -m /usr/local/share/tags/base.txt -o \
 /usr/local/share/tags/peace.tags > /usr/local/share/tags/peace.sig

gensig is a program which, as called here, appends a random line
from an *.tag file to a *.base file to produce a *.sig file.  There
are lots of ways to invoke gensig, including using it as a daemon
to feed a FOFI pipe.  rotate.sh seemed to me to be the best way
to handle multiple sig files.  rotate.sh could be improved by calling
it with a parameter from prepart.pl so that it only kicks the
sig file which has been used.

Here is an example of a base file:

Lars Eighner            eighner@io.com              http://www.io.com/~eighner/
%s

The %s is where gensig will place the random tagline.  As set up,
there can be a different base for each sig file.

Here is a typical tagfile entry (long line broken - control character
represented symbolically)

     "I have never made but one prayer to God, a very short one: 'O\
Lord,^M        make my enemies ridiculous.' And God granted it."  --Voltaire

In the actual file ^M is really the CR control character (i.e. really
is ctrl-M).  Each tag is on a separate line with a newline at the
end, and the lines of a tag are separtated by ctrl-M.  Gensig will
not itself break long lines or center tags - you have to set up the
tag file yourself with the line breaks and justification you desire.

There are some simpler programs than gensig which are suitable if
you only want to manage one sig file.

Most ordinary users should modify the paths in the above so as
to place the scripts in their home directories and should generate
the sigs in a directory where they have write permission.

Suggestions for improvements:

1)  Allow selection of sig file interactively instead by Newsgroup.
2)  Allow selection of tag interactively if the random tag is not
    wanted (this could be a macro in your editor).
3)  Provide for the kind of sig format where the random tag is
    in a "window" to the right, e.g:

My name          |    "extremely erudite
My email         |       tagline all over 
My web           |          on this side"


SLRN wish:

Ability to capture tags and other relatively short parts of messages
and append to selected files.  This would be useful for other things,
such as getting URLs you don't want to open right now.


Sign me:  Still looking for a USENET reader with the functionality
of the old Fidonet readers.

-- 
Lars Eighner            eighner@io.com              http://www.io.com/~eighner/
 All rights left. All lefts reserved. All reserves removed. All removes right.
Technical Details
Message-ID: <slrn9qs0lv.2m7n.eighnerlars@dumpster.io.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!cyclone.bc.net!sjcppf01.usenetserver.com!usenetserver.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!dumpster!not-for-mail
References: <slrn9qpoo2.19o.a.l.meyers@nomad.consult-meyers.com> <slrn9qrnfv.cj.lgb@aztec.eclipse> <slrn9qrppq.10n.a.l.meyers@nomad.consult-meyers.com>

Show Full Headers
Complete Article Headers
Message-ID: <slrn9qs0lv.2m7n.eighnerlars@dumpster.io.com>
Subject: Re: slrn - random signature file config
Date: Sun, 23 Sep 2001 15:41:54 GMT
From: eighner@io.com (Lars Eighner)
References: <slrn9qpoo2.19o.a.l.meyers@nomad.consult-meyers.com> <slrn9qrnfv.cj.lgb@aztec.eclipse> <slrn9qrppq.10n.a.l.meyers@nomad.consult-meyers.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!cyclone.bc.net!sjcppf01.usenetserver.com!usenetserver.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!dumpster!not-for-mail
Newsgroups: news.software.readers
Organization: Lars Eighner, author. Opinions are not necessarily those of the author.
Lines: 224
X-no-productlinks: yes
X-Mail-Copies-To: nobody
User-Agent: slrn/0.9.7.1 (FreeBSD)
NNTP-Posting-Date: Sun, 23 Sep 2001 10:41:54 CDT
X-Trace: sv3-bgrSn19ZFirFnRzMhEplMBviC1KtTixNmusREFR/y/0Mz5F7WYBBlrr7kJL/1Rfn7cX3lH+fZpbuVsz!Pj/1ZIRRrydPDUgHp/B+LE74TOkTM7zRwp9q4QGKccL06mLWsZ1DK3CIFIZ908K4LCIhqGZauQH0!8DOq7z/S
X-Complaints-To: abuse@GigaNews.Com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly