🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
2 messages
2 total messages Started by John Red-Horse Wed, 06 Oct 1993 23:00
Invoking Per Group .signature's, etc in trn?
#6189
Author: John Red-Horse
Date: Wed, 06 Oct 1993 23:00
21 lines
1601 bytes
I recently began using trn (actually strn) and it seems to be a very
powerful newsreader, but I'm having a hard time figuring out how to
specify different things (such as .signature, Reply-To, Organization,
etc) on a per group (or even a per hierarchy basis).

For example, suppose that I participate in various non-work groups
(say, in the alt family) and work-related groups (such as in the sci
family) and I want to have appropriate (and different .sigs,
Organization and Reply-To, etc) for each.

Additionally, I'm also curious about whether it's possible to consider
similar things within a hierarchy (say, differentiating between
rec.sport.rugby and rec.outdoors.fishing).  Are such schemes possible
to implement?

Thanks in advance,
john
-- 
John Red-Horse                         jrredho@sandia.gov
Structural Dynamics & Vibration Control 
Sandia National Laboratories                (505)845-9190
Re: Invoking Per Group .signature's, etc in trn?
#6217
Author: Steven King, Software Archaeolog...
Date: Fri, 08 Oct 1993 12:57
111 lines
5119 bytes
jrredho@sandia.gov publicly declared:
>For example, suppose that I participate in various non-work groups
>(say, in the alt family) and work-related groups (such as in the sci
>family) and I want to have appropriate (and different .sigs,
>Organization and Reply-To, etc) for each.
>
>Additionally, I'm also curious about whether it's possible to consider
>similar things within a hierarchy (say, differentiating between
>rec.sport.rugby and rec.outdoors.fishing).  Are such schemes possible
>to implement?

Wayne Davison will probably give you a gnarly set of macros to do the
job.  I prefer a different solution.  This lets me have a different signature
for every newsgroup, or every hierarchy.  In addition, if no relevant
signature is found it'll choose one from a random collection.

For my script, signatures are stored under ~/News in the same directory
structure as KILL files.  The name of the signature is "signature",
with no leading dot.  If you want a signature for rec.sport.rugby you 
create ~/News/rec/sport/rugby/signature.  If you want a signature for
all of rec.sport.*, create ~/News/rec/sport/signature. Signatures are
searched from the bottom of the tree. A signature for rec.sport.rugby
would be used in preference to the one for the rest of rec.sport.*
when you're posting to the rugby group. If no signatures are found
under ~/News a random one is selected from ~/.sigs. Every file in .sigs
is fair game to be included as a signature, so don't leave your love
letters there!

Trn honors the "NEWSPOSTER" environment variable to tell it to use
a posting program other than Pnews.  You should set this to:

    NEWSPOSTER=Psig %C -h %h


Psig is the script included below.  %C is the name of the newsgroup
to which you're posting, and "-h %h" is the name of the header file.
FYI, the default for NEWSPOSTER is "Pnews -h %h".

This should do it.  Create the signatures, run the script, knock
yourself out!

---=== Cut Here ===---  ---=== Cut Here ===---
#! /usr/local/bin/perl
#
# Steve King, 18 Dec 91
#
# Synopsis: Psig newsgroup [Pnews-parms]
# (Though this should only be called from a newsreader...)
#
# Selects a signature based on the current newsgroup.  Psig will
# read the News directory tree in the user's home directory
# ($HOME/News/...) to find a file called "signature" in the
# current newsgroup.  If that file doesn't exist, the directory
# tree will be followed backwards through the hierarchy looking for
# a signature.  If none are found a random signature will be picked
# out of $sigdir
#
# When a signature is found it is copied to $HOME/.signature for
# inclusion in the article by inews.  Pnews is then called to
# create and post the article.
#
# The $sigdir variable can be pointed to any directory.  That 
# directory should contain ONLY files you want to use as .signatures, 
# and nothing else.  Any file in $sigdir is fair game for inclusion.
#
# To get this to work from (t)rn, set the NEWSPOSTER environment
# variable to "Psig %C -h %h".

$home   = $ENV{'HOME'};
$sigdir = "$home/.sigs";

@group = ("News",split(/\./,shift(@ARGV)));
$count  = @group;
$found  = 0;

while (@group) {
  $gname = join('/',@group);
  if (-f "$home/$gname/signature") {
    print "(Using signature from $home/$gname)\n";
    system("cp $home/$gname/signature $home/.signature");
    $found = 1;
    @group = ("dummy");
  }
  pop(@group);
}

if (! $found) {
  opendir(SIGS,$sigdir);
  @siglist = grep(!/^\./,readdir(SIGS));
  closedir(SIGS);
   
  $seed = time % ($$ * $$);              # Seems to provide a good seed.
  srand($seed);
  $chosen = int((rand() * @siglist));

  print "(Using random signature)\n";
  system("cp $sigdir/@siglist[$chosen] $home/.signature");
}

if ($ENV{'DOTDIR'} && ($ENV{'DOTDIR'} ne $home)) {
  system("cp $home/.signature $ENV{'DOTDIR'}/.signature");
}
system("cat $home/.signature");
system("Pnews @ARGV");
---=== Cut Here ===---  ---=== Cut Here ===---

-- 
-------------------------------------------------------+-----------------------
Lately I have the uncomfortable feeling that I've      |      Steven King
become a character in a Dilbert cartoon.               |   Motorola Cellular
                                                       |   king@rtsg.mot.com
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads