Article View: news.software.readers
Article #37830Re: 971230 slrn wishlist
From: Jan Hlavacek
Date: Thu, 01 Jan 1998 00:00
Date: Thu, 01 Jan 1998 00:00
210 lines
6555 bytes
6555 bytes
On 31 Dec 1997 09:15:14 GMT, Daniel Price <dp@cs.brown.edu> wrote:
> On 31 Dec 1997 00:47:11 GMT, Mike Ching <mtching@ching.nom> wrote:
> >
> >I'd like a way to put articles with URLs of interest to me in a "re-read"
> >newsgroup which can be used when I am online. It's clumsy trying to save
> >them when reading offline and then cutting and pasting the URL from the
> >saved file the next time I dial into my ISP.
>
> That's a great idea-- I'd often like to refer back to posts I read, and
> I find saving them off in separate files to be clumsy. You could do it
> two different ways: It could be just be a 'saved-posts' file that gets
> mapped to a virtual newsgroup (or a virtual hierarchy, like
> saves.news.software.readers); this has the advantage of being
> accessible even off-line. Or, it could be a similar setup, but with a
> list of newsgroup/post pairs that exist on the server; perhaps the user
> could choose via .slrnrc.
>
> It sure would be great to move important posts on newsgroup x.y.z to
> a 'saves.x.y.z'. Just my $.02.
>
Happy new year!
I use following set of macros to do this. It is still a little bit clumsy and
needs more work, but you can get the idea.
It will create a local spool with hierarchy arch.bla.bla.bla, and articles
you "save" will get moved into that hierarchy. Then you can start slrn eith
-DARCHIVE switch, and it will read the arch.bla.bla.bla groups from the local
spool.
variable SpoolDir = "/home/lahvak/News/Archive/";
variable MoveCMD = "mv %s %s"; % for Unix
define get_group_name (line)
{
return extract_element (line, 0, ' ');
}
define get_highest_number (line)
{
variable str = extract_element (line, 1, ' ');
while (str [0] == '0')
{
str = substr (str, 2, -1);
}
return integer (str);
}
define update_highest_number (line, number)
{
variable str = string (number);
variable pos = strlen (line) - strlen ("\n") - 12 - strlen (str);
variable i;
for (i = 0; i < strlen (str); i++)
line = strsub (line, pos + i, str[i]);
return line;
}
define get_group_info (name)
{
variable af = fopen (strcat (SpoolDir, "data/active"), "r");
variable aname = "", found = 0;
name = strcat (name, " ");
variable len = strlen (name);
if (af < 0) error ("can't find active file");
while (fgets (af))
{
aname = ();
!if (strncmp (aname, name, len))
{
found = 1;
break;
}
}
fclose (af);
if (found) return aname;
else return "";
}
define change_group_info (line)
{
system (Sprintf (MoveCMD, strcat (SpoolDir, "data/active"),
strcat (SpoolDir, "data/active.bak"), 2));
variable afb = fopen (strcat (SpoolDir, "data/active.bak"), "r");
variable af = fopen (strcat (SpoolDir, "data/active"), "w");
variable aname = "";
variable name = strcat (get_group_name (line), " ");
variable len = strlen (name);
variable found = 0;
if (afb < 0) error ("can't find active file");
while (fgets (afb))
{
aname = ();
!if (strncmp (aname, name, len))
{
found = 1;
aname = line;
}
() = fputs (aname, af);
}
fclose (afb);
!if (found)
{
fputs (line, af);
}
fclose (af);
}
define chto_group_dir (group)
{
variable newdir;
chdir (strcat (SpoolDir, "news"));
variable n = strchopr (group, '.', 0);
while (n)
{
newdir = ();
mkdir (newdir, 0777);
chdir (newdir);
if (_Return_Status) error ("mkdir failed.");
n--;
}
}
define save_art_to (group)
{
variable dir = getcwd ();
ERROR_BLOCK {chdir (dir)}
variable line = get_group_info (group);
!if (strlen (line))
{
line = Sprintf ("%s 0000000000 0000000001 y\n", group, 1);
}
variable no = get_highest_number (line);
no++;
chto_group_dir (group);
save_current_article (string (no));
line = update_highest_number (line, no);
change_group_info (line);
EXECUTE_ERROR_BLOCK;
}
define default_group (group)
{
return (strcat ("arch.", group));
}
define default_subject (subject, file)
{
return (file);
}
variable gffg = &default_group;
if (is_defined ("get_file_for_group"))
eval ("gffg = &get_file_for_group");
variable gffs = &default_subject;
if (2 == is_defined ("get_file_for_subject"))
eval ("gffs = &get_file_for_subject");
define archive ()
{
% Saves article into archive newsgroup based on some criteria.
% Offers the newsgroup name to edit.
if (is_group_mode) return ();
variable group = current_newsgroup;
variable subject = strlow(extract_article_header ("Subject"));
% First, pick a folder name based on group.
variable file = gffg (group);
% Then treat some special subjects separately.
file = gffs (subject, file);
% Not very likely that I'll edit the name,
% if I don't like it, I'll just type in a new one.
file = read_mini ("Archive to newsgroup", file, "");
save_art_to (file);
}
You have to put the following into your .slrnrc:
#ifdef ARCHIVE
set spool_inn_root "/home/lahvak/News/Archive"
set spool_root "/home/lahvak/News/Archive/news"
set server_object "spool"
server "/home/lahvak/News/Archive/news" .jnewsrc-archive
set followup "While ago, on %d, %r <%f> wrote:"
set reply_string "While ago, in %n, you wrote:"
set read_active 1
#endif
There is few quirks, but it works pretty nicely.
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/
Technical Details
Message-ID:
<slrn6amc1n.8cg.lahvak@math.mps.ohio-state.edu>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-mailReferences:
<slrn6ai43s.aho.guckes@banach.math.fu-berlin.de> <68c4mf$5dr$1@excalibur.flash.net> <68d2f2$26p@cocoa.brown.edu>Show Full Headers
Complete Article Headers
Message-ID: <slrn6amc1n.8cg.lahvak@math.mps.ohio-state.edu> Subject: Re: 971230 slrn wishlist Date: Thu, 01 Jan 1998 00:00:00 +0000 From: lahvak@math.mps.ohio-state.edu (Jan Hlavacek) References: <slrn6ai43s.aho.guckes@banach.math.fu-berlin.de> <68c4mf$5dr$1@excalibur.flash.net> <68d2f2$26p@cocoa.brown.edu> 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: 311825402 Organization: Department of Mathematics, The Ohio State University Reply-To: lahvak@math.mps.ohio-state.edu Newsgroups: news.software.readers