🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
9 messages
9 total messages Started by Zebee Johnstone Mon, 23 Mar 1998 00:00
[slrn] changing from line per newsgroup?
#39734
Author: Zebee Johnstone
Date: Mon, 23 Mar 1998 00:00
11 lines
783 bytes
I'd like to have some macro or definition in slrn that
changes the "from" line depending on the newsgroup.

Just want to change the realname field.

Is this possible?  

Zebee

Re: [slrn] changing from line per newsgroup?
#39719
Author: Jan Hlavacek
Date: Mon, 23 Mar 1998 00:00
46 lines
2592 bytes
On 23 Mar 1998 06:58:07 GMT, Zebee Johnstone
<zebee@lute.orchestra.cse.unsw.EDU.AU> wrote:
> On 23 Mar 1998 06:25:04 GMT, Jan Hlavacek wrote:
> >
> >Or you can use post_hook and followup_hook,  and it will always work.
> >
> >      define post_hook ()
> >      {
> >	 variable newsheader = extract_article_header ("Newsgroups:");
> 
> Which gives me an error:
> 
> Reading startup file /home1/zebee/.slrnrc.
> S-Lang Error: extract_article_header: Undefined Name
> S-Lang Error: : Undefined Name
> S-Lang Error: at or before line 3: file: /home1/zebee/.slrn.sl: Undefined Name
> 
> And the previous one whinged about "realname" not being a variable.
> 
> .slrn.sl was cut and pasted from the article, and I just changed:
> 
>       define post_hook ()
>       {
>          variable newsheader = extract_article_header ("Newsgroups:");
>          if (is_substr (newsheader, "zip")
>             or is_substr (newsheader, "test"))
> 
> zipper:~$ slrn --version
> slrn version: 0.9.0.0 (BETA) (Sep  5 1996 00:23:12)

With this version,  you are kind of out of luck.  This was the last
version of slrn which didn't have extract_article_header function and
which didn't have realname variable.  Both were introduced in 0.9.1.0.
The latest version is 0.9.4.6,  which requires s-lang version 1.0 or
later.  Version 0.9.3.0 (which you used to post your article,  unless
your X-Newsreader header is wrong) can be compiled with older slang.

lahvak
-- 
Jan Hlav\'{a}\v{c}ek <lahvak@math.mps.ohio-state.edu>  (BCC's will bounce)
home page: http://www.math.ohio-state.edu/~lahvak/
slrn page: http://www.math.ohio-state.edu/~lahvak/software/slrn.html
slrn documentation: http://www.math.ohio-state.edu/~lahvak/software/slrn/

Re: [slrn] changing from line per newsgroup?
#39720
Author: Preben 'Peppe' Guldberg
Date: Mon, 23 Mar 1998 00:00
43 lines
2043 bytes
Thus wrote Zebee Johnstone <zebee@lute.orchestra.cse.unsw.EDU.AU>:
> I'd like to have some macro or definition in slrn that
> changes the "from" line depending on the newsgroup.

> Just want to change the realname field.

> Is this possible?  

You can do this with article_mode_hook. This is defined in a file (eg
.slrn.sl) that is read while reading .slrnrc if you have the following
line in .slrn.rc

    interpret .slrn.sl

A fictive example for me with a couple of names that applies in groups
with either "dk" or "denmark" in the name:

    define article_mode_hook ()
    {
        if (is_substr (current_newsgroup (), "dk")
            or is_substr (current_newsgroup (), "denmark"))
        { 
            set_string_variable ("realname", "Peppe");
        }
        else
        {
            set_string_variable ("realname", "Preben Guldberg");
        }
    }


Note: you must enter the group where you want to post or the hook will
not apply.

Peppe
-- 
Preben Guldberg          __/-\__        The woods are lovely, dark and deep
c928400@student.dtu.dk    (o o)         But I have promises to keep
----------------------oOOo (_) oOOo--   And miles to go before I sleep.
http://www.student.dtu.dk/~c928400                           --Robert Frost

Re: [slrn] changing from line per newsgroup?
#39724
Author: Zebee Johnstone
Date: Mon, 23 Mar 1998 00:00
32 lines
1688 bytes
On 23 Mar 1998 06:25:04 GMT, Jan Hlavacek wrote:
>
>Or you can use post_hook and followup_hook,  and it will always work.
>
>      define post_hook ()
>      {
>	 variable newsheader = extract_article_header ("Newsgroups:");

Which gives me an error:

Reading startup file /home1/zebee/.slrnrc.
S-Lang Error: extract_article_header: Undefined Name
S-Lang Error: : Undefined Name
S-Lang Error: at or before line 3: file: /home1/zebee/.slrn.sl: Undefined Name

And the previous one whinged about "realname" not being a variable.

.slrn.sl was cut and pasted from the article, and I just changed:

      define post_hook ()
      {
         variable newsheader = extract_article_header ("Newsgroups:");
         if (is_substr (newsheader, "zip")
            or is_substr (newsheader, "test"))

zipper:~$ slrn --version
slrn version: 0.9.0.0 (BETA) (Sep  5 1996 00:23:12)
S-Lang version: 0.99.34


Re: [slrn] changing from line per newsgroup?
#39730
Author: Jan Hlavacek
Date: Mon, 23 Mar 1998 00:00
72 lines
2901 bytes
On 23 Mar 98 04:14:10 GMT, Preben 'Peppe' Guldberg
<c928400@student.dtu.dk> wrote:
> Thus wrote Zebee Johnstone <zebee@lute.orchestra.cse.unsw.EDU.AU>:
> > I'd like to have some macro or definition in slrn that
> > changes the "from" line depending on the newsgroup.
> 
> > Just want to change the realname field.
> 
> > Is this possible?  
> 
> You can do this with article_mode_hook. This is defined in a file (eg
> .slrn.sl) that is read while reading .slrnrc if you have the following
> line in .slrn.rc
> 
>     interpret .slrn.sl
> 
> A fictive example for me with a couple of names that applies in groups
> with either "dk" or "denmark" in the name:
> 
>     define article_mode_hook ()
>     {
>         if (is_substr (current_newsgroup (), "dk")
>             or is_substr (current_newsgroup (), "denmark"))
>         { 
>             set_string_variable ("realname", "Peppe");
>         }
>         else
>         {
>             set_string_variable ("realname", "Preben Guldberg");
>         }
>     }
> 
> 
> Note: you must enter the group where you want to post or the hook will
> not apply.

Or you can use post_hook and followup_hook,  and it will always work.

      define post_hook ()
      {
	 variable newsheader = extract_article_header ("Newsgroups:");
	 
	 if (is_substr (newsheader, "dk")
	     or is_substr (newsheader, "denmark"))
	 { 
	     set_string_variable ("realname", "Peppe");
	 }
	 else
	 {
	     set_string_variable ("realname", "Preben Guldberg");
	 }
      }

      define followup_hook ()
      {
	 post_hook ();
      }

This gets executed every time you post,  so unless you change the
Newsgroups: header when you edit the message,  you always get the right
from line regardles how you posted.  Also,  it gives you more
flexibility when you crosspost to several nesgroups.  

lahvak
-- 
Jan Hlav\'{a}\v{c}ek <lahvak@math.mps.ohio-state.edu>  (BCC's will bounce)
home page: http://www.math.ohio-state.edu/~lahvak/
slrn page: http://www.math.ohio-state.edu/~lahvak/software/slrn.html
slrn documentation: http://www.math.ohio-state.edu/~lahvak/software/slrn/

Re: [slrn] changing from line per newsgroup?
#39765
Author: Jan Hlavacek
Date: Wed, 25 Mar 1998 00:00
16 lines
1411 bytes
On 25 Mar 1998 09:42:01 GMT, Zebee Johnstone <zebee@zipper.zip.com.au>
wrote:
>       define post_hook ()
>       {
>          variable newsheader = extract_article_header ("Newsgroups:");
                                                                    ^
Sorry,  my mistake. Should be "Newsgroups",  without the colon.  

lahvak
-- 
Jan Hlav\'{a}\v{c}ek
lahvak@math.mps.ohio-state.edu  (Blind Carbon Copies will bounce)
www: http://www.math.ohio-state.edu/~lahvak/ 

Re: [slrn] changing from line per newsgroup?
#39774
Author: Zebee Johnstone
Date: Wed, 25 Mar 1998 00:00
78 lines
3023 bytes
On 23 Mar 1998 07:57:28 GMT, 
Jan Hlavacek <lahvak@math.mps.ohio-state.edu> wrote:
>On 23 Mar 1998 06:58:07 GMT, Zebee Johnstone
>
>With this version,  you are kind of out of luck.  This was the last
>version of slrn which didn't have extract_article_header function and
>which didn't have realname variable.  Both were introduced in 0.9.1.0.
>The latest version is 0.9.4.6,  which requires s-lang version 1.0 or
>later.  Version 0.9.3.0 (which you used to post your article,  unless
>your X-Newsreader header is wrong) can be compiled with older slang.

OK.. here we are on the slrn I wanted this to work with, and
it's been upgraded:
zipper:~$ slrn --version
Slrn Version: 0.9.4.6 (Mar 25 1998 18:12:46)
S-Lang Library Version: 1.0.3
OS-Type: Unix

slrn compiled with support for:
        character set mapping
        nntp (SLtcp socket code)
        spool
        inews
        slrnpull
        S-Lang Macros

Default server object: nntp
Default posting mechanism: nntp
Supported character sets include:
        ISOLatin
        ibm850
        NeXT
Default character set: isolatin

HEre is a test I made which didn't work:
Path: the-fly.zip.com.au!zebee
From: zebee@zipper.zip.com.au (Zebee Johnstone)
Newsgroups: zip.test
Subject: mmhmm?
Date: 25 Mar 1998 08:53:28 GMT
Organization: Zip Internet Professionals Pty Ltd
Lines: 2
Message-ID: <slrn6hhhju.3to.zebee@zipper.zip.com.au>
NNTP-Posting-Host: 203.12.97.1
X-Newsreader: slrn (0.9.4.6 UNIX)
Xref: the-fly.zip.com.au zip.test:962

And here is my .slrn.sl, which is being loaded according to the slrn
startup

zipper:~$ more .slrn.sl
      define post_hook ()
      {
         variable newsheader = extract_article_header ("Newsgroups:");
         if (is_substr (newsheader, "zip")
            or is_substr (newsheader, "test"))

         {
             set_string_variable ("realname", "Testing");
         }
         else
         {
             set_string_variable ("realname", "Zebee Johnstone");
         }
      }
 define followup_hook ()
      {
         post_hook ();
      }

If I set realname to Testing in .slrnrc, it works.  But the macro
doesn;'t seem to.

Zebee


Re: [slrn] changing from line per newsgroup?
#39918
Author: lottifran
Date: Sat, 04 Apr 1998 00:00
27 lines
2128 bytes
On 25 Mar 1998 20:20:30 GMT, Jan Hlavacek <lahvak@math.mps.ohio-state.edu> 
wrote:
>On 25 Mar 1998 09:42:01 GMT, Zebee Johnstone <zebee@zipper.zip.com.au>
>wrote:
>>       define post_hook ()
>>       {
>>          variable newsheader = extract_article_header ("Newsgroups:");
>                                                                    ^
>Sorry,  my mistake. Should be "Newsgroups",  without the colon.  

Anyway seems that your function doesn't work very well for me..
Only if I make a followup to an article the function works without problem,
while if I post a new article "extract_article_header" always exits with a
null string.
I have slrn 0.9.4.3 and slang 0.99.38.
Suggestions?

ciao,
-- 
          **** To reply remove +!XXX! from the address ****
 [ Francesco L. <goo@ouverture.it>       ][ Powered by Linux 2.0.33 ]
 [ Alternate address: didefault@usa.net  ][ http://goo.home.ml.org  ]
 [ Dynamic hostname: artemide.dyn.ml.org ][ ICQ UIN: 5529483        ]
 [ To get my PGP PUBLIC KEY send a message to goo+PGP@ouverture.it  ]

Re: [slrn] changing from line per newsgroup?
#39924
Author: Jan Hlavacek
Date: Sat, 04 Apr 1998 00:00
51 lines
2785 bytes
On 4 Apr 1998 01:47:42 GMT, lottifran <goo+!XXX!@ouverture.it> wrote:
> Anyway seems that your function doesn't work very well for me..
> Only if I make a followup to an article the function works without problem,
> while if I post a new article "extract_article_header" always exits with a
> null string.

Which isn't surprising,  after looking at the source code.  Slrn calls
post_hook _before_ it asks you for newsgroup,  and rightly so,  as this
allow to set newsgroup and subject from the hook.  Anyway,  this should
finally work:

define post_hook ()
{
   variable user_wants_confirm = get_variable_value ("confirm_actions");
   variable yn, subject;
   variable group = current_newsgroup ();

   if (user_wants_confirm) 
   {
      yn = tolower (
	 get_response ("yYnN\r", 
	               "Are you sure you want to post? [\001Y]es \001No"));
      if (yn == 'n') 
      {
	 set_input_chars ("n");
	 return;
      }
      else set_input_chars ("y");
   }
   group = read_mini ("Newsgroup", "", group);
   subject = read_mini ("Subject", "", "");
   % set_input_string (group + "\n" + subject); % for s-lang >1.0
   set_input_string (Sprintf ("%s\n%s", group, subject, 2));

   if (is_substr (group, "test"))
      set_string_variable ("custom_headers", "X-bla: bla");
   else set_string_variable ("custom_headers", "");
}

It would be nice if read_mini start with cursor at the end of line just
as slrn builtin prompt does.

lahvak
-- 
Jan Hlav\'{a}\v{c}ek <lahvak@math.mps.ohio-state.edu>  (BCC's will bounce)
home page: http://www.math.ohio-state.edu/~lahvak/
slrn page: http://www.math.ohio-state.edu/~lahvak/software/slrn.html
slrn documentation: http://www.math.ohio-state.edu/~lahvak/software/slrn/

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