🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #259955

Re: [slrn] Automattic subject modification

#259955
From: J.B. Nicholson
Date: Wed, 13 Jan 2016 00:19
63 lines
4083 bytes
Doug713705 <doug.letough@free.fr> wrote:
> Typically, when a post is selected and displayed I'd like to press a 
> key that allow me to edit an answer to that post but with a modified 
> subject like "[tag] actual post subject".

Sounds like you want to send a reply or post a followup with a subject
header based on the post's subject header.

You could do this with a macro that uses a hook (a function which is
always run before or after some event):

- post_filter_hook() -- called when you use the "F"ilter option at the
  "Post the message?" prompt. If you haven't seen this option when
  posting, it's probably because you don't have any post_filter_hook
  functions defined.

- post_hook() and reply_hook() -- called when posting/replying-to an
  article. If you want to run *every* post you make through some
  function, these hooks give you what you need to do that job.  But
  you'll have no interactive means of deciding to avoid running your
  post through the filter 'just this once' (the bit about initiating
  your subject change via pressing a key like you mentioned).

> I'm totally noob with slang but I looked at macros provided with slrn 
> and others from the slrn web site but none of them modify the subject 
> header and I found no suitable hook or intrinsic functions in the 
> slrnfuns.txt.

S-Lang isn't hard to learn or use. If you have any programming
experience you'll catch on to it quickly. To get used to S-Lang you
might start with something simple, like making slrn show a message
each time you resize the screen (which means using the
resize_screen_hook()):

#v+
% Define a simple function to print a message. This function takes
% no arguments (hence the "()" empty argument list).
define print_my_message () { message ("foo!"); }

% Make slrn run the simple function each time you resize the screen.
ifnot (register_hook ("resize_screen_hook", "print_my_message"))
{
   message ("Cannot register print_my_message() with resize_screen_hook!");
}
#v-

Check out http://slrn.sourceforge.net/docs/slrnfuns-7.html for docs on
slrn's intrinsic functions like register_hook().

The "#v+" and "#v-" are, if I recall correctly, slrn's markup for
showing some lines of a post verbatim -- no modification for
collapsing quoted lines and other effects. Typically one uses these
marks in cases like these where one wants to mix code and prose.

Getting back to your request: There's nothing special about the
Subject: header, it's just like any other header. That means you could
parse out the header from looking at the post file line by line from
the start of the post (stopping when you come across "\n\n" as that's
the header-body separator) and then modify the subject in your editor
(in which case you'd look to writing some code for your editor, not
writing code for slrn), or you could look at slrn macros that do
something to posts/replies before they're sent out and learn from that
code.
Technical Details
Message-ID: <slrnn9b613.39r.jbn@forestfield.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.(126883).mbox.7z!not-for-mail
References: <n742hs$8j2$1@golgoth98.redatomik.org>

Show Full Headers
Complete Article Headers
Message-ID: <slrnn9b613.39r.jbn@forestfield.org>
Subject: Re: [slrn] Automattic subject modification
Date: Wed, 13 Jan 2016 00:19:48 +0000
From: "J.B. Nicholson" <jbn@forestfield.org>
References: <n742hs$8j2$1@golgoth98.redatomik.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.(126883).mbox.7z!not-for-mail
Newsgroups: news.software.readers
Organization: albasani.net
Lines: 63
X-Trace: news.albasani.net pjx04HBiW7bcCf71TS6uPqYNgkzeOYSEHgs8qNqn6LMjpaRPmz1vIvReFKtzTdYnki2U0ZW28lDB941L1PuPVw==
NNTP-Posting-Date: Wed, 13 Jan 2016 00:19:48 +0000 (UTC)
Injection-Info: news.albasani.net; logging-data="pEEN/FmmAnPwZsDfT8MuSa5Mk9UNMm6BnprmllRI/2kLuXCn8y+2kZwuKTJ0QUm7CuydTJHu5ZV5P/TkXdhm6QV8MAsWx9jHupFEeZB73rnzuMN2j+0J/SRQ5REX/Itt"; mail-complaints-to="abuse@albasani.net"
User-Agent: slrn/1.0.2 (Linux)
Cancel-Lock: sha1:DfeshNYfgVCtxAcXNnrSbEhBpdU=
X-Received-Bytes: 3898
X-Received-Body-CRC: 2512983908