Thread View: news.software.readers
1 messages
1 total messages
Started by blue... Dawn Owens-Nicholson
Sat, 05 Dec 1998 00:00
Re: [slrn] save.sl/selector.sl problems.
Author: blue... Dawn Owens-Nicholson
Date: Sat, 05 Dec 1998 00:00
Date: Sat, 05 Dec 1998 00:00
126 lines
5083 bytes
5083 bytes
[I added the crosspost to news.software.readers since it's about slrn and
some people don't get alt.lang.s-lang. Please ignore
<slrn76ht7l...@ux6.cso.uiuc.edu> and
<slrn76hudj...@ux6.cso.uiuc.edu> if they reach your news server.
Cancellations have been issued for those articles.]
ras2 wrote:
> From: remov...@gmx.net (ras2)
Please ask your ISP to get a real MTA so you can filter spam and use
From: & Reply-To: as they were meant to be used.
> I feel a bit badly about asking this, but getting a clue about
> S-lang seems impossible for me, so I didn't see any other options.
The text file in slang/doc/slang.txt has been updated in the S-Lang
snapshots, and slang/doc/UPGRADE.txt file is also good.
> I often get this error: "S-Lang Error: Stack Underflow: Error
> while executing my_save", but I assume that's a platform specific
> problem and thus not relevant here.
The source of that error is the pop() in get_file_for_group(). But you
don't really need get_file_for_group() because...
> What I would like to do is to skip the group part completely, i.e.
> to not have special names for the save files, but just use the
> full group name in the same way as slrn does by default
variable
ng = current_newsgroup (),
slrn_save_name = get_variable_value ("save_directory") +
char (toupper (ng[0])) +
substr (ng, 2, -1));
will set that up in the variable "slrn_save_name".
> (the reason I have so many groups in there, is that I often get errors when
> trying to save an article in a group that's not in the script).
Now you shouldn't.
> The only part I really need is the one that saves posts by certain authors
> into specific files [...]
I've commented on each part as it appeared in your post:
> define append_article_save (file)
> {
> [...]
I know the author of this function, and I've seen this function copied
around. Here's J.B.'s comment:
Had I known this would be copied and included in a drop-in way, I would
have handled the questions that aren't properly handled here (try
call("save") on a collapsed thread or when there are numeric tags in the
header list). Doing all the prep work to answer these questions clutters
the simplicity quite a lot, unfortunately. If there's interest in a
useful drop-in replacement, I can write one, but otherwise just be
prepared to answer some questions sometimes.
> define get_file_for_group (group)
> {
> switch (group)
> [...]
> {pop (); group;}
Change this line to "{ group; }"--recent S-Lang versions don't need the
pop() in the default case. But the trick is you don't really need this
function at all.
> define my_save ()
> {
I suggest a simpler version, one possible solution:
define my_save ()
{
variable
ng = current_newsgroup (),
file = char (toupper (ng[0])) + substr (ng, 2, -1),
author = extract_article_header ("From"),
file_map = Assoc_Type[String_Type],
regex = "",
save_directory = get_variable_value ("save_directory");
% Add as many of these as you want:
% file_map["author regex"] = "filename";
file_map["nnnn"] = "nnnn";
file_map["ras2"] = "x";
file_map["[hH][oO]t chocolate"] = "/hotchoc"
foreach (file_map) using ("keys") % which file to use?
{
regex = ();
if (string_match (author, regex, 1))
{
file = file_map[regex];
break;
}
}
if (file[0] != '/') % set up file (dir + file)
{
if (save_directory[-1] != '/') save_directory += "/";
file = save_directory + file;
}
file = read_mini ("Append to file", file, "");
append_article_save (file);
}
definekey ("my_save", "o", "article");
Set save_directory in your slrn.rc to "/slrnsave" and this should work as
you seem to want in your posted code. Obviously, here the keys aren't
necessarily searched in the order they're set. I figured author's names
are unique enough that this shouldn't be a problem.
> (hoping that this made just a bit of sense).
In the future, it might help to start with a clean slate and try to tell
other people what you want your program to do--most of the code you used
wasn't really needed. You really only needed slrn, append_article_save()
and my_save().
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