Article View: news.software.readers
Article #259963Re: [slrn] Automattic subject modification
From: J.B. Nicholson
Date: Thu, 14 Jan 2016 03:40
Date: Thu, 14 Jan 2016 03:40
78 lines
4125 bytes
4125 bytes
Doug713705 <doug.letough@free.fr> wrote: > 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. Then you'll want to spend some time experimenting with slsh (an S-Lang shell) and reading http://www.jedsoft.org/slang/doc/html/slangfun.html which is the S-Lang intrinsic function documentation. There's a whole section called "Functions that Operate on Strings" in http://www.jedsoft.org/slang/doc/html/slangfun-5.html which is helpful. Chop up strings with strchop() & strchopr(), and get to portions of strings using array syntax: #v+ slsh> a="hello world"; slsh> char(a[0]); h slsh> char(a[1]); e #v- Try using string_match() for matching a string against a regular expression. Try using "+" for string concatenation, or strcat(). Consider reading and posting to the slang-users mailing list (visit http://jedsoft.org/slang/mailinglists.html for information) or visiting alt.lang.s-lang if your server carries it, since some of what you're asking are really S-Lang questions. > 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. If you capture the entire article you want to modify in a variable with article_as_string(), you could use that variable's contents later to undo your changes (see what I say about toggling the subject tagging later). Then identify where in the article string the subject header appears (the array indices which cover the entire Subject: header), you can build a new string which contains all of the text up to the subject header, append a new subject header of your choice, and then append all of the text after the newline. Now you'd have an article with a modified subject header. You could experiment with this in slsh merely by mocking up an article in a string. This approach would let you focus on doing this one small task, then bring that knowledge into your slrn macro when you're ready: #v+ slsh> article="From: user@somewhere.invalid\nSubject: some subject here\n\nBody text here\n"; #v- or #v+ slsh> article="Subject: some subject here\nFrom: user@somewhere.invalid\n\nBody text here\n"; #v- for instance. Then when you've got that header modified, you could replace the entire article with your modified version (via replace_article()) and let the user run slrn's followup or reply intrinsics in the ordinary way. This would let you leverage the code that's already in slrn and not require using any hooks. You could also bind a key to a function that would restore the article to it's original state if you want to toggle on/off the subject tagging.
Technical Details
Message-ID:
<slrnn9e654.h97.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-mailReferences:
<n742hs$8j2$1@golgoth98.redatomik.org> <slrnn9b613.39r.jbn@forestfield.org> <n7554d$olo$1@golgoth98.redatomik.org>Show Full Headers
Complete Article Headers
Message-ID: <slrnn9e654.h97.jbn@forestfield.org> Subject: Re: [slrn] Automattic subject modification Date: Thu, 14 Jan 2016 03:40:20 +0000 From: "J.B. Nicholson" <jbn@forestfield.org> References: <n742hs$8j2$1@golgoth98.redatomik.org> <slrnn9b613.39r.jbn@forestfield.org> <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 Newsgroups: news.software.readers Organization: albasani.net Lines: 78 X-Trace: news.albasani.net 6INBAwK3nprgjumNq6WLqcgaHd2XW4MMRvfoaMqcuhxaTlcXYQkj7qFOQG8R98bbehTRhfYLeF79zXtf1R0vtw== NNTP-Posting-Date: Thu, 14 Jan 2016 03:40:20 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="GGgmfA+Xb2l6cDbOHeBvCeP2fUNQf8IapZ6oQhJVN/3jqx45tocYqJ5cNR7Nsi3TWm96keEJaszKfHwIPUU+TIsaiV9b3cy8C1W3yDuLQ1/lhfypFo4kmF38yNKiLRjz"; mail-complaints-to="abuse@albasani.net" User-Agent: slrn/1.0.2 (Linux) Cancel-Lock: sha1:93iZ7hMdkVRxVZx5G/s4QRuyNS4= X-Received-Bytes: 3988 X-Received-Body-CRC: 958945442