🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #259952

Re: [slrn] Automattic subject modification

#259952
From: Doug713705
Date: Wed, 13 Jan 2016 09:24
72 lines
4760 bytes
Hello J.B,

Le 13-01-2016, J.B. Nicholson nous expliquait dans 
news.software.readers
(<slrnn9b613.39r.jbn@forestfield.org>) :

> - 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).

That exactly the point. I don't want the subject be tagged on every post 
but only when needed and that's why at first I was looking for another 
hook than the reply_hook().

>> 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()):

[SNIP sample code]

I already succeeded in displaying the subject or any header's content by 
getting it with the extract_displayed_article_header() function and 
displaying it with the message() function but I found no way to replace 
the subject header of the reply.

My guess was, when a dedicated key is pressed (not the 'f' key or the 
'p' key), to get the subject header content with 
extract_displayed_article_header() (this part is already working like a 
charm), modify it and then call the reply_hook() so the editor receive 
the article as ususal but with a modified subject header.

At this point I can get the subject content, I can modify it but I don't 
know where to store it (with a function that could have been called 
set_selected_article_header()) so the editor get the modified version.

I also tried to pipe the article to an external program with the 
pipe_article() function. No succes at the moment but it was late and 
I was tired.

> 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.

I looked over all macros but did not found what I was looking for, that 
why I posted here. I may look for something impossible or have 
overlooked something. The closest macros to what I'm looking for is the 
indentity.sl but it only change some variable (from, reply-to, ...) 
that are used after that. This macro doe not modify the selected 
article before passing it to the editor which is what I' trying 
to do (right or wrong).

-- 
Je ne connaîtrai rien de tes habitudes
Il se peut même que tu sois décédée
Mais j'demanderai ta main pour la couper
                    -- H.F. Thiéfaine, L'ascenceur de 22H43
Technical Details
Message-ID: <n7554d$olo$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
References: <n742hs$8j2$1@golgoth98.redatomik.org> <slrnn9b613.39r.jbn@forestfield.org>

Show Full Headers
Complete Article Headers
Message-ID: <n7554d$olo$1@golgoth98.redatomik.org>
Subject: Re: [slrn] Automattic subject modification
Date: Wed, 13 Jan 2016 09:24:29 +0000
From: Doug713705 <doug.letough@free.fr>
References: <n742hs$8j2$1@golgoth98.redatomik.org> <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
Newsgroups: news.software.readers
Organization: Les cassoulets tropicaux reunis
Lines: 72
Sender: doug.letough@free.fr
Reply-To: Doug Le Tough <doug.letough@free.fr>
NNTP-Posting-Host: golgoth98.redatomik.org
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: 8bit
X-Trace: golgoth98.redatomik.org 1452677069 25272 195.154.70.45 (13 Jan 2016 09:24:29 GMT)
X-Complaints-To: abuse@redatomik.org
NNTP-Posting-Date: Wed, 13 Jan 2016 09:24:29 +0000 (UTC)
User-Agent: slrn/pre1.0.0-18 (Linux)
X-Face: 'Sh}&9(gyOf[,6&8(Gv#k(:g=wUCLP}b#oqMPkLKpV"|y1TatXGYTh.jK\!@!&OsR}'~a
 %D7>:N$)5?\hx$?7Vu5U}GgJaY[&Hb!ThY_TB}.EsQn%JD4k<<)V_f*]P'FM<BJz{NJ$d<3S1<D*{
 ,0^l<z&NxluMUHA<c
X-Received-Body-CRC: 2142739957
X-Received-Bytes: 4717