🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #49538

Re: Multiple perso. in slrn

#49538
From: Anonymous
Date: Tue, 29 Jun 1999 00:00
104 lines
3334 bytes
On Tue, 29 Jun 1999 22:01:38 +0200, Gerbrand van Dieijen wrote:
> Is there a way to have multiple personalities in slrn, different ones per
> group?

ITYM different names, slrn is good but I don't think, even if you /really/
want to change, that it can change your personality.

There are two ways, AFAIK. I'm sure someone will ppost one, so I will do the
other. Both use a little s-lang...

In your slrn.sl, or whatever is executed at startup:


define SetFromAddress(strNewsgroups)
{
  if (is_substr (strNewsgroups, "alt.devilbunnies"))
  {
    set_string_variable ("realname", "Bugs Moron");
  }
  else
  {
    set_string_variable ("realname", "Gary Jones");
  }
}

define SetNameByNG (file)
{
  variable  header_file, body_file;
  variable  fp, header_fp, body_fp;
  variable  line;
  variable  strNewsgroups;
   
  fp = fopen (file, "r");
  if (fp == NULL)
    return;

  header_file = file + "-header";
  body_file = file + "-body";
   
  header_fp = fopen (header_file, "w");
  body_fp = fopen (body_file, "w");
  if ((header_fp == NULL) or (body_fp == NULL))
    return;

  while (-1 != fgets (&line, fp))
  {
    if (line == "\n")
    {
      break;
    }
    else
    {
      if  (is_substr(line, "Newsgroups: "))
      {
        strNewsgroups = substr(line, 
	                       strlen("Newsgroups: ")+1,
                               strlen(line) - strlen("Newsgroups: ") - 1);

        % just setting the realname variable is fine at this point,
        % as no From line has yet been written
        SetFromAddress(strNewsgroups);
      }
    }

    () = fputs (line, header_fp);
  }

  () = fclose (header_fp);

  % Now do body
  while (-1 != fgets (&line, fp))
  {
    () = fputs (line, body_fp);
  }

  () = fclose (body_fp);

  fp = fopen (file, "w");
  body_fp = fopen (body_file, "r");
  header_fp = fopen (header_file, "r");

  while (-1 != fgets (&line, header_fp))
    () = fputs (line, fp);
    
  () = fputs ("\n", fp);

  while (-1 != fgets (&line, body_fp))
    () = fputs (line, fp);

  % No need to close files unless we want to check for errors.  When
  % file pointer variables go out of scope, slang will close the file.
}

define post_file_hook(file)
{
  SetNameByNG(file);
}


The other method, which uses the current_newsgroup variable (?) doesn't work
if you post from the group list - this can be a bit embrassing :-/


Technical Details
Message-ID: <199906292142.XAA31586@mail.replay.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
References: <slrn7ni9h2.afj.gerbrand@twisted.demon.nl>

Show Full Headers
Complete Article Headers
Message-ID: <199906292142.XAA31586@mail.replay.com>
Subject: Re: Multiple perso. in slrn
Date: Tue, 29 Jun 1999 00:00:00 +0000
From: Anonymous <nobody@replay.com>
References: <slrn7ni9h2.afj.gerbrand@twisted.demon.nl>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
X-Deja-AN: 495354094
X-Originally-From: Gary Jones
Organization: mail2news@replay.com
Comments: This message did not originate from the Sender address above. It was remailed automatically by anonymizing remailer software. Please report problems or inappropriate use to the remailer administrator at <abuse@replay.com>.
X-Mail-To-News-Contact: postmaster@replay.com
Newsgroups: news.software.readers