🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
12 messages
12 total messages Started by Lewis Fri, 08 Jan 2016 15:30
[slrn] Modify signature based on newsgroup
#259901
Author: Lewis
Date: Fri, 08 Jan 2016 15:30
19 lines
1568 bytes
I have a script that uses fortune to generate a .signature file, and
that gets included with my posts (as below) as well as attached to my
emails and such. the script is run outside of slrn (vi cron).

Would it be possible to do something like the following:

if posting to newsgroup [alt.foo]
   append .foo_signature
   append .signature
else if posting to [alt.bar.bork.bork.bork]
   append .bork_sig
   append .signature
else
   append .signature

TIA

-- 
The reaper does not listen to the harvest. --Reaper Man
Re: [slrn] Modify signature based on newsgroup
#259902
Author: Adam Funk
Date: Fri, 08 Jan 2016 17:04
42 lines
2158 bytes
On 2016-01-08, Lewis wrote:

> I have a script that uses fortune to generate a .signature file, and
> that gets included with my posts (as below) as well as attached to my
> emails and such. the script is run outside of slrn (vi cron).
>
> Would it be possible to do something like the following:
>
> if posting to newsgroup [alt.foo]
>    append .foo_signature
>    append .signature
> else if posting to [alt.bar.bork.bork.bork]
>    append .bork_sig
>    append .signature
> else
>    append .signature

The identity.sl stuff lets you do that, although it's a bit ugly
compared with your pseudocode; you put the following in '~/.slrnrc':

interpret ".slrn/identity.sl"
interpret ".slrn/my_identities.sl"

& stuff like the following in the 'my_identities.sl' file:

identity->add_new("alt", "^alt\.");
identity->set_signature("alt", ".slrn/sigs/alt.sig");

identity->clone("alt", "comp");
identity->set_regexp("comp", "^comp\.");
identity->set_signature("comp", ".slrn/sigs/comp.sig");
....


You can also use it to use different From headers in different
hierarchies.  This is old stuff, & if anyone has a more elegant way to
do it, I'd like to know too.


-- 
If hard data were the filtering criterion you could fit the entire
contents of the Internet on a floppy disk.         --- Cecil Adams
Re: [slrn] Modify signature based on newsgroup
#259907
Author: J.B. Nicholson
Date: Sat, 09 Jan 2016 06:03
29 lines
2243 bytes
Lewis <g.kreme@gmail.com.dontsendmecopies> wrote:
> Would it be possible to do something like the following:
>
> if posting to newsgroup [alt.foo]
>    append .foo_signature
>    append .signature

With a macro, yes. Check out
http://slrn.sourceforge.net/docs/slrn-FAQ-2.html#ss2.8 which refers to
identity.sl (which you can get from
http://slrn.sourceforge.net/macros/identity.sl).

Since your setup handles changing the content of .signature externally
to slrn, I think the only part you'll need some code changes to handle
have to do with appending another file before .signature and
re-reading the files in order each time you need to generate a new
signature.

Perhaps if you made

  identity->set_signature ("id", "/path/to/.signature");

take an arbitrary number of file arguments, you could have
set_signature() append them all and set that signature, and then have
the post and followup hooks handle re-reading from these file(s) so
slrn gets a new signature with each post or followup.

I haven't taken a close enough look at the code to see if that's the
best strategy, but I'm guessing it's fairly close.
Re: [slrn] Modify signature based on newsgroup
#259919
Author: rj
Date: Sun, 10 Jan 2016 05:23
36 lines
1986 bytes
On Fri, 08 Jan 2016 17:04:19 +0000, Adam Funk <a24061@ducksburg.com> wrote:
>
> The identity.sl stuff lets you do that, although it's a bit ugly


Very, and examples are few.  If I want my "From:" address to be:

"From: rj <rj@poonix.com>"

in, say, all the misc.* groups, instead of:

"From: rj <rj@poonix.com.invalid>"

(which is what I want in all groups *other* than the misc hierarchy),
what do I put in the "my_identities.sl" file?  Right now I have

identity->add_new ("rj\@poonix\.com", "misc\.*");

and ESC-I (entered while I'm inside a "misc.*" group) still shows:

"From: rj <rj@poonix.com.invalid>"

at the top of the "Identity on misc.*" box that ESC-I brings up, but
toward the bottom of the box, I see:

Current ID: New Identity ('rj@panix.com')
Matching RE: misc.*

and when I try to post or follow-up in a misc.* group, the "invalid"
is still in my address in the "From:" header.

Reading through the "identities.sl" file, it's not at all obvious how
this is to be done, AFAICT.

-- 
Air is water with holes in it.
Re: [slrn] Modify signature based on newsgroup
#259918
Author: Keith
Date: Sun, 10 Jan 2016 08:57
65 lines
3361 bytes
Did you make a sepearte file for your identities and include 
that in your .slrnrc file?

%%MACROS%%
set macro_directory "News/macros"
interpret "identity.sl"
interpret "my_id.sl"

then in my_id.sl file you create the new identity for those newsgroups:

%second id for newsreader
  
  identity->add_new ("slrn", "^news.software.reader");
  identity->set_from ("slrn", "kilowattradio", "gmail.com.REMOVE");
  identity->set_real ("slrn", "Keith");
  identity->set_replyto ("slrn", "reply-to");
  identity->set_signature ("slrn", "/home/USER/.signature2");
  identity->set_signoffstring ("slrn", "signoff_string");
  identity->set_followupstring ("slrn", "followup_string");
  identity->set_replystring ("slrn", "reply_string");
  identity->set_organization ("slrn", "\"Every Child should be a Wanted Child\"");
  identity->set_customheaders ("slrn", " ");
  identity->set_followupcustomheaders ("slrn", " ");
  identity->set_replycustomheaders ("slrn", "reply_custom_headers");
  identity->set_regexp ("slrn", "regular_expression");
  identity->set_saveto ("slrn", "file.txt");
  identity->set_description ("slrn", "slrn newsreader");


On 2016-01-10, rj <rj@panix.com.invalid> wrote:
> On Fri, 08 Jan 2016 17:04:19 +0000, Adam Funk <a24061@ducksburg.com> wrote:
>>
>> The identity.sl stuff lets you do that, although it's a bit ugly
>
>
> Very, and examples are few.  If I want my "From:" address to be:
>
> "From: rj <rj@poonix.com>"
>
> in, say, all the misc.* groups, instead of:
>
> "From: rj <rj@poonix.com.invalid>"
>
> (which is what I want in all groups *other* than the misc hierarchy),
> what do I put in the "my_identities.sl" file?  Right now I have
>
> identity->add_new ("rj\@poonix\.com", "misc\.*");
>
> and ESC-I (entered while I'm inside a "misc.*" group) still shows:
>
> "From: rj <rj@poonix.com.invalid>"
>
> at the top of the "Identity on misc.*" box that ESC-I brings up, but
> toward the bottom of the box, I see:
>
> Current ID: New Identity ('rj@panix.com')
> Matching RE: misc.*
>
> and when I try to post or follow-up in a misc.* group, the "invalid"
> is still in my address in the "From:" header.
>
> Reading through the "identities.sl" file, it's not at all obvious how
> this is to be done, AFAICT.
>
Re: [slrn] Modify signature based on newsgroup
#259922
Author: Lewis
Date: Sun, 10 Jan 2016 10:31
36 lines
2605 bytes
In message <n6t6di$440$1@dont-email.me> 
  Keith <kilowattradio@gmail.com.REMOVE> wrote:

> Did you make a sepearte file for your identities and include 
> that in your .slrnrc file?

> %%MACROS%%
> set macro_directory "News/macros"
> interpret "identity.sl"
> interpret "my_id.sl"

> then in my_id.sl file you create the new identity for those newsgroups:

> %second id for newsreader
>   
>   identity->add_new ("slrn", "^news.software.reader");
>   identity->set_from ("slrn", "kilowattradio", "gmail.com.REMOVE");
>   identity->set_real ("slrn", "Keith");
>   identity->set_replyto ("slrn", "reply-to");
>   identity->set_signature ("slrn", "/home/USER/.signature2");
>   identity->set_signoffstring ("slrn", "signoff_string");
>   identity->set_followupstring ("slrn", "followup_string");
>   identity->set_replystring ("slrn", "reply_string");
>   identity->set_organization ("slrn", "\"Every Child should be a Wanted Child\"");
>   identity->set_customheaders ("slrn", " ");
>   identity->set_followupcustomheaders ("slrn", " ");
>   identity->set_replycustomheaders ("slrn", "reply_custom_headers");
>   identity->set_regexp ("slrn", "regular_expression");
>   identity->set_saveto ("slrn", "file.txt");
>   identity->set_description ("slrn", "slrn newsreader");

Ah... thank you for that.


-- 
"If you can't do something smart, do something right."
Re: [slrn] Modify signature based on newsgroup
#259930
Author: rj
Date: Mon, 11 Jan 2016 02:34
8 lines
1242 bytes
On Sun, 10 Jan 2016 08:57:22 -0000 (UTC),
Keith <kilowattradio@gmail.com.REMOVE> wrote:
> then in my_id.sl file you create the new identity for those newsgroups:
> . . .
>   identity->add_new ("slrn", "^news.software.reader");
[etc.]

Tweaked and working.  Thanks.
Re: [slrn] Modify signature based on newsgroup
#259926
Author: Adam Funk
Date: Mon, 11 Jan 2016 10:43
18 lines
1427 bytes
On 2016-01-10, rj wrote:

> On Fri, 08 Jan 2016 17:04:19 +0000, Adam Funk <a24061@ducksburg.com> wrote:
>>
>> The identity.sl stuff lets you do that, although it's a bit ugly
>
>
> Very, and examples are few.

Yes, & it's a nuisance to test out experimentally.  I did say "if
anyone has a more elegant way to do it, I'd like to know too."



-- 
I used to be better at logic problems, before I just dumped
them all into TeX and let Knuth pick out the survivors.
                                              --- plorkwort
Re: [slrn] Modify signature based on newsgroup
#259977
Author: aitch
Date: Sat, 16 Jan 2016 07:08
65 lines
2937 bytes
J.B. Nicholson wrote:

> Lewis <g.kreme@gmail.com.dontsendmecopies> wrote:
>> Would it be possible to do something like the following:
>>
>> if posting to newsgroup [alt.foo]
>>    append .foo_signature
>>    append .signature
>
> With a macro, yes. Check out
> http://slrn.sourceforge.net/docs/slrn-FAQ-2.html#ss2.8 which refers to
> identity.sl (which you can get from
> http://slrn.sourceforge.net/macros/identity.sl).
>
> Since your setup handles changing the content of .signature externally
> to slrn, I think the only part you'll need some code changes to handle
> have to do with appending another file before .signature and
> re-reading the files in order each time you need to generate a new
> signature.
>
> Perhaps if you made
>
>   identity->set_signature ("id", "/path/to/.signature");
>
> take an arbitrary number of file arguments, you could have
> set_signature() append them all and set that signature, and then have
> the post and followup hooks handle re-reading from these file(s) so
> slrn gets a new signature with each post or followup.
>
> I haven't taken a close enough look at the code to see if that's the
> best strategy, but I'm guessing it's fairly close.

An easier way, would be to generate /all/ the sig files in one fell 
swoop.  E.g. to generate signatures for "foo" and "bork", as well as the 
default signature, get cron to run this (or something similar):

#v+
#!/bin/sh
# Generate signature files.

declare -A sigtxt
sigtxt=(
  [foo]='Text for foo sig.'
  [bork]='Text for bork sig.'
)
cmdout=$( /usr/games/fortune -s )

echo "$cmdout" > "$HOME/.signature"
for id in "${!sigtxt[@]}" ; do
  echo -e "${sigtxt[$id]}\n$cmdout" > "$HOME/.${id}_signature"
done
#v-

Then just assign the signatures to IDs in my_identities.sl:

#v+
identity->add_new("foo", "^alt\.foo$");
identity->set_signature("foo", "$HOME/.foo_signature"$);

identity->add_new("bork", "^alt\.bar\.bork\.bork\.bork$");
identity->set_signature("bork", "$HOME/.bork_signature"$);
#v-

-- 
aitch
Re: [slrn] Modify signature based on newsgroup
#259976
Author: Lewis
Date: Sat, 16 Jan 2016 13:45
47 lines
2539 bytes
In message <n7cq9n$kpd$1@news.mixmin.net> 
  aitch <foo@bar.invalid> wrote:
> An easier way, would be to generate /all/ the sig files in one fell 
> swoop.  E.g. to generate signatures for "foo" and "bork", as well as the 
> default signature, get cron to run this (or something similar):

Yeah, that is the way to go.

> #v+
> #!/bin/sh
> # Generate signature files.

> declare -A sigtxt
> sigtxt=(
>   [foo]='Text for foo sig.'
>   [bork]='Text for bork sig.'
> )

I've never seen that syntax. Interesting.

I just did a straight 

echo .bork_sig > .signature_bork
echo .foo_sig > .signature_foo
echo $(~/bin/fortune ~/mysigs) > .signature
echo .signature >> .signature_bork
echo .signature >> .signature_foo

But a loop is better.

> cmdout=$( /usr/games/fortune -s )

> echo "$cmdout" > "$HOME/.signature"
> for id in "${!sigtxt[@]}" ; do
>   echo -e "${sigtxt[$id]}\n$cmdout" > "$HOME/.${id}_signature"
> done
> #v-



-- 
IT IS NOT YET MIDNIGHT?  'I shouldn't think it's more than a quarter
past eleven.' THEN WE HAVE THREE-QUARTERS OF AN HOUR 'How can you be
sure?' BECAUSE OF DRAMA, MISS FLITWORTH.. THE KIND OF DEATH WHO POSES
AGAINST THE SKYLINE AND GETS LIT UP BY LIGHTNING FLASHES, said Bill
Door, disapprovingly, DOESN'T TURN UP AT FIVE-AND-TWENTY PAST ELEVEN IF
HE CAN POSSIBLY TURN UP AT MIDNIGHT.
Re: [slrn] Modify signature based on newsgroup
#259975
Author: aitch
Date: Sat, 16 Jan 2016 21:42
19 lines
1439 bytes
Lewis wrote:

> I've never seen that syntax. Interesting.

It's an associative array.  I thought it would be cleaner to keep the 
text inside the script, instead of reading from separate files.

> I just did a straight 
>
> echo .bork_sig > .signature_bork
> echo .foo_sig > .signature_foo
> echo $(~/bin/fortune ~/mysigs) > .signature
> echo .signature >> .signature_bork
> echo .signature >> .signature_foo

Shouldn't most of those echoes be cats?  :-)

-- 
aitch
Re: [slrn] Modify signature based on newsgroup
#259979
Author: Lewis
Date: Sun, 17 Jan 2016 02:58
24 lines
1904 bytes
In message <n7edgv$so8$1@news.mixmin.net> 
  aitch <foo@bar.invalid> wrote:
> Lewis wrote:

>> I've never seen that syntax. Interesting.

> It's an associative array.  I thought it would be cleaner to keep the 
> text inside the script, instead of reading from separate files.

>> I just did a straight 
>>
>> echo .bork_sig > .signature_bork
>> echo .foo_sig > .signature_foo
>> echo $(~/bin/fortune ~/mysigs) > .signature
>> echo .signature >> .signature_bork
>> echo .signature >> .signature_foo

> Shouldn't most of those echoes be cats?  :-)

Yeah, I was typing from memory. doh.

-- 
She floats like a swan
Grace on the water
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