🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #132544

Re: [slrn] date header format

#132544
From: Thomas Schultz
Date: Tue, 02 Sep 2003 21:31
72 lines
3448 bytes
* Dirk Nimmich [2003-08-31 10:15] :
[...]
> This is usually a design question. Should headers in the article pane
> display their actual content or somehow processed data? For the Date
> header in the article pane, slrn seems to follow the first paradigma.

That's correct.

However, slrn optionally allows the user to put arbitrary text into
the article pane using a macro, so you could use that feature to get
the desired effect (put the following into convdate.sl and "interpret"
that file from your slrnrc):

#v+
define date_header_to_localtime ()
{
   variable
     article = article_as_string(),
     i = is_substr (article, "\n\n"),
     header = article[[0:i-1]], % seperate header and body
     body = article[[i:]];

   % remove continuation lines from the header
   while (str_replace (header, "\n ", " "))
     header = ();
   while (str_replace (header, "\n\t", " "))
     header = ();
   
   % convert the header to an array of strings
   header = strtok (header, "\n");
   
   % find and replace the date header
   for (i=0; i < length(header); i++)
     {
	!if (strncmp (header[i], "Date:", 5))
	  {
	     variable time, time_s;
	     variable days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
	     variable months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
				"Jul", "Sep", "Oct", "Nov", "Dec"];
	     time = datestring_to_unixtime(substr(header[i],7,-1));
	     time_s = localtime (time);
	     header[i] = Sprintf("Date: %s, %02d %s %d %02d:%02d:%02d [converted to local time]",
				 days[time_s.tm_wday],
				 time_s.tm_mday,
				 months[time_s.tm_mon],
				 1900+time_s.tm_year,
				 time_s.tm_hour,
				 time_s.tm_min,
				 time_s.tm_sec,
				 7);
	  }
     }
   
   % join header to the body
   header = strjoin (header, "\n");
   article = strcat (header, "\n", body);
   
   % replace the selected article with our result
   replace_article (article);
}

!if (register_hook ("read_article_hook", "date_header_to_localtime"))
  message ("Warning: Could not register date_header_to_localtime" +
	   " for read_article_hook");
#v-
-- 
Thomas Schultz <tststs@gmx.de>  News on slrn: http://slrn.sf.net/news.html
.-----------------------------. [2003-08-25] Released slrn 0.9.8.0
| Home of the slrn newsreader | [2003-08-19] New slrn FAQ available
| http://slrn.sourceforge.net | [2003-07-31] First beta with offline reading
Technical Details
Message-ID: <slrnbla310.18l.tststs@moonlight.tststs.ddns.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.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!feed.news.nacamar.de!fu-berlin.de!uni-berlin.de!acb063dc.ipt.aol.COM!not-for-mail
References: <slrnbl1r1e.3iq.dcmoose@moosemeat.localhost.ca> <l8p721-e2p.ln1@news.gates_of_hell.INVALID> <bishrg$5pm$00$1@news.t-online.com>

Show Full Headers
Complete Article Headers
Message-ID: <slrnbla310.18l.tststs@moonlight.tststs.ddns.org>
Subject: Re: [slrn] date header format
Date: Tue, 02 Sep 2003 21:31:12 +0000
From: Thomas Schultz <tststs@gmx.de>
References: <slrnbl1r1e.3iq.dcmoose@moosemeat.localhost.ca> <l8p721-e2p.ln1@news.gates_of_hell.INVALID> <bishrg$5pm$00$1@news.t-online.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!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!feed.news.nacamar.de!fu-berlin.de!uni-berlin.de!acb063dc.ipt.aol.COM!not-for-mail
Newsgroups: news.software.readers
Organization: Pinguin online.
Lines: 71
NNTP-Posting-Host: acb063dc.ipt.aol.com (172.176.99.220)
X-Trace: news.uni-berlin.de 1062581775 15409329 172.176.99.220 (16 [152])
User-Agent: slrn/0.9.8.0 (Linux)