🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #186784

Re: [slrn] How to add a custom header for specific groups only?

#186784
From: Troy Piggins
Date: Tue, 20 Jun 2006 22:04
59 lines
3157 bytes
* Adam Funk wrote:
> I'd like to customize slrn so that when I post or follow-up and any of
> the groups in the Newsgroups-header match a specified list, slrn runs
> an external program to get the value of a custom header, which it
> inserts before launching the $EDITOR.
>
> Unfortunately I have very little experience with s-lang, so I'd
> appreciate pointers on how to start, in particular:
>
> 1. What's the best way to test the Newsgroups header against a list?
>
> 2. How do I add a header before the editor is launched?
>
> 3. Does a hook registered with post_hook run before the editor is
>    launched?

Yes.

Not sure exactly what headers you want to include etc, but this may
help:

define post_hook ()
{
set_string_variable ("custom_headers", "X-Custom: custom info");
}

But that does not help customise based on what group you are in.
Here's another one where you can change your sig depending on what group
you are in.  It's not based on post_hook, but article_mode_hook.  Note
that it is not exactly what you asked for, since it doesn't scan for
the Newsgroups: headers as such, but rather uses the current_group
function once you are in a group.  This works for me because I don't
post from group mode.

define make_group_specific_settings ()
{
  if (is_substr (current_newsgroup (), "alt.specific.group"))
    {
      sig = "/home/troy/.signature/specific.signature";
      set_string_variable ("custom_headers", "X-Custom: custom info1");
    }
  else
    {
      sig = "/home/troy/.signature/default.signature";
      set_string_variable ("custom_headers", "X-Custom: custom info2");
    }
  set_string_variable ("signature", sig);
}

() = register_hook ("article_mode_hook", "make_group_specific_settings");

Look at the slrnfuns.txt file (/usr/local/share/docs/slrn/slrnfuns.txt
here I think).  It has fairly good explanations of the above.

-- 
Troy Piggins :                            "My karma just ran over my dogma"
 ,-o  
o   ) Ubuntu linux 6.06 http://ubuntu.com  RLU#415538 http://counter.li.org
 `-o  uptime: 07:50:11 up 17 days,4:57,2 users,load average:0.00,0.00,0.00
Technical Details
Message-ID: <20060621075011@usenet.piggo.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.20140922.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nntp.waia.asn.au!203.59.27.186.MISMATCH!newsfeed.iinet.net.au!newsfeed.iinet.net.au!per-qv1-newsstorage1.iinet.net.au!per-qv1-newsstorage1.iinet.net.au!per-qv1-newsreader-01.iinet.net.au!not-for-mail
References: <f0alm3-ilu.ln1@news.ducksburg.com>

Show Full Headers
Complete Article Headers
Message-ID: <20060621075011@usenet.piggo.com>
Subject: Re: [slrn] How to add a custom header for specific groups only?
Date: Wed, 21 Jun 2006 08:04:30 +1000
From: Troy Piggins <usenet-0606@piggo.com>
References: <f0alm3-ilu.ln1@news.ducksburg.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.20140922.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nntp.waia.asn.au!203.59.27.186.MISMATCH!newsfeed.iinet.net.au!newsfeed.iinet.net.au!per-qv1-newsstorage1.iinet.net.au!per-qv1-newsstorage1.iinet.net.au!per-qv1-newsreader-01.iinet.net.au!not-for-mail
Newsgroups: news.software.readers
Reply-To: usenet-0606@piggo.com
User-Agent: slrn/0.9.8.1/rt (Linux)
Lines: 59
NNTP-Posting-Host: 203.206.109.220
X-Trace: 1150843831 per-qv1-newsreader-01.iinet.net.au 12274 203.206.109.220